.

Welcome to My HO Model Railroad Blog

January 21, 2019 Arduino NANO Tower Beacon Flasher

I have finally come up with a flashing tower beacon driver that looks very realistic.  I'm using an Arduino NANO with a NPN Darlington MPSA13 transistor to drive a 2mm 12 volt Grain of Wheat bulb.  The bulb draws 70ma at 12 volts and as normal I'm running the bulb at about 70% for max realism and longer bulb life.  The MPSA13 has 500ma sinking capacity so it will easily handle the bulb current.

The MPSA13 drops the voltage by .7 volts so I'm actually operating the NANO at 9¼ volts to achieve the 8½ volts to the bulb.

I couldn't find any premade NANO expansion boards so I cut up some 18 x 24 hole perfboards.  I can get three NANO expansion boards from one perfboard.



 
This is a drawing of the Mel NANO expansion board.


Here is a 30 second video of the flashing beacon with my Arduino NANO test socket.  I prewired a Mel test socket with seven 12 volt Grain of Wheat bulbs.  I don't plan on using more than 7 high current outputs from a NANO.


  
Here it is flashing the tower beacon.



The NANO Sketch (Program) is below, a simple copy & Paste to the Arduino IDE should work OK.

==================================================


/*
 Fade

 This example shows how to fade an LED on pin 3
 using the analogWrite() function.

 This example code is in the public domain.

 More info: http://www.ardumotive.com/how-to-fade-an-led-en.html
 */

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 3 to be an output:
  pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop()  {
  // set the brightness of pin 3:
  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);                           
}


==================================================

No comments: