Maker Pro
Maker Pro

Multi stage shift light with PWM.

Hi guys, I feel a little ashamed about diving in on my first post and asking for advice but you never know, I may have something to offer back one day.

What I'm trying to do is a multi stage shifting light for a car, exactly like you see in modern f1 cars, about 10-12 led's in a row in colours ranging from green to red and lighting up sequentially (with rpm) in about 4-5 segments.

The device will be controlled by the ecu which has a number of simple on/off outputs, so for a 4 stage shift light I'll need 4 Outputs, the outputs are at a bit of a premium so l don't really want to go down this route.

The ecu also has pulse width modulated outputs which can go from 0-100 Duty cycle and 0-400 Hertz.

My problem is how to switch on the led's on in 4-5 stages by varying only the duty cycle. ie 20% duty = 3 led, 40% duty = 6 led, 60% duty 9 led's and so on. I understand the duty will affect the brightness of an led but could I some how use 4 or 5 transistors each with a different base resistor? Probably not as the transistor would probably mirror the duty over to the led.

Anyway, see what i mean, I've been scratching my head for a while.

Many thanks.
 

hevans1944

Hop - AC8NS
If you filter the pulses coming from your variable duty cycle source, the result will be a variable DC voltage proportional to duty cycle. Apply this to the LM3914 analog signal input. Are the variable duty-cycle and variable frequency ECU outputs related to each other?
 
Sounds perfect,

Pwm input - filter - lm3914 - led strip

The duty and frequency can be set to anything you like on different outputs so does this make them unrelated, if the frequency was the same on two outputs I'm not sure if they would be in sync.

So I suppose my next question is how do I filter a pwm output to give a proportional dc voltage?
 

hevans1944

Hop - AC8NS
Sounds perfect,

Pwm input - filter - lm3914 - led strip

The duty and frequency can be set to anything you like on different outputs so does this make them unrelated, if the frequency was the same on two outputs I'm not sure if they would be in sync.

So I suppose my next question is how do I filter a pwm output to give a proportional dc voltage?
You have several choices, depending on the source impedance of the PWM source. If it is low enough, a simple RC filter will work: apply PWM output to a 10 kΩ resistor in series with a 10 μF capacitor to ground. Take DC filtered output across the capacitor.

With PWM, the peak-to-peak amplitude of the signal is fixed between ground and the PWM supply voltage, in this case 12 V DC. So you have a train of pulses that are constant amplitude (and maybe constant frequency, although that isn't really important) and the width of each pulse varies according to the duty cycle. If the duty cycle is 50% you get a square wave, meaning the DC peak voltage is there half the time. The RC circuit "averages" this out so you get about half the peak DC voltage. Duty cycles that are less than 50% average out to less and duty cycles that are more than 50% average out to more. A 100% duty cycle means the pulses disappear and only a constant DC output appears. A 0% duty cycle means the pulses disappear and zero DC output appears. So any duty cycle between 0% and 100% will average out to a DC voltage between zero and 12 V DC... or slightly less since there is usually a few tenths of volt drop in the PWM output from the power supply voltage, caused by loss in the switching transistor producing the PWM output.

The time constant (the R times C product) of the RC filter determines how fast the filter responds to changes in the duty cycle. You want to "filter out" the basic frequency of the PWM pulse train but leave enough response to see fast changes in the PWM duty cycle. The values I gave you are just a starting point. You can increase either R or C or both to increase the time required to respond to changes in PWM duty cycle, or decrease one or both to speed things up.
 

hevans1944

Hop - AC8NS
DAC, low pass filter sound any good.

Found this useful site http://sim.okawa-denshi.jp/en/CRlowkeisan.htm
Don't know what you would use a DAC for. Your signals are not in the form of digital data, are they?
Yes, that is a pretty nifty site. The values I gave above for the RC filter yield a step response time of about a quarter-second, which may be too slow for a tachometer shift-point indicator, especially for a high-performance vehicle that can accelerate from 0 to 60 mph in less than five seconds. You might want to reduce the resistor to 1 kΩ for a little snappier response from the LED light bar.
 
Many thanks for your help.

I had just assumed the signal was Digital because it's either on or off, and we were trying to change it to analog.

The values you gave are pretty spot on when I put them in the calculator it comes out at 0.02 sec response which is plenty fast for my car. I also noticed a side effect of very fast response is a larger ripple voltage which can be smothed out at the cost of response.
 

hevans1944

Hop - AC8NS
Many thanks for your help.

I had just assumed the signal was Digital because it's either on or off, and we were trying to change it to analog.

The values you gave are pretty spot on when I put them in the calculator it comes out at 0.02 sec response which is plenty fast for my car. I also noticed a side effect of very fast response is a larger ripple voltage which can be smothed out at the cost of response.
I suppose one could consider a PWM signal to be "digital" but not in a way that is useful to a DAC.
As you noticed, there is a trade-off between ripple and response time. The only way around that would be to increase the frequency of the PWM signal, which will decrease the ripple with no affect on response time.

Also note: you will have to scale (either amplify or attenuate) the filtered PWM DC input to the LM3914 to "calibrate" the LED light-bar display to represent RPM.

At the web site you cited for the ECU, there are some nice color LCD displays for displaying graphics such as an RPM bar graph. Are these too expensive for your purpose? Or are there other problems associated with LCD displays versus LED displays, such as wash-out in bright sun light? Just curious. When I was riding motorcycles I shifted by engine sound, not by RPM indication.
 
Those displays are nice but cost an arm and a leg, £1200 for the car dash, for that reason I bought a windows tablet (the very one I'm typing this on now) and mounted it in the car by making a holder with a protective case.




This allows me to display real time info and allows any real time alterations of the fuel, ignition, turbo boost, traction etc on the fly which is a real bonus as before it was a laptop on the passenger seat job.

The screen is surprisingly bright but l couldn't help thinking that an led shift light would finish the job off nicely (like on the £1200 dash), I could use the engine sound to change but as you can see l like toys.

On the calibration note, l will be able to calibrate the voltage vs rpm the light will see in the ecu settings, it has full 2d and 3d maps for rpm load or any other input the ecu is given.

I'll remember to post a picture when done, or maybe a video.

Cheers.
 
Top