Looking for insight on a personal project...using shift register to switch LEDs. - Page 1
Forum section: electronics / projects

author: PLCrona32
author_rank: Newbie
timestamp: February 02, 2022, 09:28:11 am
content: My goal is actually simple. I am trying to design a turn signal for my ebike that does the same as those cars that have chasing LED lighting that incrementally lights all LEDs one after the other and then resets to no LEDs enabled starting the sequence over to give the effect of directionality.I am just wondering if anyone can look over this and see what I should adjust. If you need any more information, PLEASE let me know.

author: Ian.M
author_rank: Super Contributor
timestamp: February 02, 2022, 10:19:22 am
content: Frankly, it looks like an over-complex and badly designed mess. Assuming the mostly obscured part number of U68 is NPIC6C596A, it cant even light a single LED! At best, if modified to actually work, I suspect it will run rather hot, which may be problematic considering it will probably be difficult to provide adequate heatsinking while still maintaining adequate protection from wet weather.What are the specs on the LEDs you want to use? Part no. and datasheet would be helpful.

author: PLCrona32
author_rank: Newbie
timestamp: February 02, 2022, 10:49:53 am
content: Sorry for the mess.The LEDs I had intended to use are here:https://www.digikey.com/en/products/detail/osram-opto-semiconductors-inc/LCY-CEUP-6L6M-5F5G-8E8G-700-R18-Z/9999343Yes, these LEDs are high current. I am somewhat familiar with the intensity, but I am wanting it to be bright enough for daytime use. I have different ones that I have tested and these were the ones I decided to go with. I was considering cutting the intensity down to maybe 75% or less, if it is bright enough and use it at that load level to keep it from being too current hungry.The first shift register that I had intended to use was the 74AHC595. I figured that the NPIC6C596A would be able to handle the current a bit better. So, I am using the first set of BJTs (BJTs are the MMSS8050-H-TP model), directly linked to the shift register, as a way to offset the higher current that would be needed to drive the LEDs with the second set of BJTs.This was a literal shot in the dark for me...I am a noob...please be gentle...

author: PLCrona32
author_rank: Newbie
timestamp: February 02, 2022, 11:10:51 am
content: I will add, the second set of LEDs can be removed if the current would be to high. The idea is that the LEDs would be in two "string" on opposing sides of the board, essentially creating two lines that start parallel and then taper to a "point" with the last two LEDs of each "string". I don't mind using two separate shift registers to spread the current either, as I had intended to do that in the first place. If I do two separate shift registers I figured I could just use the same Timer IC to keep them in sync with one another.

author: Ian.M
author_rank: Super Contributor
timestamp: February 02, 2022, 12:17:31 pm
content: So, your LCY CEUP-6L6M-5F5G-8E8G-700-R18-Z LEDs are specced for between 50mA and 1A If, and other specs are given at 700mA, including a typical Vf of 3.15V. Approx 3/4 of the electrical power will be dissipated as heat, so thermal management is likely to be a concern.You appear to be intending to run the LEDs at approx 230mA If (from your circuit configuration and the 33 ohm series resistors). If that is not your intention, please tell us your intended If.The NPIC6C596A has open drain outputs so cant source current to drive your NPN transistors bases, and you haven't included any pullups to provide the base current, hence my comment "... it cant even light a single LED!"One easy energy saving optimization would be to connect the LEDs in series pairs, which would immediately save nearly half the total power used.However to come up with a workable design, we need to know the limits of the supply voltage range. As its a battery powered ebike, it seems unlikely that the nominal 12V supply will actually be 12V most of the time, (unless of course it comes from a buck converter running from a 4S or higher battery pack). Specs for the battery pack may be sufficient to determine the voltage range.

author: PLCrona32
author_rank: Newbie
timestamp: February 02, 2022, 12:42:10 pm
content: "You appear to be intending to run the LEDs at approx 230mA If (from your circuit configuration and the 33 ohm series resistors). If that is not your intention, please tell us your intended If."Thank you for pointing this out. My intended If is somewhere around 450-550mA for each LED. I just noticed that I did not set it up the way I had intended as I had intended to have two 33Ohm resistors for each LED."One easy energy saving optimization would be to connect the LEDs in series pairs, which would immediately save nearly half the total power used."Will definitely be the something I do to help with the power use. Thank you."However to come up with a workable design, we need to know the limits of the supply voltage range. As its a battery powered ebike, it seems unlikely that the nominal 12V supply will actually be 12V most of the time, (unless of course it comes from a buck converter running from a 4S or higher battery pack). Specs for the battery pack may be sufficient to determine the voltage range."The ebike batteries are 14s 5p 52V battery packs and I use 2 in parallel, so I know it can source the current AND the voltage. I use a 80V to 12V buck regulation module for my other lighting, but I do not think the current rating for it is high enough to run this set up. I may get a beefier one if the current of the circuit is too much, but I am hoping that I can figure this out and drop the power usage, so as not to have to get a different module.

author: PLCrona32
author_rank: Newbie
timestamp: February 02, 2022, 12:54:51 pm
content: "The NPIC6C596A has open drain outputs so cant source current to drive your NPN transistors bases, and you haven't included any pullups to provide the base current, hence my comment "... it cant even light a single LED!" "Please, don't be mad at me.... I am an idiot....the pullup resistors would go from the base of the transistors to the 5V power rail...? If so, I would need one for each transistor right, not just the ones directly connected (through the 2.2K resistors) to NPIC6C596A?Edit: So, just realized. I am thinking you only meant for the transistors that are driving the bases of secondary set, since the secondary set of transistors would be driven by the first set directly...

author: Ian.M
author_rank: Super Contributor
timestamp: February 02, 2022, 01:38:13 pm
content: If you were sticking with the NPIC6C596A and the rest of your circuit (not what I would do), the pullups would go to the +12V rail. If you used 5V, you'd get max. 3.5V at the + end of the resistors in series with the LEDs, so couldn't put the LEDs in series, and if you lowered the series resistance enough to get the desired LED current, the transistors would cook themselves to death, dropping over 8V!The supply voltage is reasonably stable, which makes life easier. If you are going to need to add another buck module anyway, you can optimize the output voltage for maximum efficiency, allowing just enough headroom for a constant current LED driver circuit for each series string of LEDs. For two in series, somewhere around 8V-9V is probably good. For four in series, you'd want about 15V-16V. For ease of control the LED drivers should switch the ground to each LED string, not the supply.OTOH for simplicity and efficiency it may be worth using dedicated constant current LED drivers that can buck direct from your main battery voltage, e.g.LM3414HVwhich can run at over 60V Vin, and in addition to the external buck inductor and catch diode, only needs a decoupling cap and two small resistors to set the LED current and switching frequency. Drive its DIM pin with your LED control logic signal.As far as the rest of the circuit goes, I'd probably ditch all the logic and use a MCU. Even the humble Arduino Nano could do the job as its got 18 I/O pins in addition to the two UART RX and TX pins used to communicate with the programming PC, so could easily handle outputting two independent sets of 8 channel LED control signals, controlled by two switch inputs for left and right turn.

author: PKTKS
author_rank: Super Contributor
timestamp: February 02, 2022, 01:38:28 pm
content: Before you commit to that ...Just take a deep look over the LM39xx chips...Paul

author: Ian.M
author_rank: Super Contributor
timestamp: February 02, 2022, 01:45:17 pm
content: Quote from: PKTKS on February 02, 2022, 01:38:28 pmThe fly in the ointment is the need to boost the LM39xx output current by over an order of magnitude. Of course it could be simply used as a logic level LED bar controller, but by the time you've added individual constant current drivers for the LEDs, and an analog ramp generator, there's little if any saving in circuit complexity.

author: PLCrona32
author_rank: Newbie
timestamp: February 02, 2022, 02:42:31 pm
content: Quote from: PKTKS on February 02, 2022, 01:38:28 pm

author: free_electron
author_rank: Super Contributor
timestamp: February 02, 2022, 02:49:05 pm
content: i would do this differently.take an 8 bit shift register.input is tied to logic 1 , output drives transistors that switch the led's.first timer drives clock of the shift register. the shift register will keep filling with '1' on every clock pulse. so the speed of the timer controls how fast the leds light up. it doesn't matter that you keep clocking in '1' when it is already full..if you want more led's : cascade the shift registers ( drive from same clock , input of second register comes from output of last register.a second timer drives the reset pin. this one has to be much slower than the first. it periodically clears all led's if you have 20 leds this timer needs to run 1/20 (or slower) than the first one.you can take a 74hc595,13 oe low14 ser high11 srclk driven from the first timer (shift timer)inverter from 11 to 12 ( so they alternate shift - latch shift latch shift latch .... )pin 10 is the 'reset' so you drive that from the slow timer ( blink timer )HANG ON ...look at image below

author: free_electron
author_rank: Super Contributor
timestamp: February 02, 2022, 02:53:33 pm
content: i have shown two shift register.you can tie clk and latch together without problems on this one. it will shift.the top inverter makes the led clock. that makes the leds turn on one by onethe bottom inverter is the slow clock. this one periodically clears the shift register turning all leds off.the enable signal turns the mosfet off letting the oscillator run. if the oscillator is off its output is 0 so the registers are reset and the leds are off.

author: themadhippy
author_rank: Super Contributor
timestamp: February 02, 2022, 03:06:12 pm
content: Quoteso would I.555 , 4017 some diodes and a transistor or 8

author: PLCrona32
author_rank: Newbie
timestamp: February 02, 2022, 03:18:23 pm
content: Thank you. I actually considered the 74AHC595, it was the first one I thought of using. Just did not know how I would drive the LEDs, without blowing the IC. Now that I learned a bit from this thread, I am thinking I could still use it, I would just need to source the current like I intended to do with this setup (ie. directly from power supply through transistors that can be turned on or off with the shift register IC). I may do what Ian.M is suggesting and just drive the LEDs with the LM3414HV for each series LED set and use the shift register to operate each driver directly for controlling the on/off state.

author: PLCrona32
author_rank: Newbie
timestamp: February 02, 2022, 03:20:43 pm
content: Thank you. I think it would be better to go with driving it directly from the battery with the LM3414HV. If I am reading the data sheet correctly, I would only need one per LED series(going with the two in series instead of the four, probably going to do a separate circuit for the opposing set needed then clock them with the same timer IC). That being said, the shift register would not need to be changed would it? I would assume, to get the desired lighting effect of having each LED (series of two LEDs) turn on one after the other and then reset, I would still need the shift register, correct? (unless I use an Arduino of course, I would rather make this a simple on or off design to use the turn signal switch I am using, so not sure I want to go that path yet...but that is subject to change of course as I figure out what is and is not possible with my idea)

author: PKTKS
author_rank: Super Contributor
timestamp: February 02, 2022, 03:41:31 pm
content: Quote from: Ian.M on February 02, 2022, 01:45:17 pmThere are several types of LED bars... but quite a few would sunk more than 30ma (rated LM39xx capacity) per LED ... in which they are already current controlled ... by a single setup ..Those ICs are a workhorse for those LED bars...Just in case you need to put a LED with more than 30mA adding a single transistor per LED is still easier... than the other alternative..And the drive wave can also be a made by a 555 RC slow charge .. almost ramped..simple and cheaper..Paul

author: Siwastaja
author_rank: Super Contributor
timestamp: February 02, 2022, 03:44:29 pm
content: 74HC595 can simply drive N MOSFETs on ground side, powering the LEDs. In such case, you don't have constant current regulation but you don't need it, just spend high enough percentage of supply voltage in series resistors and current regulation is good enough (classic series resistor LED circuit, R = Vf / I).Efficiency sucks but this is just an indicator which isn't supposed to be on all the time. Besides, linear constant current circuit isn't much better efficiency-wise, if at all, depending on the ability to put more LEDs in series or not.

author: Peabody
author_rank: Super Contributor
timestamp: February 02, 2022, 03:46:33 pm
content: QuoteThe 4017 would let you light one LED at a time, but not cumulatively. That would save a bunch on power, but might not produce a satisfactory visual effect.Quote from: free_electron on February 02, 2022, 02:53:33 pmWith either the 4017 or the 595, the last Qn output could be fed back the /RST pin, but would need to inverted. However, I think the CD4015 has an active-high reset, so a "1" reaching Q7 would do a reset.

author: free_electron
author_rank: Super Contributor
timestamp: February 02, 2022, 04:11:55 pm
content: Quote from: Peabody on February 02, 2022, 03:46:33 pmit depends on what pattern you wanti was going for1000000011000000111000001111000011111000111111001111111011111111111111111111111110000000110000001110000011110000111110001111110011111110111111111111111111111111basically filling the pipe until they are all on. then wait , then a restartyou could also toggle the din pin. so it would shift through.of course i did not show a led driver. the 595 outputs need to drive leds.you can make a simple current limited led driver using a bipolar transistor and resistor.The schematic below shows how. i use a simple double diode ( series in sot23 package) to make a voltage reference. when the transistor is "on" the current through the resistor in its emitter will create a voltage drop. if the voltage across that resistor approaches 0.7 volt the transistor will start turning off.it's not very efficient and the transistor dissipates power with only one led.so you are better off put the leds in series. the closer you can get the working voltage of the led chain to the supply voltage, the lower the dissipation in the transistor.

author: themadhippy
author_rank: Super Contributor
timestamp: February 02, 2022, 04:42:43 pm
content: Quotehence why i said "some diodes" to get the build effect

author: Ian.M
author_rank: Super Contributor
timestamp: February 02, 2022, 05:26:30 pm
content: Another approach avoiding the mess of diodes, and considerably improving efficiency and reducing the cost would be to use something like aLM3402HVhigh side constant current buck LED driver, to drive as many LEDs in a string as the minimum supply voltage supports + N-MOSFETs to short out various portions of the LED string to get the bar effect. All the MOSFET sources would go to the top end of its current sense resistor which only has a few hundred mV across it, and their gates could simply be driven direct from a CD4017. Unfortunately the O.P.'s 14S battery pack, fully discharged to 3V/cell wouldn't quite have enough voltage to drive a 14 LED string, so 8 two LED segments in the bar isn't possible and 7 segments would be marginal. If 6 segments is sufficient for the desired visual effect you are golden, otherwise you'd need to duplicate the driver and shorting MOSFETs so each could drive one of the two LEDs in each segment organised in two series strings