Need help designing a load selector! - Page 1
Forum section: electronics / projects

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 29, 2020, 05:58:08 pm
content: So, I’m stuck. I’m trying to control LEDs using a decade counter that drives some transistors, but I just can’t seem to get it right. I need help!What I’m trying to accomplish is a circuit that controls a set of LEDs in such a way that if you press a button, the counter would trigger the next output and illuminate the next LED in the sequence (of course through a transistor, since the chips themselves can’t directly drive heavier loads more than about 10mA). Here is the sequence I am going for:Red, Green, Blue, RGB, Off.Im using the transformer of a small digital alarm clock, and since I want to run both the clock and the LED circuit on one transformer, I need to keep the power consumption of the LED driver circuit as low as possible.My theoretical idea was that by using a resettable decade counter, I could have one input and several outputs, which the counter would progress to the next output in the sequence when I pressed the button. I would use the secondary counter, controlled by the final output, to reset the counter and turn all LEDs off until the button is pressed again.“You stupid fool, use a Raspberry Pi or an Arduino!” Well I would but I do not have one. Besides, I’d like to get more into logic circuits and the raw functionality of them.I don’t have schematics that are useable. The two failed attempts to draw a schematic had the logic improperly wired, it wouldn’t work as I expected it to when I breadboarded the circuits.The logic chips I have in my inventory that I could use are:Ne555 (x2)74LS74ACD4094BEMC14520 (that’s the decade counter I tried to use)SN74196N (x2, and those are also decade counters)74LS157NMC14013BHEF4053BPSN74LS123NI appreciate your help.

author: MarkF
author_rank: Super Contributor
timestamp: May 29, 2020, 07:32:39 pm
content: Okay. I'll take a wack at it.Without any logic gates, you will need to press the switch 5 times to get it started.And there may be an "All Off" state before it starts over?

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 29, 2020, 07:47:07 pm
content: Quote from: MarkF on May 29, 2020, 07:32:39 pmLet me build this circuit and see if it works.And yes, I’m hoping that it has an “all off” before the cycle repeats.Also, I have an additional output for the colour-changing RGB LEDs, you probably didn’t notice that listed. I listed it as RGB.

author: MarkF
author_rank: Super Contributor
timestamp: May 29, 2020, 07:49:42 pm
content: If you use the SN74196 counter "Load" feature to preset the value to '4' would getit to start up with the Red LED being ON.Use an RC time constant on the LOAD pin at power ON to do the preset.

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 29, 2020, 07:53:35 pm
content: I’m assuming that it would be wired differently too?

author: MarkF
author_rank: Super Contributor
timestamp: May 29, 2020, 08:25:22 pm
content: Round #2:I'm not very familiar with the RGB LEDs.Edit: Switch protection

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 29, 2020, 08:30:47 pm
content: Quote from: MarkF on May 29, 2020, 08:25:22 pmBreadboarded the first circuit, and nothing. I get what it’s theoretically trying to do, but it just didn’t work.The RGB LEDs im using are like regular LEDs, these just have integrated circuitry that drives the colour changing effect with the internal diodes. It has the same anode and cathode as regular LEDs.All right, going to bb Round 2.

author: MarkF
author_rank: Super Contributor
timestamp: May 29, 2020, 08:59:10 pm
content: Round #3:I don't think the logic around the Flip-Flop is correct.It's always going to preset 'Q' high.You might try playing around using the clock, Q and Q' to get a single high pulse to start.You really need a couple logic gates: Inverter, NAND, etc. to form the high for one clock.

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 29, 2020, 09:12:11 pm
content: Hmmm...I don’t have any inverters or NAND gates lying around. I do have some transistors, maybe a PNP transistor that’s negatively biased could serve as an inverter?

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 29, 2020, 09:30:51 pm
content: Wait a sec! Hol up. What if we could omit the BDC completely? Here’s my thought: Use the bit shift register itself. Pressing the button sends a clock pulse, causing the output to shift to the next bit in the sequence. We just need some way for the register to get the initial data pulse we need, and let it be able to send the pulse again after the bit reaches a certain point.

author: MarkF
author_rank: Super Contributor
timestamp: May 29, 2020, 09:51:22 pm
content: Quote from: WyverntekGameRepairs on May 29, 2020, 09:30:51 pmBingo! You have the idea and my two failed attempts at it to get the initial bit for just one button press.Here's my last attempt if this counts to five. It is a decade counter after all (÷2 and ÷5).,Hopefully, it counts: 0, 1, 2, 3, 4, 0, etc and we can use the '4' to start another 'high' through the shift register.Timing:

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 29, 2020, 09:59:30 pm
content: Whoooo! Here we go, bbing this one now... wish me luck.

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 29, 2020, 10:17:04 pm
content: Aaaaand unfortunately nothing.I am thinking that my resistors aren’t a good rating. I’m also using 6v regulated, but a single volt shouldn’t do any harm as these are rated from -0.5V to +18V according to the data sheet.I have the LED’s resistors at a value of 4.7k. What do you suggest for the resistors on the switch?

author: MarkF
author_rank: Super Contributor
timestamp: May 29, 2020, 10:33:31 pm
content: The SN74196 can ONLY handle 5V. Check the datasheet: It may go to 5.5V max.You have a mixture of CMOS and TTL logic listed.Your resistors are far to big.R = V / IR = (5 - 1.5) / 20mA = 175ΩLet's start with 200Ω. Each LED color will have a different Vfso you will need to tweak each to get the intensity to match. The RGB LED may NOT need a resistor (check its datasheet).Connect each LED to 5V through 200Ω to test each before connecting them to the circuit.

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 29, 2020, 10:53:18 pm
content: WAIT WAIT WAITI found a 74LS00 and 74LS20N - NAND gates!!Maybe this will make things easier? Unless this works, that is, in which case we won’t need these. But if it doesn’t work, we now have some NAND gates we can use.

author: MarkF
author_rank: Super Contributor
timestamp: May 29, 2020, 11:16:50 pm
content: One of your counter chips will give you 4 bit binary count.You can use the NAND gate(s) to create the 'Data' input to the shift register.Refer to the timing diagram I added a few posts back.

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 29, 2020, 11:42:06 pm
content: All right. So what is the schematic looking like now?

author: MarkF
author_rank: Super Contributor
timestamp: May 29, 2020, 11:53:38 pm
content: Maybe some partial testing is needed here.Take the last circuit posted and remove the SN74196 decade counter.Testing the CD4094 and LEDs:Then manually clock in all 1's followed by all 0's and verify the shift register and LEDs are working.- Tie 'Data' pin (2) high.- Press the switch five times. (all LEDs should turn 'On' one at a time)- Tie 'Data' pin (2) low.- Press the switch five more times. (all LEDs should turn 'Off' one at a time)Then, you can figure out the logic to generate the 'Data' input signal.

author: MarkF
author_rank: Super Contributor
timestamp: May 30, 2020, 12:02:41 am
content: I found an error:TheOutput Enable (pin 15)and Stobe (pin 1) both need to be 'High'.I have the wrong chip on the drawing.

author: MarkF
author_rank: Super Contributor
timestamp: May 30, 2020, 01:05:59 am
content: It appears that I miss-read you original post several times....You never ask to have ALL LEDs On at one time. Just sequence through and one all Off state.I think I fixed the startup initialization. The RC time constant may be too short for the LOAD pin.

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 30, 2020, 01:27:51 am
content: Quote from: MarkF on May 30, 2020, 01:05:59 amYou also kinda messed that up. I don’t recall the 74196n being a 20 pin chip... lolEdit: You also have a pin 18 and 16 on the ic. The chip isn’t 20 pin, it’s 14 pin.

author: MarkF
author_rank: Super Contributor
timestamp: May 30, 2020, 02:07:55 am
content: Schematic updated.I picked the wrong component out of the library.

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: May 30, 2020, 05:57:17 pm
content: I just had a thought. What if we used an AND gate (I’ve ordered some) on Q12 of the multivibrator? Connecting that output to the AND A1 and the button to the AND A2 could allow a pulse to be sent after the 1 bit reaches the end of the chain.That just leaves us with the startup triggering. It is possible that a 555 timer could be used to make a one-trigger latch. Something that, when the system turns on, triggers the timer - but when the button is pressed and the data pin no longer needs to be held HIGH, the timer deactivates until the power to it is completely removed.

author: MarkF
author_rank: Super Contributor
timestamp: May 31, 2020, 07:34:10 pm
content: I did a little checking of theCD4094Bdatasheet.It appears it can only source -1mA of current (not enough for LEDs).Disconnect the LEDs, then check the outputs with a Multimeter to verify the circuit.A popular shift register used to extend Arduino outputs is theSN74HC595.It would be able to drive the LEDs.The RGB LED may be a special case. I don't know what its current requirements are.

author: MarkF
author_rank: Super Contributor
timestamp: May 31, 2020, 07:39:46 pm
content: Another option to drive the LEDs is theULN2003Bdarlington transistor array.

author: rdl
author_rank: Super Contributor
timestamp: June 01, 2020, 03:41:36 am
content: Quote from: WyverntekGameRepairs on May 29, 2020, 08:30:47 pmI think this is the problem. You need a standard RGB LED that has individual leads for each color and one common.

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: June 01, 2020, 05:56:37 pm
content: Quote from: rdl on June 01, 2020, 03:41:36 amBad idea. I don’t have the circuitry to drive a standard RGB LED in such a way that it fades from colour to colour softly. I could use capacitors and a logic array to drive the register, but that would take more power. I’m trying to keep this as low power as possible.Quote from: MarkF on May 31, 2020, 07:39:46 pmThat could definitely work! I do happen to have a couple laying around.

author: rdl
author_rank: Super Contributor
timestamp: June 02, 2020, 12:12:08 am
content: Quote from: WyverntekGameRepairs on June 01, 2020, 05:56:37 pmIt's not an "idea".I sounds as if your LEDs are "attention grabber" type with only two leads, a power and ground connection (anode/cathode), which go through a preset color-changing/fading/blinking/whatever sequence when power is applied. If that is the case, you will never be able to do what you want. The only control you have over what they do is turning them on and off.

author: MarkF
author_rank: Super Contributor
timestamp: June 02, 2020, 01:30:45 am
content: Pretty lights:https://youtu.be/X4d-Nk955JE?t=887Quote from: rdl on June 02, 2020, 12:12:08 amTurning them On and Off is ALL he wants to do.

author: rdl
author_rank: Super Contributor
timestamp: June 02, 2020, 02:02:35 am
content: No.He said "Here is the sequence I am going for: Red, Green, Blue, RGB, Off."If the LEDs he has are what I think, that can't be done. However, some clarification as to what he is actually using would help.QuoteSomething similar to this is what it sounds like he has.

author: MarkF
author_rank: Super Contributor
timestamp: June 02, 2020, 02:44:23 am
content: Quote from: rdl on June 02, 2020, 02:02:35 amYes."Here is the sequence I am going for:"Only when he pushes the button!There are three jellybean LEDs (red, green and blue) and one color fading RGB LED.The sequence is to switch to a different LED. Not to change the LED's color.QuoteHe only has one of these. What he is calling the RGB LED.Again, the other three LEDs are standard red, green and blue ones.

author: rdl
author_rank: Super Contributor
timestamp: June 02, 2020, 03:14:23 am
content: Ah, okay. I think the lack of any kind of diagram or schematic in the first post threw me off. I never saw anything but RGB mentioned. Too bad he has no 4017 in stock, would be basically a one chip solution.

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: June 02, 2020, 03:18:49 pm
content: Ran into an issue as well that I have fixed. Noise was getting bad on the clock input, causing erroneous signal to the chip, even if I just put my hand close to the floating lead connected to the pin. I coupled the pin to ground using a 6.3v, 10uF tantalum capacitor, and a discharge resistor connected to ground. The positive of the capacitor is connected to the pin and resistor, while the negative is grounded. Simple ESI filter.Turns out I don’t have the Darlington arrays like I thought, but instead just some LM3046N transistor arrays. Those could have leakage and isolation issues so I’m doubting their use. So for now I’m using simple emitter-biased 2n2222A NPN transistors to drive the LEDs.Quote from: MarkF on June 02, 2020, 02:44:23 amI have decided to use standard 4-pin common cathode RGB LEDs for this project because they take less space than three standard LEDs. However, for the colour changing RGB LED, I have to use a separate LED with integrated circuitry. In the prototype, I’m using four separate LEDs representing each colour for now just as placeholders. When it comes down to the actual PCB assembly, I will be using the more compact convex RGB LEDs.Clarifying: The FINAL PRODUCT will have a few pairs of LEDs: Each pair has one STANDARD RGB LED, and one COLOUR CHANGING RGB LED. When I press a button, it will turn on or off certain LEDs in a sequence. That sequence is red, green, blue, colour changing RGB, and off.The reason I don’t just make a circuit to make the standard RGB LED change colours is because that takes more power. If I didn’t have any power constraints, I would omit the integrated colour-changing LED and just use the one standard RGB LED and just build a circuit to make it change colours when the RGB setting is on.

author: WyverntekGameRepairs
author_rank: Regular Contributor
timestamp: June 08, 2020, 04:08:38 pm
content: UPDATE:Here’s what I’ve come up with.Logic:U102 is acting as a NOT gate by pulling one input HIGH. If any output attached to the gate is HIGH, the output of U102 is LOW. The output of U102 goes into U103, which is connected to Q6 on U101. This AND gate provides redundancy. If U102 senses that all other outputs are LOW, U103 tests that Q6 is HIGH, indicating that the sequence is ready to be restarted. The output of U103 is fed into Q105’s base, which turns the transistor on and pulls DATA HIGH. As soon as the bits shift and Q1 activates, the gate logic sends a LOW signal to the transistor and turns off, pulling DATA to LOW.Protection:To protect against ESI (electrostatic interference), I have included a network of capacitors and Parallel RC circuits to smooth out the data inputs and outputs. C101 is a secondary filter capacitor to filter any remaining ripples from the power supply. C102-108 are coupling capacitors, coupling data outputs to ground. This reduces any small external voltages that occur in the environment (I.e. emi, ESI, parasitic capacitances, data line interference, RFI... etc). D101-105 are used to prevent unintended cross-line feedback. C109 is a snubber that absorbs initial current spikes that occur in the push button. C112 and C113 are also coupling capacitors to prevent erroneous voltages on the outputs of the logic gates. R109 & C110 and R110 & C111 are parallel RC ESI filters to smooth out any erroneous voltage from the inputs. The resistors also double as pull-down resistors to pull the pins LOW.