It's fun, and addictive, isn't it?
If you need to control more LEDs then there are ports, your starter kit probably came with a 74HC695 shift register - there are lessons in the learning material on using them. That lets 3 lines control 8 outputs. There are other more complex chips that can do even better - the code gets more complex as well, but you can control 64 or more individual outputs with just 3 of the Arduino's outputs.
--Randy
Modeling the Reading Railroad in the 1950's
Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.
For the small ones, I just came across this. I don;t have one, so I am only going by the description, but it syas it has the Arduino bootloader in it so it programs from the Arduino IDE just like any other one. It's super tiny, there are 4 usable pins (6 total but 2 are for USB)
http://www.ebay.com/itm/2X-PCS-Digispark-Kickstarter-Attiny85-USB-Development-Board-for-arduino-/191722373418
I did just order other items from this seller so we shall see what sort of quality they offer. But for a small structure or whatever, this teeny little boards might be useful.
Edit: Same seller has them in 5 packs at $13.75 - $2.75 each! Insane.
I'm finding all sorts of neat stuff to mess around with. I need to get working on my workbench design - I have room and an idea for an L shaped table made from a couple of solid core doors, one leg will be for my modeling stuff, the other for electronics, with a computer in the middle - I have some electronic test equipment that can be controlled/monitored from the computer plus the DCC programmers like PR3 and Lokprogrammer.
hon30critterI'm thinking of something like an apartment building or an office building where I want lights in various rooms to turn off and on on their own in a random pattern.
Dave, Mel, Randy—
It has been four months since this thread ran its course and I wondered what circuitry and program you settled on for your random lighting generator.
I'm at a stage where I'll be installing the lighting in several multi-story downtown buildings and I'm interested in jumping into the Arduino pool.
I recieved an All Electronics catalog yesterday showing relay modules that I believe would be needed for my use since I'll probably be driving several dozen LEDs on each output.
I'm just curious about which board you used and if you would do anything different. Did you modify an existing Arduino "sketch" or did you write your own for the random effect?
Thanks, Ed
High ED, good news!
Thanks for that update, Mel!
Like your setup, I planned on having 12 outputs. I wasn't sure what the current was rated on the output that's why I was thinking of the relay board but it may not be necessary.
I have been browsing the tutorials here:
https://www.arduino.cc/en/Guide/HomePage
As inexpensive as these processors are, it is worthwhile to have a dedicated one for each structure.
Thanks again, Ed
I'm glad I caught this thread the second time around, you guys have me wanting to pick this up and start playing.
Thanks!
"The true sign of intelligence is not knowledge but imagination."-Albert Einstein
http://gearedsteam.blogspot.com/
gmpullman As inexpensive as these processors are, it is worthwhile to have a dedicated one for each structure. Thanks again, Ed
ULN2003 drivers, 5 for $4 or less oon ebay - each of the 7 outputs on the ULN2003 can drive up to 500ma, about 2.5 amps total for the chip (so obvious all 7 can't run at 500ma). At 300ma per output, that's at least 30 LEDs at 10ma each. That should be sufficient for darn near anyone's town - 210 LEDs, plus you can use more than one per Arduino since there are more than 7 output pins. And there is a library for accessing the ULN2003 chip already in the Arduino IDE. I'm using one to drive the relays for my Test Track Switcher - though it turns out the relays I bought are such low current I can actually drive them direct from the Arduino pins.
This was the relay module I had in mind, Mel, but as Randy points out, there are better options.
http://www.allelectronics.com/make-a-store/item/rlm-4/4-channel-relay-module/1.html
I can't imagine the micro-relays are all that noisy but they do place a mechanical link into the chain and I surely don't need the 10 amps!
I'll stick with all solid-state.
[edit::] It didn't take long to find a neat 2A solid state relay.
http://www.ebay.com/itm/4-Channel-5V-Solid-State-Relay-2A-For-Arduino-UNO-MEGA-2560-R3-AVR-Raspberry-PI-/171923205134?hash=item28076bec0e:g:RM0AAOSwPhdVKSCd
Thanks Mel, Thanks Randy...
Ed
The ULN2003 isn't specifically a 'stepper motor driver' - they use it as oen in a lot of the starter kits. It's really just a package of 7 Darlington transistors with snubber diodes included (but when driving a relay you really should still add your own snubber diodes and not rely on the chip). So it can be used to turn anything on and off, up to the rated current and voltage (I think it's 40V). 4 of the outputs together can form an H bridge to drive a DC motor with PWM, like a DCC decoder's output stage, or pretty much anything else you can think of. The actual ULN2003 library in the Arduino IDE is probably geared towards using it to drive a stepper motor, for lights or other simple on/off operations you wouldn;t even need a library, just connect say D5 output to one of the UNL2003's inputs and turn it on and off with basic digitalWrite commands.
There are other options as well, all you need is a buffer chip to allow the relatively low power Arduino output pin to drive a larger load. Even a basic transistor circuit would work - examples can be found on many of the relay boards. Much of that stuff is open source hardware so the schematics are freely available, instead of the relay coil and the snubber diode you would connect your LEDs there and that's it. All that transistor is doing is acting as a higher current switch to control teh relay coil since the Arduino can't do so directly. Whether it controls a relay coil or a string of LEDs really makes no difference. There are some technicalities that could affect how this works but experimenting is aprt of the fun and worst case with the transistor driver is you either can;t turn the LEDs off or they won't come on, it wouldnt fry anything. The ULN2003 and similar chips shouldn;t have any issues with this unless you exceed the maximum current
RR_MelAs usual Randy is right on the money with the ULN2003! I checked into them and for $7.54 I have 10 boards on the way.
Excellent! Just the information I was looking for...
Thanks again to you both, Mel and Randy. (and Dave for starting the whole thread!)
Regards, Ed