Lilypad - The Main Board


mainboard2.jpg
Lilypad Main Board (ATMega328) with FTDI USB breakout connected

[How to load an Arduino Sketch]

Description:

The Lilypad main board (the circular component in the picture above) is the heart and brains of the Lilypad system. At the centre of the board is a micro-controller (small computer) that you can program using the Arduino software. The silver petals around the outside of the board are connection points that you can use to connect sensors, LEDs, buttons etc to the board.

The Lilypad system was designed by Leah Buechley and SparkFun Electronics for use in wearables and e-textiles. The board has been designed so that components can be connected together by sewing them onto fabric with metal conductive thread. You can also temporarily connect components using alligator leads. Alternatively, you can use solder and wire for more permanent setups (if your design does not need the flexibility of fabric and thread).

The Lilypad board can be powered via the FTDI breakout component (the red rectangular component in the picture above). This component needs to first be connected to the Lilypad (like in the picture above) and then connected via a USB miniB cable to a USB port on a computer. Once you have your Lilypad connected to a computer via USB the board will turn on and run the program that is currently loaded. The USB connection also allows you to upload a new program to the Lilypad board via the Arduino software (free download).

Another way to power the Lilypad main board is to connect the power supply component and insert a triple-A battery. Powering the board this way means that your Lilypad can operate independently of a computer. You will, however, still need to connect the board to the computer via USB when you want to upload a new program.

With the xBee components in your kit you can communicate wirelessly between a computer and your Lilypad. This is useful if you want to send sensor data from a Lilypad to a computer but need the Lilypad to be attached to a moving person or thing.

If you look closely at the Lilypad main board you will see that each petal is labeled. The petals labeled 0-13 are digital I/O pins ( I/O = input or output). Of these digital pins, those numbered 3,5,6, 9,10 and 11 are what is known as pulse width modulation pins (PWM). You use these PWM pins when you want to output an analog style varying signal. You can use this type of signal to, for example, gradually fade an LED. The pins labeled a0-a5 are analog input pins. The board also has a reset button (brass circle within metal square at about 6 oclock in the picture above) and a small LED that is connected to digital pin 13. Finally, the board has a pin that supplies power (+) and a ground pin (-).

The full schematic for the Lilypad main board can be downloaded from the Arduino site. Leah Buechley also has a good site with introductory tutorials on creating projects using the Lilypad system.
4545291860_07b8c55370.jpg
Lilypad Mainboard Pins


Loading an Arduino Sketch onto the Main Board:

  1. Connect the FTDI Basic Breakout component to the Lilypad main board and then use a USB miniB cable to connect the FTDI to a USB port on your computer.
  2. Open the Arduino software (free download).
  3. From the top menu choose Tools > Board > Lilypad Arduino w/ ATMega328. OR Tools > Board > Arduino Nano w/ ATMega328.
  4. Then from the top menu choose Tools > Serial Port > /dev/tty.usbserial-... (the usb port number at the top of the list - number will vary depending on computer).
  5. Open a sketch or write one. For example, choose File > Examples > Digital > Blink.
  6. Click the verify (play) button to check that there are no errors in your code. If you do have any they will appear in red in the black section at the bottom of the Arduino sketch window.
  7. Picture_6.pngIf your code is error free then click on the upload button to upload the program to the Lilypad main board. You will see some lights twinkling on the FTDI board while this is happening and the upload button will turn yellow. When the program has loaded you will see a message at the bottom of the Arduino sketch window saying "Done uploading". Your program will then run.