Working With The Arduino Lilypad

Hey guys!

Today’s post is all about the Arduino Lilypad and the world of wearable technology. I wanted this blog update to focus on the processes and steps that are involved with prototyping. I’ll be creating a tie that uses haptic feedback (vibration) and a dynamic neopixel light to alert the user. The alerts can be triggered by a number of different things, including if someone has texted you, changes in local pollution, or even a preset medication alarm.

 

arduino

I started the project by gathering necessary materials. An Arduino Lilypad processing board connected to a lithium ion battery are displayed above.

 

sensors

A bunch of sensors and switches were used with this project. The golden one in the middle is a vibration motor, while the two in the background are neopixel lights. The small modules directly to the left and right of the vibration motor are switches.

 

thread

Of course, I’d be needing some conductive thread as well.

 

tie

This tie acted as the scaffold for the project.

 

usb_breakout

Lastly, a mini USB cable and a FTDI board were required, to eventually transfer code on to the Arduino board.

 

negative_power

I promptly proceeded to sew a connection from the negative end of the vibration motor to the Arduino board.

 

positive

I also decided to use port 11 for the vibe motor.

 

negative_switch

Next, I connected the negative terminal of a slide switch to the main board.

 

positive_switch

The positive end wasn’t too far behind.

 

NeoPixel

Turning the tie around, I joined the negative end of the neopixel to the Arduino Lilypad with some careful thread connections.

 

completed_circuit

The positive end of the neopixel was also connected. At this point, the circuit was complete.

I subsequently brought out the FTDI board and my USB cable to program the Arduino. A sample of some code I implemented with this tie is pasted below. Note that I don’t implement the slide switch in this rendition of the program.

 

#include <Adafruit_NeoPixel.h>

#define PIN 5

Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);

int motor = 11;

void setup() {
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
pinMode(motor, HIGH);
}

void loop() {
colorWipe(strip.Color(0, 255, 255), 50); // Blue
digitalWrite(motor, HIGH); // turn the motor on
delay(4000);
digitalWrite(motor, LOW); // turn the motor off
colorWipe(strip.Color(0, 0, 0), 50); // No color
delay(3500);

colorWipe(strip.Color(0, 255, 0), 50); // Green
digitalWrite(motor, HIGH); // turn the motor on
delay(2000);
digitalWrite(motor, LOW); // turn the motor off
delay(1000);
digitalWrite(motor, HIGH); // turn the motor on
delay(2000);
digitalWrite(motor, LOW); // turn the motor off
delay(1000);
colorWipe(strip.Color(0, 0, 0), 50); // No color
delay(3500);

colorWipe(strip.Color(255, 255, 0), 50); // Yellow
digitalWrite(motor, HIGH); // turn the motor on
delay(1000);
digitalWrite(motor, LOW); // turn the motor off
delay(500);
digitalWrite(motor, HIGH); // turn the motor on
delay(1000);
digitalWrite(motor, LOW); // turn the motor off
delay(500);
digitalWrite(motor, HIGH); // turn the motor on
delay(1000);
digitalWrite(motor, LOW); // turn the motor off
delay(500);
digitalWrite(motor, HIGH); // turn the motor on
delay(1000);
digitalWrite(motor, LOW); // turn the motor off
delay(500);
colorWipe(strip.Color(0, 0, 0), 50); // No color
delay(3500);

colorWipe(strip.Color(255, 50, 0), 50); // Yellow
digitalWrite(motor, HIGH); // turn the motor on
delay(500);
digitalWrite(motor, LOW); // turn the motor off
delay(200);
digitalWrite(motor, HIGH); // turn the motor on
delay(500);
digitalWrite(motor, LOW); // turn the motor off
delay(200);
digitalWrite(motor, HIGH); // turn the motor on
delay(500);
digitalWrite(motor, LOW); // turn the motor off
delay(200);
digitalWrite(motor, HIGH); // turn the motor on
delay(500);
digitalWrite(motor, LOW); // turn the motor off
delay(200);
digitalWrite(motor, HIGH); // turn the motor on
delay(500);
digitalWrite(motor, LOW); // turn the motor off
delay(200);
digitalWrite(motor, HIGH); // turn the motor on
delay(500);
digitalWrite(motor, LOW); // turn the motor off
delay(200);
digitalWrite(motor, HIGH); // turn the motor on
delay(500);
digitalWrite(motor, LOW); // turn the motor off
delay(200);
colorWipe(strip.Color(0, 0, 0), 50); // No color
delay(3500);
}

void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);

}
}

 

finished_tie

 

The final result was pretty satisfying! In the future, I plan on connecting a bluetooth or Wi-Fi module to the tie to allow it to communicate with a smartphone. I love the flexibility of wearable technology modules and creating prototypes is always fun! I believe that we will continue to see steady growth in the wearable technology sector for years to come, as we may be on the event horizon of a biotechnological revolution.

Until next time,

 

– MAZ

 

Related Posts