Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Random Lighting Controller

980 views
3 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Random Lighting Controller
Posted by RR_Mel on Sunday, September 25, 2016 4:51 PM

I just installed my third Arduino Uno random lighting controller and they look terrific!  I have two multi story 1930 era houses with 12 rooms individually controlled each with their own Uno board and six smaller houses with two rooms each doing their thing on the third Uno.
 
I dinked around with the timing and ended up with a long cycle random never ending loop.  The effect is better than I ever expexted.
 
I want the thank Randy for convincing me to go the Arduino Uno route!  For about a $12 investment for a Uno and all of it’s support parts it is the slickest thing on my layout.  They would have only cost about $6 if they were driving LEDs but I use 12 volt 40ma bulbs in my houses running on 9½ volts so I had to use an expansion shield and a pair of ULN2003A ICs to handle the current.  Again another thanks to Randy for that info.  I used sockets for everything which also ran up the cost a bit, all my added parts plugin to sockets.
 
I have three identical Unos like the one below, I’m sure there will be more of them as time goes by.
 

 
I used 1.8mm LEDs also in sockets for monitoring the activity, a 13 conductor flat ribbon cable plugs into the Uno Expansion Shield to connect the house lights.
 
Thanks again Randy!
 
Mel
 
Modeling the early to mid 1950s SP in HO scale since 1951
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
 
  • Member since
    September 2003
  • 10,582 posts
Posted by mlehman on Sunday, September 25, 2016 5:07 PM

Mel,

Have thought about doing some sort of control like this, but cost has been a discouragement. This does seem more affordable and I do just LEDs, so even cheaper.

So one UNO = 12 outputs max or ?

I was just counting the other day...err...night, and I have over 100 lit structures on the layout. Wouldn't want to do all (nor would all need it) but want to do some.

Mike Lehman

Urbana, IL

  • Member since
    January 2009
  • From: Bakersfield, CA 93308
  • 6,526 posts
Posted by RR_Mel on Sunday, September 25, 2016 5:27 PM

The Uno has 12 ports that will drive LEDs direct, each port has a max of 20ma.  I’m currently working on my forth for driving LEDs, the Uno cost $4.10 Free S&H off eBay.  All you need is the LEDs, resistors and a 5 to 12 volt wallwart to get going.  The LED driver I’m working on fully loaded draws less than 600ma at 5 volts.
 
I use switching power supplies for my layout, I bought a 5 volt 5 amp regulated switching power supply for under $10 off eBay.  I also use 12 volt 15 amp power supplies off eBay for about $16.  I really like the switching power supplies, almost no heat!
 
 
Mel
 
Modeling the early to mid 1950s SP in HO scale since 1951
 
My Model Railroad   
 
Bakersfield, California
 
I'm beginning to realize that aging is not for wimps.
  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Sunday, September 25, 2016 6:16 PM

 Couple of going futher ideas - on the Arduinoo site look under the Playground for Shift Registers (also in pretty much any of the "getting started with Arduino" books). A shift register needs 3 pins to control it but has 8 ports - and you can cascade them up to the load limit of the Arduino pin, which would be a huge sting of shift registers. A reasonable number (not near the max) would be say 4 of them. So 3 pins on the Arduino would result in 32 pins of output!

 On Amazon and other places you can find the Arduino Nano. It has pretty much the sme features as the Uno, except they use a micro-USB connector, and to drive mass amounts of LEDs it almost always will need an external power supply, the built in 5V regulator is rather tiny. Thing is - I just bought a 5 pack of them for $20. They look like a wide 28 pin chip, and the pin numbers match those on the Uno, so your same programs can be used, just change the board type to Nano in the IDE. You can then use the shift registers with these as well to expand the total number of outputs.

 I've also been experimenting with standalone Atmel microcontrollers (what's used in most Arduino designs). It was proving too difficult to have one Arduio manage both a CMRI interface AND control servos, so I am offloading the servo function to an ATTiny85, a little 8 pin chip that has 5 or 6 ports. I use 2 pins to get signals from the main Arduino, and 2 to drive a pair of servos. I added a switch that when you press it, it centers both servos to make it easier to install them.

 Once you start playing with this stuff, you'll find more uses. You cna drive lots more than just LEDs - you can control relays, to switch loads greater than the Arduino can handle. You cna drive motors. You can read buttons and act on them - so if you want to have buttons on the fascia to activate various animations so visitors can push the button and see something happen - it's all in there.

                                        --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!