Monday 1 December 2014

LED LIT RIDING JACKET



 It has been quite a while since I posted anything here and am feeling a little guilty. But this does not mean that I have not been tinkering. I recently bought a tiny 150cc bike to navigate the crazy Nairobi traffic and when I ventured on the road I felt like a small grain sand in a sea of crazy PSVs and other motorists. After Purchasing my riding gear and using it for a while I decided to make it more visible by adding some wearable tech onto it using an LED strip arduino uno and a transistor TIP122. 


Posing with the bike



Riding jacket with LED strip on it, notice it at the elbow, waistline and back

How the jacket looks in the light, maybe it is too bright

And in the dark, amazing!

Arduino Uno thrown in the mix to add different lighting effects


The code that runs this jacket is simply a combination of the fading example and the blinking example that comes with the arduino IDE.
/*
 Fade
 
 This example shows how to fade an LED on pin 9
 using the analogWrite() function.
 
 This example code is in the public domain.
 */

int led = 3;           // the pin that the LED is attached to
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by

// the setup routine runs once when you press reset:
void setup()  { 
  // declare pin 9 to be an output:
  pinMode(led, OUTPUT);
} 

// the loop routine runs over and over again forever:
void loop()  { 
  int x=0;
  for(x=0;x<255;x++){
  // set the brightness of pin 9:
  analogWrite(led, brightness);    

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade: 
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ; 
  }     
  // wait for 30 milliseconds to see the dimming effect    
  delay(30); 
  }  
  
  for(x=0;x<5;x++){
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
  }
  
  for(x=0;x<10;x++){
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(500);              // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(500);              // wait for a second
  }
} 
 
 
Enjoy!