Related Posts Plugin for WordPress, Blogger...

Navigation

July 25, 2013

LED Navigation Light with ATtiny45/85

Since a friend introduce me to arduino, i has been my dream to build myself a navigation lights customize to my liking.
He who played with arduino longer than me have come out with an on board navigation lights complete with strobe lights, beacon and even capabilities to switch your lights on and off using your remote control.
I think i am far from that, but i have build myself a simple navigation lights with strobe and beacon and i'm using ATtiny45 for its small size.



Using Arduino UNO R3 for prototyping and ATtiny45 for final product. I use my own ATtiny programming shield to programmed the chip using Arduino UNO.



Base sketch:

  • Fading Sketch
  • Blink Sketch


My NavLite Sketch V0.5


/*
 NavLite V0.5
 Simple Navigation Light
 by kaysee 2013

 Single strobe
 Double strobe
 Fade in Fade out
 Blinking
 */

int ledPin0 = 10; // fade in and out
int ledPin1 = 11; // double strobe
int ledPin2 = 3;  // single strobe
int ledPin3 = 9;  // blinking
int ledState = LOW; // blinking led state

void setup()  {
  pinMode(ledPin3,OUTPUT); // blinking led pin set as output
} //end setup()

void loop()  {  

  // blink led
  digitalWrite(ledPin3, !digitalRead(ledPin3)); 

  // fade in
  for(int fadeValue = 0 ; fadeValue = 255; fadeValue +=5) {
    analogWrite(ledPin0, fadeValue);
    delay(20);                          
  }  

  // single strobe
  for(int fadeValue = 255 ; fadeValue = 0; fadeValue -=50) {
    analogWrite(ledPin2, fadeValue);
    delay(20);
  }
  analogWrite(ledPin2, 0); // reset led2 

  // double strobe
  int i=0;
  while(i < 2) {

   for(int fadeValue = 255 ; fadeValue = 0; fadeValue -=50) {
      analogWrite(ledPin1, fadeValue);
      delay(20);        
    }
    analogWrite(ledPin1,0); // reset led1
    ++i;
  } 

  // blink led
  digitalWrite(ledPin3, !digitalRead(ledPin3)); 

  // fade out
  for(int fadeValue = 255 ; fadeValue = 0; fadeValue -=5) {
    analogWrite(ledPin0, fadeValue);
    delay(20);                          
  }
  analogWrite(ledPin0,0); // reset led0

}//end loop()
Infos on programming the ATtiny with Arduino UNO as an ISP : http://www.instructables.com/id/How-to-program-attiny-using-arduino-uno/

DIY 5v regulator (http://kcrcw.blogspot.com/2013/07/diy-5v-regulator-from-old-esc.html)

DIY circuit using protoboard











While experimenting for my next navigation lights project which include the capability to switch any of the lights on and off, i found out i can get a way just by using a digitalWrite to make the beacon effect.


No comments :

Post a Comment

pls leave your email or other means of contact info.