[otw_is sidebar=otw-sidebar-1]In this post I will discuss the introduction of the Arduino Lilypad. In the previous post I have discussed about the Arduino NANO, UNO, MEGA and other Arduino boards. This article is oriented around the discussion on the Arduino Lilypad and the similarities and differences of the Arduino Lilypad and other Arduino boards.
After reading this article the reader will be able to learn about the Arduino Lilypad, the applications of the Arduino Lilypad, the schematics and the similarities and differences of the Arduino Lilypad and other boards.
Arduino Lilypad is the open-source microcontroller development board based on the ATMEGA168V (low power version of the ATMEGA168) or ATMEGA328V microcontroller IC. It is important to note here that the Arduino UNO is based on the ATMEGA328P microcontroller IC. Arduino Lilypad is very unique in its shape and applications as compared to the other Arduino boards that is Arduino Lilypad is based on the circular PCB with the wide holes at the corner and is optimized for the e-textiles and wearable electronics. The Arduino Lilypad shares an important feature with the Arduino PRO MINI that is it does not have built in USB to UART converter which means that unlike Arduino NANO, UNO, MEGA and MICRO the Arduino Lilypad needs an external hardware in order to program and monitor the Arduino Lilypad. It is important to mention here that the Arduino UNO and MEGA board has USB to UART converter mounted on boards which acts as the bridge between USB data and UART data, whereas the microcontroller IC of the Arduino NANO and MICRO has built in USB interface therefore neither they need and external hardware nor they need USB to UART bridge. The Arduino Lilypad is programmed and monitored through the USB to UART FTDI converter which I will discuss in the section to follow. Arduino Lilypad looks like the one in the following image.
Note in the above image that the Arduino Lilypad has no USB port on it as described earlier. Lilypad is programmed via FTDI connector as shown in the above picture. Arduino Lilypad has 14 digital input / output pins out of which 6 are PWM enabled. The PWM (Pulse Width Modulation) phenomenon and the use of these pins will be discussed later in the post. Arduino Lilypad has 6 analog pins which mean that it can read up to 6 analog sensors simultaneously. The pinout of the ATMEGA 168V 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 Lilypad can also be programmed in the similar way; that is the programming of the Arduino Lilypad is not different from that of the Arduino UNO however it should be kept in mind that Arduino Lilypad has different number of pins and different pin configuration. The care should be taken while configuring the Arduino Lilypad 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 Lilypad is quite easy to program it is just a matter of few clicks. I will go through in detail about how to write a code and upload it in Arduino Lilypad later in the post. Note. Before concluding this section it is important to note here that the drivers for the Arduino Lilypad should be installed in the computer before uploading the code because otherwise the Arduino board would not be recognized by the computer.
Arduino Lilypad features:
Let us now learn some of the general specifications of the Arduino Lilypad microcontroller development board. As stated earlier that the Lilypad is based on the ATMEGA168V microcontroller IC so the basic features of the Arduino Lilypad are essentially that of the ATMEGA168V microcontroller IC. Some of the general specifications of the Arduino Lilypad are as shown follows:
- Microcontroller IC: Microchip ATMEGA168V or ATMEGA328V
- Operating Voltage: 2.7V to 5 Volts
- Input Voltage: 2.7V to 5 Volts
- Digital I/O Pins: 14 (of which 6 provide PWM (Pulse Width Modulation) output)
- Analog Input Pins: 6
- DC Current per I/O Pin: 40 mA (This is the current that can be sourced or sink into and out of the Input / Output pins)
- Flash Memory: 16 KB out of which 2 KB is used by boot loader
- SRAM: 1 KB
- EEPROM: 512 Bytes.
- Clock Speed: 8 MHz
Notice from the specifications of the Arduino Lilypad that most of the specifications of the Arduino Lilypad are in common with other Arduino boards such as Arduino PRO MINI and MICRO.
Arduino Lilypad Pinout:
Let us now dive into the discussion of the pinout of the Arduino Lilypad. As described earlier that the Arduino Lilypad is based on the ATMEGA168P microcontroller IC so it follows that the pinout of the Arduino Lilypad is simply that of the ATMEGA168P microcontroller but note here that the Arduino Lilypad has its own nomenclature for its pins and here I will use the nomenclature used by the Arduino for pin reference.
The Arduino Lilypad has a circular shape with the wholes on it for creating connections with the external circuits. The holes are made extra wide as Arduino Lilypad is intended to be sewn on the clothes. All the pins of the microcontroller can be accessed via these holes.
As pointed out earlier that the Arduino Lilypad has total 14 Digital Input / Output pins. The digital Input / Output pins can receive a digital signal or transfer a digital signal. Out of these 14 Digital Input / Output pins 6 are PWM (Pulse Width Modulation) enabled and some pins can also be configured as either SPI (Serial Peripheral Interface) or I2C (Inter-Integrated Circuit) computer bus. The Arduino Lilypad also has one UART with Rx and Tx signals on pin number 0 and 1 respectively that are used for serial communication. The Arduino Lilypad also has voltage pins on board with which it can be powered up itself or can power up other peripheral ICs. There are total 6 analog pins on the Arduino Lilypad. Unlike Digital pins these pins can just act as the Input pins, that are 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 ATMEGA168P microcontroller. These pins can be connected to the output of the analog sensors. 6 different analog sensors can be connected to the Arduino Lilypad simultaneously. The analog pins of the Arduino Lilypad need some more discussion which will follow in the next sections.
Let us now discuss in detail the digital Input / Output pins, Analog input pins and Voltage pins of the Arduino Lilypad.
Arduino Lilypad Digital Input / Output Pins:
As described in the previous section that the Arduino Lilypad has total 14 digital input / output pins out of which 6 digital input / output pins are PWM enabled. Some of these Digital Input / Output pins can also serve as the SPI (Serial Peripheral Interface) or I2C interface (Inter-Integrated Circuit). 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 Lilypad. That is whether the pin number 28 and 27 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. In a similar way the digital input / output pins can also act as the SPI (Serial Peripheral Interface) bus, that is the pin number 18 and 17 act as the MISO (Master IN Slave Out) and MOSI (Master Out Slave In) respectively and pin number 16 and 19 gives the functionality of the Chip select (SS) and Serial Clock (SCK) and together they create the SPI bus. 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 Lilypad later in this post. Another point worth mentioning is that six out of the 14 digital input / output pins are PWM enabled 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 pin number 0 and 1 bears the functionality of the Tx and Rx signals of the UART and these pins are also used for programming the Lilypad as pointed out earlier.
Arduino Lilypad Analog Pins:
As mentioned previously that the Arduino Lilypad has 6 Analog inputs which means that 6 different analog sensors can be interfaced to the Arduino Lilypad and the Arduino Lilypad can fetch the data from these 6 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. The six analog pins are basically the inputs of the ADC (analog to digital converter) and are present on the pins 14, 15, 16, 17, 18, 19.
Arduino Lilypad PWM Pins:
Let us now discuss the PWM pins of the Arduino Lilypad in some detail. As mentioned in the previous section that the Arduino Lilypad has 6 PWM pins which are numbered as 9, 10, 15, 16 and 17. 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 Lilypad Schematics:
The Arduino Lilypad has simplest schematics among all the boards and almost similar to that of the Arduino PRO MINI. As told earlier that the Arduino Lilypad is based on the ATMEGA168P microcontroller which lacks the built in USB to UART Bridge and thus needs the external hardware in order to program the Lilypad which I will discuss in the next section. The schematic of the Arduino Lilypad is as shown in the following image:
Arduino Lilypad Programming:
As pointed in the earlier sections that we need an external hardware in order to program the Arduino Lilypad. This external hardware is called the FTDI converter and acts as the bridge between USB and the UART data. The FTDI converter receives the data in the USB format and then converts it to the form that is compatible to the Arduino Lilypad. As the Lilypad has the UART interface thus it can understand the data received from the FTDI converter.
Arduino Lilypad Applications:
Before discussing the programming language of the Arduino Lilypad let us first know the applications of the Arduino Lilypad for motivation. Arduino Lilypad can be used in almost all the applications that are served by the other Arduino Boards unless limited by the number of the pins and the size of the memory. But it is important to note that die to the unique design of the Arduino Lilypad it has some unique applications. Arduino Lilypad is popular among e-textiles and wearable. Some of the applications of the Arduino Lilypad are as shown in the following.
- Pillow alarm.
- Helmet indicator.
- Jacket indicator.
- Step counter Shoes.
- Body Position sensor.
- Blood Pressure measurement.
Arduino Lilypad programming language:
One of the perks that make Arduino Lilypad quite popular among the hobbyists and beginners is it’s easy to use programming language and programming. The programming language used by the Arduino Lilypad is the C++. The Arduino Lilypad IDE has a well-defined function for each task that is easy to remember. As an example the function that specifies the Arduino Lilypad 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 Lilypad 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.