Up front I have almost no experience with this kind of thing. I'm a computer scientist so I understand logic gates and the like but I know near nothing about electricity.

What I want to do is build a device that has 2 buttons and a series of LEDs. When one of the buttons is pushed the leftmost unlit LED should light up and stay lit. When the other is pushed the leftmost lit LED should unlight. So it can be used to manually keep track of a count of something. I'm estimating that I'd have around 10 round LEDs.

I want it to be battery powered, as opposed to wall-powered. I was thinking about using a disposable 9 volt battery as a source. With typical LEDs that use 20 mA a piece, I found that the minimum current that this device would draw is 200 mA.

I've found a few beginner's guide type things that have counters but they're usually not button controlled or don't use lights and I've never seen one that has a button to go backwards.

Originally I thought this would be fairly easy but the more I research the more I'm getting completely lost.

  • \$\begingroup\$ You want a unary counter? \$\endgroup\$ – user86234 Sep 15 '16 at 18:44
  • \$\begingroup\$ Uhm, yeah that would be accurate. I want it to be able to count down as well though. \$\endgroup\$ – Andrew Blank Sep 15 '16 at 18:52
  • \$\begingroup\$ Count down, or reset? \$\endgroup\$ – user86234 Sep 15 '16 at 18:56
  • 1
    \$\begingroup\$ count down. I want one button that turns one more light on and and another that turns one light off. So I can keep track of a number of something going up and down. \$\endgroup\$ – Andrew Blank Sep 15 '16 at 19:18
  • 1
    \$\begingroup\$ What size? Why LEDs and not some other display? How many LEDs? What's the power supply to be (battery?) Pocket portable? Why no micro usage? Is this for a learning experience only? If battery, how long do you expect it to last before replacing the battery? Talk a lot more about things in your question. \$\endgroup\$ – jonk Sep 15 '16 at 19:30

You can build this kind of circuit relatively easily using a bidirectional shift-register like CD54HC299. If you pull DS0 high and DS7 low you can shift high values from left and low vales from right.

Use the buttons to pull either S0 or S1 high to set the shift direction. You can drive the clock-input from both buttons but you may need to delay the clock by a few ms using a RC network.

The chip can drive up to 50mA (for all LEDs) which should be plenty for 8 LED indicators, if you don't mind them being relatively dark.


If you want only one LED to be lit (when the LED moves to the right, the previously lit one is extinguished) that is an up/down counter connected to a decoder. You can find logic chips to make this fairly easily, and power consumption is minimal because only one LED needs to be powered. Or use a micro as below.

If you want all the LEDs to be lit when the far right one is lit, that's called a "thermometer code" and it's not a particularly popular decoding scheme. It's probably most easily done with a micro (either a chip or something like an Arduino), although it could be done with a bunch of logic chips (for example, add a 2-input OR gate on each decoder output but the lowest that is wired to the next lowest OR gate output).

When you go to practically design something like this with logic chips, some of the decoders may be active low rather than active high so you may have to substitute different kinds of gates and/or add inverters to get the logic to work out right. For example, a NAND gate is like an OR gate with both inputs inverted, so an active-low decoder might need an inverter plus a NAND gate on each output.


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.