Posted on

Lilypad Arduino

Lilypad Arduino main board
Lilypad Arduino

Lilypad Arduino is changing the way we look at and experience clothing with electronics textiles or e-textiles. You can make dresses that read you poetry or have sensors smuggled inside lace. Or if you like, add projections into your petticoats! What will your first project be?

What are e-textiles?

Put simply, e-textiles are fabrics that have electronics embedded in them. They react like any other circuit, but the components are often design to be easily sewn. The components have blunter corners and a flatter profile to avoid snagging. Most components are washable, but do check to make sure you know which ones.

Conductive thread

The biggest difference between e-textiles and traditional electronics is the use of conductive thread. Conductive thread consists of normal filaments (tiny strands of cloth), each coated with a micron-thick layer of natural silver. It’s the silver that carries that current and works the magic!

SparkFun DEV-11791 Conductive Thread – 60g (Stainless Steel)

Before you start with Lilypad Arduino

Sew around each connecting pad at least three times – this will ensure a good connection.

There’s no need to sew in resistors. If you look at the tiny Lilypad LED boards, they already have a surface mounted resistor in place, so you don’t have to worry.

Lilypad Arduino

You will need

Lilypad coin cell battery holder or board

Coin battery

Lilypad LED board pack

Lilypad ON/OFF switch

Conductive thread

Aida embroidery fabric

Embroidery Floss (for patterns around your circuit – you want it to look good)

Needle

A simple circuit

For this simple circuit, we are going to sew together four LEDs in parallel with an ON/OFF switch.

Both of these diagrams show the same circuit. Drawing out your idea beforehand can help you plan what’s going where.

schematic - Lilypad Arduino
graphical diagram - Lilypad Arduino

Neatly sew together the positive (+) ‘wire’ (the side indicated by the red floss), making sure to loop around each component’s pad at least three times. When you reach the last LED, simply tie a knot and cut the thread. Do the same for the negative (-) wire. As with normal electrical wire, the conductive thread will short-circuit if you allow it to touch itself, so make sure all loose ends are cut short.

What is Lilypad Arduino?

Lilypad Arduino is a wearable programmable system. As with other Arduino models, you can upload sketches to it. You can instruct it to have input and outputs, powering it with a battery or USB. A small lithium battery is perfect for the Lilypad Arduino Simple Board. It has a JST socket (a type of DC connector) so it’s easy to remove and charge.

Note: Do not use more than 5.5V or you’ll end up frying your Arduino!

Warning: Unplug the battery before washing and hand wash in cold water with a gentle detergent. Do not dry clean.

How do you upload a sketch for Lilypad Arduino?

Arduino software is available free from this link. Once that is installed, upload your sketch to your Lilypad Arduino by using an FTDI USB adapter. Now you have your fabric sampler all ready. You can now play! Code, adapt and let your imagination run wild!

Lilypad Arduino

Take this to the next level!

Why not try a more complicated circuit? This project uses a light sensor to change the colour of an RGB (red / green / blue) LED and flash a set of white LEDs in parallel. The opportunities are endless.

You could light up the dancefloor in a charged circle skirt, send messages via your tanktop or explore a city with a sensor-triggered guide sewn into your shoes.

Conduct your own experiments in style! Proto-PIC are a UK Distributor for Sparkfun Lilypad and we can source all the components you need. If you don’t see what you need on our site, we can order and ship very quickly, so do contact us and let us know what you need.

Posted on

Arduino Based Voltage Meter

Arduino Uno R3 Main Board Front/Top View A000066

I was looking at making some videos on Arduino development, and while planning the recording sessions, I thought about using a web-cam to show a multi-meter screen to show readings on a circuit. While this would not be too difficult to arrange, I thought ‘What if I could read the voltage and display it on my PC screen!’.  This lead to a mini project . .

      The first step was to read the voltage using an analog input on the Arduino, and scale this to the actual voltage, As I am using a USB connection to power the Arduino (and my final project) – I read the voltage using my multi-meter and took a note of this (5.14 Volts), to use later in my code. I then wrote code to print the voltage reading to the Serial Monitor :

VoltMeter1.ino      int myVoltageReading = 5.14;      unsigned int analogIn = 0;      void setup()      {              Serial.begin(115200);      }       void loop()      {              analogIn = analogRead(A0);              analogIn = map(a, 0, 1023, 0, myVoltageReading * 1000);                if (analogIn < 10) Serial.print(“0”);               if (analogIn < 100) Serial.print(“0”);              if (analogIn < 1000) Serial.print(“0”);              if (analogIn < 10000) Serial.print(“0”);              Serial.println(a, DEC);              delay(150);      }

This is reading the analog port every 150mS and sending the voltage to the serial monitor in micro Volts. A good start. Now to write a C# application to get this info and display it on screen. Using Visual Studio, I started a new application, and designed a form with a nice big font displaying ’00:000 V’.  This was going to be my canvas. I then needed a way to select the COM port that the Arduino would be connected to, I had used a similar piece of code in an earlier project, so I just cut and pasted that into my new project. I also added a drop down box, label and a button. I then wrote the serial data handler part of the application. The application would open the serial port, and when it received some data, it would call a function that took this data and updated the display. Unfortunately this did not go as I had hoped due to the data structure (or lack of structure) as the application would often show random values. I then decided to update the Arduino sketch to send a header, and footer to the data. This would allow the C# application to parse the data in a controlled manor. Here is the update :

VoltMeter2.ino

      int myVoltageReading = 5.14;
      unsigned int analogIn = 0;
      void setup()
      {
              Serial.begin(115200);
      }

      void loop()
      {
              analogIn = analogRead(A0);
              analogIn = map(analogIn, 0, 1023, 0, myVoltageReading * 1000);
              Serial.print(“@”);
              if (analogIn < 10) Serial.print(“0”);
              if (analogIn < 100) Serial.print(“0”);
              if (analogIn < 1000) Serial.print(“0”);
              if (analogIn < 10000) Serial.print(“0”);
              Serial.print(analogIn, DEC);
              Serial.print(“#”);
              delay(150);
      }

      This is now good for reading voltages up to myVoltageReading, but some of the circuits may require up to 9 Volts (or higher). This can be arranged using 2 resistors, and a small change to the code. I am using 2 x 8.2K matched resistors (I matched them using my multi-meter), though you could use 2 resistors of the same unmatched value if you just wanted approximate voltage. I connected the resistors in series, one end to GROUND on the Arduino, the intersection of the resistors to the A0 pin, and my input probe to the free end of the resistor pair. Updating the code to the code below, I could now read up to 10V and I also stabilized the reading by taking an average of 10 reads. I used my meter and a 9V battery to give a reference so I could ‘trim’ the top end. I decided to do this rather than use a voltage reference as I wanted this to be as cheap as possible.

VoltMeterFinal.ino

      unsigned int analogIn = 0;
      void setup()
      {
              Serial.begin(115200);
      }

      void loop()
      {
              for (int loopy = 0; loopy < 10; loopy++)
        {
               analogIn = analogIn + analogRead(A0);
               delay(10);
        }
              analogIn = analogIn / 10;
              analogIn = map(analogIn, 0, 1023, 0, 10190); // The last value here has been trimmed – 9.2V on Milti-meter matches
              Serial.print(“@”);
              if (analogIn < 10) Serial.print(“0”);
              if (analogIn < 100) Serial.print(“0”);
              if (analogIn < 1000) Serial.print(“0”);
              if (analogIn < 10000) Serial.print(“0”);
              Serial.print(analogIn, DEC);
              Serial.print(“#”);
              delay(50);
              analogIn = 0;
      }

      Now that I have this up and running, I wanted to make the project as small as I could. I got a 5V pro-mini and an FTDI based USB to Serial board (Though any USB -> Serial adapter would be OK) and soldered them together, one on top of the other.  I had an old muti-meter, and using the leads from this, I made my probes, and then secured them with hot glue (After soldering them to Ground and the Resistors), finally wrapping the electronics in heat tubing. This is now sitting in my tools drawer, ready to go. I have built one of these for myself, for using at home.

Click here for the code for this project.