Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Using a PWM signal to switch on a circuit

Status
Not open for further replies.

bigal_scorpio

Active Member
Hi to all,

I am having a small problem with a circuit I have made that dims an LED display in the car.

I designed the circuit to dim the LED at night when I put the lights on thinking when I switch the lights on that the +12v from the light circuit would hold on a transistor which in turn dims the LED until the lights are turned off, simple eh! No!

I have now found that the lights are controlled by PWM (well the dash lights anyway - which are easy to access) which has the effect of pulsing the LED.

So does anyone know if it would be OK to put an electrolytic cap from the lights wire to ground or would this effect the operation of the cars PWM, or even damage it?

Otherwise is there a simple way of safely converting a PWM signal to logic on or off?

Thanks for looking........Al
 
A capacitor will be a dead short to the PWM circuit. The circuit and/or the capacitor will blow up.
You can average the PWM pulses into a decaying DC voltage with a series resistor then a capacitor to ground. This smoothing filter can drive a comparator that drives the transistor that turns the LED on and off.
 
Thanks for the reply Audioguru, any rough ideas on values?

Or is it better to experiment and start with say 10k and a cap of say 100n?

Would that be safe do you reckon?

Thanks Al
 
Depends on the PWM rate. You can see the LED flashing, so the PMW rate has to be less than ~25Hz (eye's flicker fusion rate)? To filter that, it will require RxC > 100ms, so try 100K and 1uF.
 
Last edited:
I guess the PWM frequency is 1kHz. Then the 10k resistor and 100nF capacitor would filter it a little with a time constant of 1ms so there will be lots of ripple voltage almost like the RC was not there. 4.7k and 10uF will have a time constant of 47ms which would work well as a filter.
I don't know how much current you need for the LED so maybe a little transistor or a darlington transistor is needed to drive it.
 
I should have mentioned that the PWM is actually feeding a PIC micro that in turn dims the LED display, so it really only needs a logic on or off, and I'm guessing not much current at all, so would either of the above solutions be appropriate?

Thanks Al
 
I should have mentioned that the PWM is actually feeding a PIC micro that in turn dims the LED display, so it really only needs a logic on or off, and I'm guessing not much current at all, so would either of the above solutions be appropriate?

Thanks Al

hi Al, hope you are well again.:)

If I have followed correctly your posts, you have made a PIC PWM LED dimmer.?

You cannot control the dimming the LED's by reducing the led voltage.

Exactly what would like to see happen with your LED dimmer circuit,?
 
Last edited:
how about feeding the cap through a diode so the cap can't discharge back through the dash lights?
 
hi Al, hope you are well again.:)

If I have followed correctly your posts, you have made a PIC PWM LED dimmer.?

You cannot control the dimming the LED's by reducing the led voltage.

Exactly what would like to see happen with your LED dimmer circuit,?

Hi Eric,

Yes mate I am well, are you okay at the mo?

As to the circuit, it is a circuit that controls another circuit which is an LED clock. The circuit I made to control the clocks brightness is just a PIC12F683 that gives out 50% duty cycle when the lights are on and full duty cycle when the lights are off and no positive voltage is present. Well that was the plan! It worked perfectly on the bench but I didn't realise the cars dash lights were PWM controlled, so the poor PIC thinks I am turning on and off the lights continually while they are on, and keeps dimming and brightening the display.

Unfortunately I had made the circuit in the house and tested it by applying a normal 12v dc to it to simulate the lights being turned on. Doh! So I need a way of giving the PIC a solid signal from the PWM line without shorting it out as I feared may happen with a cap across it to smooth it.

I also need to be reasonably sure of the fix beforehand as it is a royal pain getting the dash apart to fit it, especially when you can't feel your fingers ;)

Thanks and hope you're keeping well Al

Edit. I just saw the above post! Hmm diode and cap that has me thinking!
 
Last edited:
hi Al,
Is the clock dimmer PIC is powered from the car's battery via a 5Vreg .?

Does the clock dimmer PIC, monitor the 12V PWM to the dash board leds, using a down to +5v/0v resistive divider.??

Depending upon the PWM level the clock dimmer PIC controls the clocks led brightness.??

Sorry to chew over these points, but as you say, taking off the car's dash board is a pain.

If what I have said above is correct, you could modify the clock dimmer PIC program to do the action action you are wanting.
 
Hi again Eric,

Q - Is the clock dimmer PIC is powered from the car's battery via a 5Vreg .?
A - Yes

Q - Does the clock dimmer PIC, monitor the 12V PWM to the dash board leds, using a down to +5v/0v resistive divider.??
A - Well it was meant to dim the display when it detected a pos feed and yes it is through a divider, but as I said I didn't expect to find a PWM signal which my pic sees as a constant on off on etc

Q - Depending upon the PWM level the clock dimmer PIC controls the clocks led brightness.??
A - No, when the pic gets a pos signal it dims the display to 50% and reverts to full brightness when no voltage is present


Q - If what I have said above is correct, you could modify the clock dimmer PIC program to do the action action you are wanting.
A - I didn't want to have to take out the assembly if poss, but if I could just design something to simply clip on between the circuit and the PWM wire then that would be easiest as I can still get to the PWM wire without stripping the dash again.

Hope this has made sense of sorts, we had a celebration of someones birthday (a cousin) last night and didn't leave the pub till 1am and then went back to theirs until 3am, so I am probably still under the influence hehehe. Good job its saturday and I don't need to use the car mate!

All the best Al
 
Last edited:
hi Al,
OK, I think I got that.

If the clock led dimmer PIC is programmed to sample the PWM that drives the other dash leds, then why dont you reprogram the clock PIC to to test for a PWM signal or not, instead of just a high or low level.? [which you thought initially ]

EDIT:
For example, over a preset time of say 100mS test for any activity on the dash PWM line, if no activity set the clock dimmer to 50%
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top