Connect with us

Led circuit

Discussion in 'LEDs and Optoelectronics' started by seejianshin, Sep 20, 2014.

  1. seejianshin

    seejianshin

    4
    0
    Sep 20, 2014
    Hello guys I am new here and I really don't know much about electronics. Anyway I need help on my project here.
    My plan was to build a circuit with 10 LEDs and a bunch of buttons. Every time any button was pressed, one LED goes off, and when all the LEDs are off I could light them all again up by pressing any button. I tried it with logic gates but they only keep the LED off when I press, the LED then pops right on when I let go.
    So here is my question, how do you keep the LEDs off without using any micro-controllers.
    Thanks in advance.
     
  2. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    Hi there and welcome to Electronics Point :)

    You need to specify your requirements more thoroughly.

    1. Do the button need to be treated differently from each other? For example, if a button is pressed that has already been pressed, does that press need to be ignored?

    2. When a button is pressed, do you want the LED that corresponds to that button to turn off? Or do you want the LEDs to always turn off in a fixed order?

    Please answer both of those questions thoroughly. Add any more details that might be important.
     
  3. seejianshin

    seejianshin

    4
    0
    Sep 20, 2014
    Thanks Kris,
    1. Every button is the same, presses can be repeated on any button.
    2. I want the LEDs to go out in a fixed order. (left to right, up down, etc)
     
  4. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    OK, here's a circuit that should do what you want.

    270374.001.GIF

    It's powered from a DC source in the range 5~12V (shown as BT1 in the diagram). It uses three ICs from the CMOS CD4000 series, ten transistors to drive the LEDs, and various capacitors and resistors.

    The design is based around two CD4015 dual 4-bit shift register ICs. A shift register is a logical function made from a string of flip-flops - circuits that can latch and remember a binary state. The output of one flip-flop is fed into the input of the next, and all flip-flops are clocked from a common clock signal. The result is that on every clock pulse, the binary data in the shift register moves (shifts) along by one position (one flip-flop).

    Shift registers are explained in various places on the Internet. Try http://www.google.com/search?q=what is a shift register or http://www.google.com/search?q=how does a shift register work or go to the Wikipedia page at https://en.wikipedia.org/wiki/Shift_register.

    Each CD4015 contains two 4-bit shift registers, named A and B, giving a total of four shift registers in the circuit. The last one, U3B, is not used. The shift registers in the CD4015 are serial-input, parallel-output (SIPO). That means that each flip-flop in the shift register has its output available at a pin. These pins are used to control the LEDs to provide the countdown sequence.

    U1 is a CD4093B quad NAND gate with Schmitt trigger inputs. Each of the four gates (represented by a D-shaped object in the diagram with IC pin numbers on the connections) has two inputs and one output, and drives its output high (to the positive supply rail) unless both of the inputs are high, in which case it drives its output low (the 0V rail). See https://en.wikipedia.org/wiki/NAND_gate and https://en.wikipedia.org/wiki/Schmitt_trigger.

    When the circuit is powered up, CS is initially discharged, so U1 pin 6 is low. This forces U1 pin 4 high and drives the reset inputs of the shift registers high (active). This forces all of the shift register outputs low.

    Transistors Q1~10 are used in "emitter follower" or "common collector" configuration, as buffers to drive the LEDs. They are needed because 4000-series CMOS ICs can only supply a few milliamps, and LEDs are normally operated at at least 10 mA.

    When a shift register output is low, the connected transistor pulls its emitter down to about 0.7V above the 0V rail. This connects the LED and its series resistor across the supply rail, making it illuminate. The brightness of LED1~10 is set by the value of the series resistor (R1~10) with a total applied voltage of about 0.7V less than the supply voltage. See https://www.electronicspoint.com/resources/got-a-question-about-driving-leds.5/ for information on calculating the resistor values. Typically they would be around 470Ω.

    So each LED illuminates when its associated shift register output is low. At startup when the shift registers are all reset, all of their outputs will be low, and all of the LEDs will be ON.

    Any number of pushbuttons can be connected in parallel at the left end of the circuit. When any pushbutton is pressed, U1 pin 2 is pulled low. RB and CB along with the Schmitt trigger characteristic of U1A's input perform a function called debouncing, which eliminates multiple triggering that would otherwise occur due to contact bounce in the pushbuttons. See https://en.wikipedia.org/wiki/Switch#Contact_bounce.

    So U1A produces a clean signal at its output which goes high when one or more pushbuttons are pressed, and returns low on release. This signal feeds the clock inputs of all shift registers. The data input of the first shift register, U2A, is tied high. This means that each time a pushbutton is pressed, a high level is clocked into the shift register chain.So the first time a pushbutton is pressed, U2 pin 5 will go high, turning LED1 OFF.

    The second time a pushbutton is pressed, another high level is clocked into the shift register chain and the high level on pin 5 moves to pin 4, so LED1 remains OFF and LED2 turns OFF as well. Because the three 4-bit shift registers are chained together, this continues along the shift register. Every time a pushbutton is pressed, another LED goes out.

    Once all ten LEDs are OFF, the next press of the pushbutton will cause a high level to propagate to U3 pin 3. It feeds through RR and charges up CR, bringing U1 pin 9 high. U1 pin 10 goes low, and U1 pin 4 goes high, resetting the whole shift register and turning all of the LEDs back ON. Once this happens, U3 pin 3 returns low again, CR discharges through RR, and the circuit is ready to run another countdown.

    RR and CR are used to force a reset pulse that's guaranteed to be long enough to reset all of the shift registers. 4000-series CMOS circuitry is slower than modern logic circuitry, especially at lower supply voltages.

    The three capacitors named CD1, CD2 and CD3 are decoupling capacitors and must be connected as directly as possible between the VDD and VSS pins of their respective ICs. For U1 this is pins 14 and 7, and for U2 and U3 it is pins 16 and 8. These capacitors can be connected directly between the pins on the underside of the board.

    You can build this circuit on breadboard to start with, then you can create a PCB layout if you want, or build it on prototyping board such as stripboard.


    I hope this makes some sense and is enough for you to work from. If not, please let me know.
     
    Fish4Fun likes this.
  5. Fish4Fun

    Fish4Fun So long, and Thanks for all the Fish!

    436
    99
    Aug 27, 2013
    WOW Kris.....that's a lot! I would have just suggested an Arduino....lol....I too frequently decide to solve logic projects with uControllers in the the full knowledge I have bins full of logic ICs simply because I think debugging code is so much faster than debugging breadboards and wiring up a uController is so much easier/faster than wiring up discrete logic ICs....but in < 9 hours you managed to fully solve this project with 3 ICs....nicely done! Not sure I could have written the code that fast!

    Fish
     
    seejianshin likes this.
  6. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,266
    Nov 28, 2011
    I would have suggested a PIC or an AVR. But in his first post, the OP said...
    Thanks. I agree, and I would have used a microcontroller if I was making this myself. But programming is a big step in both senses - "programming" as in learning the architecture and writing the code, and "programming" as in buying and using a device programmer to download the code into the device.

    I've previously gone through the reasons for the choice between discrete logic and devices that need to be programmed. In some cases the required behaviour is just too complicated to make a discrete solution reasonable, but not in this case.

    I hope that once the OP gets this circuit going, he may feel interested and more confident about taking the next step. It depends a lot on the individual.
     
  7. seejianshin

    seejianshin

    4
    0
    Sep 20, 2014
    Thank you so much Kris!!!!!
    Its very complicated but I can see your logic.
    Now its time to buy parts and start building!!!
     
  8. seejianshin

    seejianshin

    4
    0
    Sep 20, 2014
    Actually Fish i had an Arduino and I know how to program one, but i don't like programmable circuit boards and i really don't want to damage my precious Arduino due the condition of the circuit is designed to work in.
    Thanks anyway.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-