After reading this post the reader will be able to learn about the basics of the Arduino YUN, its applications, functionality and hardware of the Arduino YUN. So sit back, keep reading and enjoy learning.
Arduino YUN for Beginners:
Arduino YUN like other Arduino microcontroller boards is the open source microcontroller development boards which is based on ATMEGA32U4 microcontroller IC. Note here that the microcontroller IC used in the Arduino YUN is not unique that is it is used in other Arduino microcontroller boards as well such as Arduino Leonardo. An important thing that makes Arduino YUN unique is an additional microprocessor on board that is ATHEROS AR9331 which adds additional features to the YUN such as Wi-Fi compatibility, Ethernet connectivity and SD card slot. These features make Arduino YUN useful in networking and Internet of Things (IoT) applications. Atheros AR9331 is an amazing microprocessor although all of the features of the processor are not employed in the Arduino YUN. The functional block diagram of the Atheros AR9331 is as shown in the following picture.
The Arduino Yun has 20 digital input / output pins out of which 7 are PWM (Pulse Width Modulation) enabled. The phenomenon and applications of the PWM will be discussed later in the post. It is important to note here that Atheros AR9331 also has GPIOs (General Purpose Input / Output) pins but none of them are employed in the Arduino Yun and only the GPIOs of the ATMEGA32U4 are available on the headers. YUN has 12 analog input pins an important point which was also mentioned in the Arduino Leonardo is that some of the digital input / output pins of the Arduino YUN can also be used as Analog inputs. Arduino Yun has on board USB port, ICSP header, Ethernet port and is Wi-Fi enabled. Atheros AR9331 processor supports distribution of Linus based on OpenWrt. Arduino YUN looks like the one in the following image.
Before diving deep into the discussion on the Arduino Yun let us first know the role and connectivity of the Atheros AR9331 microprocessor. Atheros AR9331 is highly integrated and cost effective SoC (System on Chip) based on MIPS 24k processor. The microprocessor has UART, Ethernet interface, USB interface, external memory interface for DDR1 and DDR2 and GPIOs (General Purpose Input / Output) pins. The pinout of the microprocessor is as shown in the following image:
Atheros AR9331 communicate with the ATMEGA32uF via UART and thus acts as the bridge between UART and Ethernet interface. The block diagram of the ATMEGA and Atheros AR9331 is as shown in the following figure:
Arduino Integrated Development Environment (IDE):
In the post on the Arduino UNO we learned that the Arduino UNO can easily be programmed using the Arduino IDE. The Arduino YUN can also be programmed in the similar way; that is the programming of the Arduino YUN is not different from that of the Arduino UNO, however it should be kept in mind that Arduino YUN has different number of pins and different pin configuration. The care should be taken while configuring the Arduino YUN pins. As most of you might have known that in order to program a microcontroller one need to write the code in the editor, and then compile that code in the compiler after which you get the HEX file of that code and later upload that HEX file in the microcontroller IC using another program. In case of Arduino all these steps are performed in single software which is called the Arduino IDE. By integrated Development Environment it means that all the steps that editor, compiler, burner are integrated in the same software. In short Arduino YUN is quite easy to program it is just a matter of few clicks. It is important to note here that the board type should be selected before uploading the code that is before uploading the code from Arduino IDE one need to select the board to which he / she is intended to burn the program. From tools select board as Arduino DUE otherwise the error will occur and your board would not get programmed as shown below.
An interesting perk of the Arduino YUN is that once connected to the Wi-Fi it can also be programmed through Wi-Fi. The method of programming the Yun via Wi-Fi is out of the scope of this post but I will come to this point later in my next post.
Arduino YUN Features:
Let us now learn some of the common specifications of the Arduino YUN microcontroller development board.
- Microcontroller IC: ATmega32u4.
- Operating Voltage: 5 Volts
- Input Voltage: 5 volts.
- Digital I/O Pins: 20 (of which 7 provide PWM (Pulse Width Modulation) output).
- Analog Input Pins: 12
- DC current per I/O pins: 40mA on I/o pins; 50mA on 3V3 Pin.
- Flash Memory: 32kB (of which 4Kb is used by the Bootloader).
- SRAM: 2.5kB.
- EEPROM: 1Kb.
- Clock Speed: 16 Mega Hertz.
The features of the Atheros AR9331 microprocessor are as shown in the following:
- Processor: Atheros AR9331.
- Architecture: MIPS.
- Operating Voltage: 3V3.
- Ethernet: 802.3 10/100Mbit/s.
- Wi-Fi: 802.11b g / n 2.4GHz.
- USB Type: 2.0 Host.
- Card Reader: Micro-SD.
- RAM: 64 MB DDR2.
- Flash Memory: 16 MB.
- SRAM: 2.5KB.
- EEPROM: 1KB.
- Clock Speed: 400 MHz.
Arduino YUN Pinout:
Let us now dive into the discussion about the pinout of the Arduino YUN. As described earlier that the Arduino YUN is based on the ATMEGA32U4 microcontroller IC so it follows that the pinout of the Arduino YUN is simply that of the ATMEGA32U4 microcontroller but note here that the Arduino YUN has its own nomenclature for its pins and here I will use the nomenclature used by the Arduino YUN for pin reference Also note here that as mentioned earlier all of the GPIOs available on the headers of the Arduino YUN are derived from ATMEGA32u4 and none of the GPIOs of the Atheros AR9331 are employed in the Arduino YUN.
As can be seen that on the Arduino YUN that there are three headers mounted on board. The headers on the Arduino YUN bears the Digital Input / Output pins, Analog input pins and the Power pins.
As pointed out earlier that the Arduino YUN has total 20 Digital Input / Output pins. The digital Input / Output pins can receive a digital signal or transfer a digital signal. Out of these 20 Digital Input / Output pins 7 are PWM (Pulse Width Modulation) enabled and some pins can also be configured as either SPI (Serial Peripheral Interface) computer bus. The Arduino YUN also has one UART with Rx and Tx signals on pin number 0 and 1 respectively that are used for serial communication. The headers on the other side of the Arduino YUN bear the voltage pins and the Analog pins. There are total 12 analog pins on the Arduino YUN and 6 out of them ranging from A0 – A5 are available on this header. Unlike Digital pins these pins can just act as Input pins, that is these pins can only receive signal and cannot provide signal or voltage, that is why they are called Analog inputs. These analog inputs are actually the inputs of the Analog to Digital Converter inside the ATMEGA 32U4 microcontroller. These pins can be connected to the output of the analog sensors. 12 different analog sensors can be connected to the Arduino YUN simultaneously. The analog pins of the Arduino YUN need some more discussion which will follow in the next sections.
The third header of the Arduino YUN bears the voltage pins that are used to power up the Arduino Leonardo YUN, these pins are also used to deliver power from the Arduino YUN board to other peripheral devices or the sensors attached to the Arduino YUN microcontroller development board.
Let us now discuss in detail the digital Input / Output pins, Analog input pins and Voltage pins of the Arduino YUN.
Arduino YUN Digital Input / Output Pins:
As described in the previous section that the Arduino Leonardo has total 20 digital input / output pins out of which 7 input / output pins are PWM enabled. Some of these Digital Input / Output pins can also serve as the SPI (Serial Peripheral Interface). The detailed description is shown in the following figure:
The function that the digital input / output pins perform depends upon the coding of the Arduino YUN. That is whether the pin number 2 and 3 functions simply as Digital Input / Output or they are used as the Inter-Integrated Circuit(I2C) bus depends upon the coding that specifies their functionality using particular functions. It is also important to note here that the Digital Input / Output pins are called as Input / Output because either they can be used as Input in which case they are intended to receive the signals from sensor or transducer (digital) or they can be used as Output in which case they drive the actuators such as relays. The functionality of the Digital Input / Output pins as either Input or Output is determined by the code also. It is important to realize here that digital input / output pins can only supply a limited amount of current which is not sufficient to drive the motors or relays therefore we need to use drivers such as stepper motor driver or L298 DC motor driver. I will come to the coding of the Arduino YUN later in this post. Another point worth mentioning is that seven out of the 20 digital input / output pins 7 are PWM enabled pins that is these pins can provide PWM (Pulse Width Modulation) signal as output. These PWM pins find applications in which we need to regulate something for example the speed of the motor or brightness of the lamp.
The I2C serial communication bus as shown in the above image is embedded on Digital Input / Output pins it is opposite to that of the Arduino UNO, NANO and PRO MINI in which this computer bus is present on the analog side. Before concluding this section it is important to note that SPI interface is present on the ICSP header and has no connection on the Digital Input / Output pins as in the case of the Arduino UNO.
Arduino YUN Analog Pins:
As mentioned previously that the Arduino YUN has 12 Analog inputs which means that 12 different analog sensors can be interfaced to the Arduino YUN and the Arduino YUN can fetch the data from these 12 analog sensors simultaneously. Unlike the Digital Input / Output pins these Analog Pins are the input only that these pins can only receive the analog signals that is read the signals and cannot drive the signal outwards. An interesting point to note that all the Analog pins on the Arduino YUN board can also acts as the digital input / output pins. The analog pins other than the pins A0-A5 are available on the digital input / output pins 4, 6, 8, 9, 10, 12. Note in the picture that the digital pins with the dot above them act as the analog inputs.
Arduino YUN PWM Pins:
Let us now discuss the PWM pins of the Arduino YUN in some detail. As mentioned in the previous section that the Arduino YUN has 7 PWM pins which are numbered as 3, 5, 6, 9, 10, 11 and 13. These digital pins can deliver the PWM signal as output. The PWM is the abbreviation of the Pulse Width Modulation and it is a phenomenon in which we adjust the width of the pulse according to the requirement of the applications. For example if one needs to regulate the speed of the motor or the brightness of the lamp this can be achieved by varying the width of the PWM signal. The power delivered by the PWM signal is the average of the signal for which it is zero and for which it is maximum. If the width of the PWM signal for which the signal remains HIGH is greater than more power will be delivered and thus reducing the width will cause the reduction in the power delivered. The width of the PWM signal for which the signal remains HIGH during its time period is referred to as the Duty Cycle of the PWM signal. The PWM pins are also used to control the angular position of the Servo motors.
Arduino YUN Schematics:
The schematic of the Arduino YUN is very unique as compared to that of the other Arduino Microcontroller development boards. Notice from the schematics shown below that Arduino YUN has communications between ATmega32u4 and Atheros 9331 via UART thus the data can also be translated from the UART to the Ethernet standard. The complete schematic of the Arduino YUN is as shown in the following image:
Arduino YUN Applications:
Before discussing the programming language of the Arduino YUN let us first know the applications of the Arduino YUN for motivation. So basically the Arduino YUN can be used in any system that requires the microcontroller. It is now the most commonly used microcontroller development board that is equally popular among the hobbyists and the engineering students. Some of the embedded systems in which the Arduino can be used are listed below:
- IR remote based Home Automation System.
- Bluetooth controlled Home Automation System.
- IoT enabled Home Automation System.
- RC car.
- Mobile lifter.
- Hurdle Avoiding Vehicle.
- Wall climbing vehicle.
- Autonomous vehicle.
- Robotic arm.
- Internet of Things.
- Networks based on Ethernet etc.
Arduino Ethernet programming language:
One of the perks that make Arduino YUN quite popular among the hobbyists and beginners is it’s easy to use programming language and programming. The programming language used by the Arduino YUN is the C++. The Arduino YUN IDE has a well-defined function for each task that is easy to remember. As an example the function that specifies the Arduino YUN digital Input / Output pin to work as input is:
Here in this function there are two arguments. First argument is the pin number which we want to make input or output and second argument specifies the property that is input or output to the pin number used. The detailed discussion on programming the Arduino YUN will come later in the next posts.
That is all for now I hope this post would be helpful for you. In the next post I will come up with more interesting topics. Till then stay connected, keep reading and enjoy learning.