Sequential Turn/LED Troubles

AnalogKid

Joined Aug 1, 2013
11,055
Looks good so far. A few minor items:

The 555 timing resistors are not connected correctly. The data sheet has the correct connections and the timing equation.
http://www.ohmslawcalculator.com/555-astable-calculator - a good calculator for the standard 555 astable circuit.
The ULN2003 COM pins do *not* tie to GND. Pulling them low is the same as turning on all outputs simultaneously. Let them float or tie them to Vcc.
What is the R4-C5 3 second time delay for?

ak
 

dannyf

Joined Sep 13, 2015
2,197
Thoughts?
Since you are already using logic gates, no reason to use a 555 timer to generate the clock signal.

You may want to play with the the placement of the upper-end of R4 to see which effect you may like.

End of the day, I think a mcu is a more flexible / simple solution, to the extent that you know mcus.
 

crutschow

Joined Mar 14, 2008
34,459
Since you are already using logic gates, no reason to use a 555 timer to generate the clock signal.
..................
I don't understand. :confused:
You still need a clock for that circuit to generate the sequence.
Using logic gates as nothing to do with that requirement.
 

AnalogKid

Joined Aug 1, 2013
11,055
There are no spare logic gates that could be turned into a clock oscillator. danny might be referring to my suggestion of using unused sections of a ULN2003 to make a 2-transistor multivibrator that functionally replaces the 555.

ak
 

Thread Starter

MythicalCoder

Joined Aug 28, 2015
83
MCU is very much overkill for this. Yes, it may be a good solution for a hobbyist, but I'm running this on my car, and need something both dependable and robust. I'm more than familiar with Arduino, but for something like this, I just don't see a real need for it.

The 555 timing resistors are not connected correctly.
I think I fixed it. I spotted one that was missing, at least, so I added it and visually cleaned up that area.

The data sheet has the correct connections and the timing equation.
http://www.ohmslawcalculator.com/555-astable-calculator - a good calculator for the standard 555 astable circuit.
Using that calculator, I think I've come up with a good working value. I actually calculated the delay wrong, so I'll need 0.25 seconds instead of 0.5 seconds minimum. Knowing the total number of cycles as currently designed is 20 (visual representation I just mocked up below), this works out to a 12.5-millisecond duty cycle.

Cycle_Count.gif
A capacitor of 1uF and two resistors of 6 kOhm provide 12.474 millisecond timing, which is actually far closer than I thought I'd get.

Now, I'd still like the whole cycle to last up to 1.5 seconds maximum, which works out to (1.5 / 20) = 75 milliseconds, this assumes roughly 52 kOhm total. 6k + 47k = 53k, which is about as close as I can get to it.

The ULN2003 COM pins do *not* tie to GND. Pulling them low is the same as turning on all outputs simultaneously. Let them float or tie them to Vcc.
Fixed!

What is the R4-C5 3 second time delay for?
The schematic in post #8 had this in the bottom right, R1 and C5, so I assumed it was needed. I was wondering why though. Removed it to what I think should be correct.

How does this look?

Amber_Turn.png
 

AnalogKid

Joined Aug 1, 2013
11,055
Not there yet.

Minor point - since the U3 inputs are driven by a U4 totem pole output, R4 is not needed. More on that later.

Post #8 R1-C5-Q1 form a time delay and an inverter. The inverter is critical to circuit operation, and is missing from your latest drawing. It is what guarantees that the circuit starts out shifting in ones (lit LEDs) and flips over to zeros (dark LEDs) when the pattern is full.

The time delay is up to you. What it does is make the display rest a bit each time all of the LEDs are either on or off. It's a visual impact thing, completely your call.

With or without the time delay, you need an inverter in the feedback loop. If you use an unused section of U6 for example, by tying pin 3 to pin 4, then the inverted feedback comes from pin 13. Since this is an open collector output, R4 is needed.

ak
 

Thread Starter

MythicalCoder

Joined Aug 28, 2015
83
OH! I was wondering how that part of the logic worked. I didn't catch the use of that transistor there.

For now I'll skip the time delay, but I might add it in later if it looks too quick for my tastes.

Sounds like I'm in the home stretch though! How's this?

Amber_Turn.png
 

Thread Starter

MythicalCoder

Joined Aug 28, 2015
83
Tweaked the previous design a bit to add LED's and PWM dimming, which I pulled from here. The PWM dimming is high side, while I think the ULN2003 is low side, so this should (hopefully) allow me to dim the whole setup without any ill side effects.

I do want to add in a resistor to make sure the LED dimming pot doesn't get bumped and cause it to be too dim, but I haven't calculated the value for that as of yet. When I do though, would it be placed in position A, position B, (indicated below, in blue) or some other position?

Not hearing anything for a couple days I'm hoping is a good sign. Have all the bugs been ironed out thus far?

Amber_Turn.png
 

AnalogKid

Joined Aug 1, 2013
11,055
The counter looks ok, but the PWM needs help. First, taking the 555 output off of anything but the output (pin 3) usually is a bad idea. The output transistor is sourcing all of the LED current, but it is an emitter follower rather than a saturated switch, so it might overheat. Also, it's drive comes from a 4.6K resistor, too large. Better to use a PNP transistor, emitter to +12, collector to LEDs base to 2.2 K resistor to 555 pin 3. Yes, the 555 can drive both the output transistor and the timing network.

ak
 

Thread Starter

MythicalCoder

Joined Aug 28, 2015
83
So the PWM circuit I found is no good, gotcha. I did swap the NPN for a PNP and replaced the 4.6K resistor for a 2.2K one first. Then I replaced the whole PWM section with figure 5.2 from here. For clarity, it's the one on the left below:


I'm not sure that I wired up Pin 3 correctly to the PNP transistor, or if Pin 7 is supposed to be an N/C. I'm also hoping I can increase the frequency to somewhere at or above 2 kHz.

So my questions for this approach are:
1) Is this PWM approach suitable for dimming the LEDs?
2) How do I increase the frequency to something faster? Is that the capacitor's job?
3) If I want to force the duty cycle to be at or above a specific percentage (say, 37% to ~100%), my understanding is it would go in position A or B (indicated in blue below), and the pot would be adjusted accordingly. Am I correct in thinking that? And if so, which spot does it go in?

Schematic:

Amber_Turn.png
 

AnalogKid

Joined Aug 1, 2013
11,055
Yes, pin 7 is n/c.
1. Yes.
2. Yes. Use the equation in the drawing.
3. Yes. With a PNP driver transistor, your LEDs are on when the 555 output is low. When the output is low, it is discharging the timing capacitor to GND. This tells you which diode is conducting, and therefore in which side to insert the timing offset resistor. Note that when you do this it changes the timing calculation. For example, if you put a 2K resistor in series with the 10K pot, R1 in the calculation is now 12K instead of 10K.

a. Select the pot. 10K is a good starting point.
b. Determine the minimum on time *percentage* you want. This is a design decision.
c. Either by trial and error or by rearranging the algebra, use the equation to calculate the timing offset resistor.
d. Now that the percentages are set, use the equation to select a timing capacitor for whatever switching frequency you want.

ak
 

Thread Starter

MythicalCoder

Joined Aug 28, 2015
83
I can't seem to get the equation to work right. (0.7) / (10,000 Ω × 0.1 uF) works out to (0.7 / 1,000) which is 0.0007? Even if it's in seconds, that would be 70,000 Hz. I'm not sure how that translates to 700 Hz. I must be off by a power of ten somewhere, but I'm not sure where. How is it supposed to work?

Based on your explanation for #3, I sectioned off the PWM and color-coded it.

When OUT is high, the yellow section has current:

Amber_Turn_PWM_High.png

To slow the switch down and provide more "high" time, more resistance is needed. So my initial thought is that it belongs in position A. Not one to cut corners, I charted up what it looks like when OUT is low:

Amber_Turn_PWM_Low.png

That's when I realized a crucial misstep: the PNP inverts the logic, so when the PWM circuit is high, the LED is low, and vice versa. So it actually belongs in position B.

Final answer: position B! Assuming I can get the resistance values to play nice (which, to be honest, may be a bit difficult, but bear with me), I may be able to keep the total resistance at 10K. Something like this:

Amber_Turn.png

So two questions this time:

1) Where is my mistake in calculating the formula?
2) Is position B the correct one to use? Or is my thinking misguided?
 

crutschow

Joined Mar 14, 2008
34,459
1) The period is approximately 0.7 *( R*C) [not 0.7/(R*C)] or 0.7*10k*0.1μ = 700μs.

2) The high and low times are controlled by the pot.

(Note that to use a PNP at the output, the emitter must be connected to the same voltage as the 555 supply.)
 

Thread Starter

MythicalCoder

Joined Aug 28, 2015
83
That calculation leaves me even more confused as 700 microseconds works out to 1,428 Hz (Google calc), not 700 Hz as the diagram indicates. This would be an acceptable frequency if it is accurate, but 700 Hz is too slow. I just want to play it safe and make sure there's zero flickering to the human eye, even super-fast eyes. Anything around 1.5 kHz or higher would suffice in my mind.

As for the second question, I'm looking to force a minimum light output. I want it to be user-adjustable, but I don't want it going below a certain preset, if that makes sense. Here's a cropped part of the schematic I posted as a thumbnail in the bottom of #33:

Amber_Turn_R7.png

R7 (blue arrow) is key in doing this from my understanding. Is this correct?

The PNP emitter is connected directly to the car battery, and at the end of each LED string is a 50 mA constant-current regulator, which is currently the NSIC2050JBT3G (Mouser link). I'm not sure if this is a suitable regulator, but I do need to regulate the current of a ton of LED strings with the fewest components possible, so this is the best fit I've found. This goes back to the last question in the first post of this thread. Is this a good component to use in a standard 12V automotive system?
 

crutschow

Joined Mar 14, 2008
34,459
I was in error. The frequency should be 1.4 / (RC) = 1.4 / 1000us = 1.4kHz

As I stated the emitter of the PNP has to be connected to the same voltage as the 555.
So if you want to operate the PNP (Q1) from the car battery then the 555 must also be operated from the battery.
 

Thread Starter

MythicalCoder

Joined Aug 28, 2015
83
Why 1.4? The diagram shows 0.7, what made it double?

My concern with the 555 is that it may not be able to handle the voltage range of the car, particularly with voltage spikes. I've already got the 5V regulator, so I was hoping I could use it. Is there any particular reason why I can't use the 5V trigger on the 12V PNP connection? I thought PNP was activated by ground?

(edited wording)
 
Last edited:

crutschow

Joined Mar 14, 2008
34,459
Why 1.4? The diagram shows 0.7, what made it double?

My concern with the 555 is that it may not be able to handle the voltage range of the car, particularly with voltage spikes. I've already got the 5V regulator, so I was hoping I could use it. Is there any particular reason why I can't use the 555 here? I thought PNP was activated by a ground connection.
I got the formula from this website. I didn't check to see if it was correct.

Yes, you can use a 555. I didn't say you couldn't.
A "ground connection" has noting to do with whether a PNP is on or not, it's a function of the base-emitter voltage.
When the emitter is about 0.6V greater than the base voltage, the transistor starts to turn on.
In your circuit the emitter voltage is 12V and the base voltage is 5V maximum so the transistor is always on.
So if you want to use the PNP then you will need to add an NPN driver so that the PNP base voltage can go to 12V to turn the PNP off.
See example circuit below:

upload_2016-3-12_11-8-56.png
 

Thread Starter

MythicalCoder

Joined Aug 28, 2015
83
I got the formula from this website. I didn't check to see if it was correct.
Oh, that's why: that circuit isn't the same one as the one I'm using (note the connections to the diodes).

Reposting the diagram here for clarity:



It's the Hz step that I appear to be missing. Here's my math so far:

0.7 / (10,000 Ω * 0.1 uF)
0.7 / 1,000
0.0007 seconds (?)
But how does that translate into 700 Hz?

Maybe just a simpler question: how do I make it 7,000 Hz? A 1.0 uF capacitor, or a 0.01 uF capacitor?

Yes, you can use a 555. I didn't say you couldn't.
A "ground connection" has noting to do with whether a PNP is on or not, it's a function of the base-emitter voltage.
When the emitter is about 0.6V greater than the base voltage, the transistor starts to turn on.
In your circuit the emitter voltage is 12V and the base voltage is 5V maximum so the transistor is always on.
So if you want to use the PNP then you will need to add an NPN driver so that the PNP base voltage can go to 12V to turn the PNP off.
See example circuit below:

View attachment 102344
You caught me just before I edited my typo. Meant to say "5V", not "555", but you answered my question regardless -- I had forgotten that the PNP needs a certain voltage threshold to turn off. Bearing that in mind, is it safe to power the 555 timer directly from the car's electrical system? I'm concerned about voltage spikes possibly causing damage to the component.
 
Top