The building has 10 separate rooms. Want the circuit to turn on LEDS to light each room sequentially. Another words you turn the circuit on, a 555 timer pulses and turns on room one. About 5 seconds later, the clock pulses again and turns on a second room while the 1st stays on. this continues until all 10 rooms are finally lighted. Than they reverse and start to go out one by one. Than the cycle keeps repeating. I want to build this using the CD4000 family.

  • 2
    \$\begingroup\$ It would be easier to use the ATtinyX313 family instead. \$\endgroup\$ – Ignacio Vazquez-Abrams Aug 27 '14 at 0:15
  • 1
    \$\begingroup\$ Does the last one go out first or the first one that went on go out first? \$\endgroup\$ – Spehro Pefhany Aug 27 '14 at 2:28
  • \$\begingroup\$ You want a Johnson Counter (or Inverse Feedback Counter). 10 or more bits. \$\endgroup\$ – Passerby Aug 27 '14 at 22:50

You can achieve exactly that effect using two CD4015 Serial Input, Parallel Out shift registers. Call them IC1 and IC2.

Each chip gives a pair of 4 stage shift registers. You'll only use 3 of the 4 shift registers to make a 12 stage shift register, of which you'll use 11 stages.

Connect all the clock inputs of IC1 and IC2 (pin 1 and 9) together to your 555 clock source. Connect the RESET pins of IC1 and IC2 (pin 6 and 14) together, you might put a NO tactile switch connected to +V with a pull-down resistor on so you can switch all the lights off.

FOR IC1, cascade the fourth output of the first shift register (Pin 2) into the serial input of the next shift register (Pin 7) Connect the fourth output of IC1's second shift register (pin 10) to the serial input of a shift register in IC2 (pin 7)

That makes a 12 stage shift register, enough to control your 10 lights.

Connect the 11th stage of the cascaded shift register (IC2 pin 3) back into the serial input of the entire shift register (IC1 pin 15) via an inverter. Almost anything will do, for example a CD4001 quad NOR gate, IC3. In that case wire the two inputs together (e.g IC3 pin 1 and 2), and connect to (IC2 pin 3) then the output (e.g. IC3 pin 3) goes to IC1 pin 15.

So for the first 10 cycles, the output of the shift register will be 0, that's inverted to 1, and shifted in, switching on one light at a time as the 1's are shifted through the shift register. Then when stage 11 finally gets a 1, it is inverted shifting in a 0, switching the lights off one at a time.

10 light shift register schematic

You could keep all the lights on for longer, or some rooms for longer by connecting up all 4 of the 4-stage shift registers and only using some of the outputs. It might make the lighting look a bit less mechanical.

The exercise of driving the lights is left as an exercise for you :-)

If you are willing to move away from CD4000, and would like to simplify driving the LEDs, consider LED driver chips. They are shift registers, so exactly the same strategy works of cascading them end-to-end and feeding back signals to the input.

However, they are designed to drive LEDs. For example TI TLC5916 can sink 120mA on each 'output', enough for more than 10 LEDs per pin. It is a 'constant current source', and the brightness of all 8 groups of LEDs can be set with one resistor. Each group will get the same current. The chip does need a 5V supply. However LEDs can be powered from a supply upto 20V so LEDs can be strung in groups serially to make better use of power (so 12V might be convenient).

Many manufacturers make similar parts.

Having said all that, I would use a microcontroller. Clone Arduino Nano's are very low-cost, comparable to the cost of these chips. Further, you'd have the fun of programming lots of different lighting patterns.

Off topic a bit:
If you are interested in learning about microcontrollers, I strongly recommend Arduino. There is a lot of help and information, and a very active community. You could buy a 'proper' kits for over $50, but you could do some experiments for $10 which would probably do much of your building.

I'd suggest you get an Arduino Nano which includes USB and not an UNO or a mini (under $5). That is enugh to get started programming blinking one LED. The Arduino Nano is likely small enough to fit inside something on a model train layout. The UNO is much bigger, but has no extra functionality. The Nano has USB programming which is very convenient, and the Mini has not, which is not convenient.

To make experiments easy get a breadboard ($1.50), LEDs ($1 for 10), 1K resistors ($1 for 50).

If you want to drive groups of LEDs (i.e. more than 3 per room) get some transistors, or an ULN2803 octal (8-way) Darlington transistors in a Dual-in-Line package (about $1). Or use something like the TLC5916

The programming software (IDE) is Open Source (free). It comes with about 80 example programs, with lots more and lots of tutorials at the web site. There are Open Source books too.

Do the Blink program (exercise 1). Then generalise with more LEDs. Look at the 'random' function to get more realistic delays to drive interesting patterns.

Look at programs and wiring to "multiplex" LEDs, and in cahoots with a ULN2803, you could have 80 independent light groups. If you went a bit further you could cascade something like the TLC5916, and be only limited by your patience, power supply and money.

If you get a bit stuck, look at the Arduino community, or come back here, or join the arduino.stackexchange (currently Beta).

Another suggestion:
If you want a lot of lights, then look at Texas Instruments "LED Driver" chips in the Signage/Linear section. AFAIK, Maxim produce similar products.

There are alternatives to Arduino, for example I have used mbed, which has a 'cloud-based' software development system (you don't install any software, instead you use a web browser). It is comparable to an Arduino Due, but much cheaper and has many alternatives which suit different types of problem. Another is LeafLabs Maple which is similar to the Arduino software, but not as polished. It is comparable to an Arduino Due. Several of its community, including myself, have developed several improved Open Source designs, which have been built around the world.

I have lead workshops for many hundreds of people, age 6 to over 80, to use Arduino. It has a very good blend of strengths: easy to get started, powerful enough to do interesting projects, widely available at low-cost, not a closed 'toy', and a large, active, helpful community.

  • \$\begingroup\$ And AVRs can drive the LEDs directly, instead of needing separate drivers as CD4k would. \$\endgroup\$ – Ignacio Vazquez-Abrams Aug 27 '14 at 2:52
  • \$\begingroup\$ @IgnacioVazquez-Abrams - Yup! I strongly agree. Ready-made Arduino Nano's are so cheap from 'sales websites' that it may be cheaper than discrete logic+drivers. That is how I would do it. However, 'real' logic is fun !-) \$\endgroup\$ – gbulmer Aug 27 '14 at 10:31
  • \$\begingroup\$ Absolutely amazing, I can not thank you enough for all the time you spent on this. Actually the rooms are big and have as many as 6 LEDs each, and the building has 40 rooms total but I am capable enough of cascading your circuit out. I particularly like your idea of adding registers to make it look less mechanical. I have real full of 3905 Q's so I am planning on using them to drive series/parallel White LEDs. The building actually has about 200 LEDS Total so far.. Should keep me busy for awhile and Thanks so much again. \$\endgroup\$ – Wdasilva76 Aug 27 '14 at 20:49
  • \$\begingroup\$ One last question, do you know of any micro controller Eval/Learning kits? \$\endgroup\$ – Wdasilva76 Aug 27 '14 at 20:59
  • \$\begingroup\$ @Wdasilva76: store.atmel.com/CBC.aspx?q=c:100114 estore.ti.com/Starter-Kits-C32.aspx microchipdirect.com/… And those are just the vendor ones. There are lots and lots of third-party dev boards, especially for AVR and PIC. \$\endgroup\$ – Ignacio Vazquez-Abrams Aug 28 '14 at 5:32

This sounds like a job for a CD4017 and a bunch of or gates. (you have to provide the clock.) I used a 4017 in a circuit, fairly recently.

Re-reading I'm not sure about the going out part.... more parts or learn a uC. (Arduino is good because it's easy.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.