Electronic – LED color changing circuit using power cycle

ledmodel-railroadpower

I'm trying to design an LED circuit for a model that will allow me to change the color of a bi-color LED each time the power is cycled. In other words:

  • Power off: Nothing
  • Power on: Green
  • Power off: Nothing
  • Power on: Red
  • Power off: Nothing
  • Power on: Nothing
  • Power off: Nothing
  • Power on: Green, etc. etc.

Or, if the green/red/off/green… cannot work, can I do a green/red/green/red… instead. I'm NOT looking for flashing, but a steady light that only changes color when the power is cycled (off-on). No components have been purchased, but would like to do this with 3mm or smaller two-color LEDs. My skill level is beginner/intermediate, so the simpler the better. And of course, if I'm barking up the wrong tree, let me know.

Best Answer

I noticed the "model-railroad" tag, and this question takes me back to the trains of my childhood. That feature was present, and of course it was done by a mechanical rotating switch, and you would interrupt power momentarily in order to activate it.

You could do the same thing using a microprocessor. You can get them with on-board EEPROM in which you can save a counter value. This count will dictate which light pattern to run. You would want to provide enough power storage (capacitors) to let it complete the EEPROM write. Also enough to keep it from switching to the next pattern if there are glitches (of which there are plenty when power is taken off the track using the wheels).

The rest is straightforward microprocessor work, but of course it's not trivial if you've never worked with them before. The chip I looked at costs a dollar, looks just like a 555, and if you only need 2 LED's and can run them at 10mA each, add a resistor for each one and you wouldn't even need any transistors to drive them. Then the rest, as they say, is a "small matter of programming".