Shop OBEX P1 Docs P2 Docs Learn Events
Convert 3-12 VDC PWM to On/Off — Parallax Forums

Convert 3-12 VDC PWM to On/Off

MisterJJMisterJJ Posts: 6
edited 2006-07-08 18:50 in General Discussion
I'm trying to get a 3-12 VDC PWM to operate a relay.· The source is·automobile instrument lighting (on dimmer control) and the relay will be driving a set of three LED's.· I tried hooking up a·Clare LBA110 OptoMOS relay and had strange results.· It took me a while to figure out that the 3-12 VDC was actually a PWM signal and the relay was just rapidly switching on and off.· I wanted it to be·on with no voltage and·off with any voltage above 3 VDC.· I tried adding·an RC circuit with 2 microFarads of capacitor and didn't get any better results.

So does someone know how I can make this work?· Is there a better (simpler) way to do this?· My electronics knowledge doesn't go much further than Ohms law so I'm probably making this much more complicated than it needs to be.

I hope this isn't too off-topic.· I know it's not directly stamp related but it could certainly have stamp related applications.· If there's a better place to ask this question, please let me know.

Thanks!

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-06 13:07
    I think the circuit attached should smooth out the PWM and drive the LEDs itself (LEDs & limiting resistors.)· There may still be a·dimming effect, depending how big a capacitor you use (experimentation necessary.)

    [noparse][[/noparse]As this doesn't involve a STAMP at all, it would have been better placed over in "The Sandbox".]
    322 x 203 - 6K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-07-06 14:15
    This thread is being moved from the·BASIC Stamp·Forum to the·Sandbox Forum.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • stamptrolstamptrol Posts: 1,731
    edited 2006-07-06 16:46
    One comment on the suggested circuit is that it is configured as a peak detector and will likely have the LED turn "on" when even a very small pwm signal is seen. It may be necessary for the output side to included a dummy resistive load in parallel with the load LED.

    Cheers
  • MisterJJMisterJJ Posts: 6
    edited 2006-07-06 17:50
    PJ Allen said...
    I think the circuit attached should smooth out the PWM and drive the LEDs itself (LEDs & limiting resistors.)· There may still be a·dimming effect, depending how big a capacitor you use (experimentation necessary.)
    Won't this turn the LED's on when there is a PWM signal?· I was actually looking to turn·the LED's·off when there is a PWM signal and turn them on when there is none.··Can I still use this·circuit as an input to the normally closed relay?· I'm not sure what a rectifier does in a DC circuit like this.
  • bennettdanbennettdan Posts: 614
    edited 2006-07-06 19:24
    My i ask why do you want the LEDs on when it is below 3vdc how did you com up with the 3vdc?
  • MisterJJMisterJJ Posts: 6
    edited 2006-07-06 20:01
    bennettdan said...
    My i ask why do you want the LEDs on when it is below 3vdc how did you com up with the 3vdc?
    I want to turn·a set of LEDs·on when the headlights are off and turn them off when the headlights are on.· A little over 3vdc is the minimum voltage output to the instrument lights (dimmest setting).· The obvious alternative would be to wire directly to the light switch but it's not that easy since the car has automatic headlights.· An additionall complication is that·it's a CAN-bus based vehicle so wiring things "can" be difficult.smilewinkgrin.gif··It appears that the only location for +12vdc power that is only on·when the lights are on is within the engine compartment.· Therefore, I'm really motivated to make this work with the variable voltage available instead of tapping into the headlight wiring and trying to fish wires through the firewall and up through the dash of a new car.
  • metron9metron9 Posts: 1,100
    edited 2006-07-06 21:31
    How about put a small light sensor inside the instrument panel
    If the sensor is on the lights are on your led's are off
    course I dont know where you are putting your led's, parhaps they are inside the dash as well

    or a thermistor attached to the headlights could tell you when they are on
    course there will be a delay and that may not work so good.

    Hmmm helps to know the full scoop I guess to brainstorm it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-06 21:39
    Mr. JJ said...
    I'm not sure what a rectifier does in a DC circuit like this.
    The pulses (PWM) charge the cap up and·the diode makes it so that the current stored in the cap discharges only into the circuitry on the cathode side.· It could, as is, sustain some LED current, but there's not enough to keep a relay coil active (the PWM circuit might not be happy charging up a 4700uF.)·
    It's not an expensive circuit to build and experiment.
    Otherwise, unless you have +12V available, I figure you're stuck.
    [noparse][[/noparse] N.B. -- The "3-12V" isn't a variable voltage as such, it's the DC-equivalent of the PWMing, probably 25-99%. ]

    Post Edited (PJ Allen) : 7/6/2006 9:43:04 PM GMT
  • MisterJJMisterJJ Posts: 6
    edited 2006-07-06 22:10
    PJ Allen said...
    Mr. JJ said...
    I'm not sure what a rectifier does in a DC circuit like this.
    The pulses (PWM) charge the cap up and·the diode makes it so that the current stored in the cap discharges only into the circuitry on the cathode side.· It could, as is, sustain some LED current, but there's not enough to keep a relay coil active (the PWM circuit might not be happy charging up a 4700uF.)·
    Hmmm...· That might do the trick then.· The LBA110 relay that I have·is not a coil relay.· It's a solid state relay.· I think·LBA110·is essentially a tiny LED with a·light sensor operating a relay.· I should be able to use the rectifier/capacitor circuit to drive the·LBA110, which will in-turn drive the LED's.· I'll have to give it a try!
    Thanks.
  • bennettdanbennettdan Posts: 614
    edited 2006-07-06 23:35
    Well you could use like a 10 watt 1 ohm resistor·in series with your dimmed dash lights and then use a comparator curcuit to sense the current flow and you would not care about the voltage then output the comparator to your LED through a small mosfet. Also you could use a .47 ohm 5 watt to have les of a voltage drop. Here is a curcuit attached.

    Post Edited (bennettdan) : 7/7/2006 10:25:55 PM GMT
  • metron9metron9 Posts: 1,100
    edited 2006-07-07 07:25
    How about parallax buying a real of these so we can buy a few.

    NUD4001 High Current LED Driver,

    This device is designed to replace discrete solutions for driving
    LEDs in low voltage AC−DC applications 5.0 V, 12 V or 24 V. An
    external resistor allows the circuit designer to set the drive current for
    different LED arrays. This discrete integration technology eliminates
    individual components by combining them into a single package,
    which results in a significant reduction of both system cost and board
    space. The device is a small surface mount package (SO–8).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think outside the BOX!
  • MisterJJMisterJJ Posts: 6
    edited 2006-07-07 18:59
    bennettdan said...
    Well you could use like a 10 watt 1 ohm resistor·in series with your dimmed dash lights and then use a comparator curcuit to sense the current flow and you would not care about the voltage then output the comparator to your LED through a small mosfet. Also you could use a .47 ohm 5 watt to have les of a voltage drop. Here is a curcuit attached.
    Sounds interesting.· Wouldn't·5-10 watts·generate a lot of heat though?

    What software do you need to read the file attached?· I searched and it looks like it might be Cadsoft-Eagle.· Couldn't download the software to find out though because the download link gets me the standard "Page not found" error.
  • bennettdanbennettdan Posts: 614
    edited 2006-07-07 22:22
    Actuall its just a large ratting build with only one ohm or .47 ohm load it will not cause much heat to build up. Sorry about the software I will convert it to .bmp for you and post it on the original post.·I used the free cad from PCB express to make it.

    Post Edited (bennettdan) : 7/7/2006 10:26:45 PM GMT
  • MisterJJMisterJJ Posts: 6
    edited 2006-07-08 06:33
    It works!· I had originally tried an RC circuit with 2 microFarads capacitance simply because I saw a PWM smoothing circuit that used 1 microFarad (I had two of them).· Turns out I just needed a bigger "C".· I didn't even have to use the rectifier.· I tried a 100 microFarad cap and it was good until the very low end of the voltage range (PWM duty cycle).· A 220 microFarad did the trick and now it works perfectly!

    I still want to see how the comparator circuit would work since I may wind up doing this a few more times and my current circuit with three solid state relays is rather onerous. ·I'm just soldering jumper wires on a thru-hole board.· (The circuit does a few more things as well that I didn't mention·in order to avoid unecessary complication.)

    Much thanks to all those that helped.

    P.S. I'm a former forum regular from several years ago.· I changed jobs and haven't·had the chance to play·with "stamps" since.· This·forum was (still is) awesome.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-08 11:10
    MisterJJ posted...
    I didn't even have to use the rectifier.
    [noparse][[/noparse]Look everybody -- No Hands...]·
    It's only necessary·unnecessary if everything else on that circuit using the "PWM" is OK with the Cap's effect/s.
    PJ Allen posted...
    ...the diode makes it so that the current stored in the cap discharges only into the circuitry on the cathode side.
    Post Edited (PJ Allen) : 7/8/2006 6:50:13 PM GMT
  • MikeKMikeK Posts: 118
    edited 2006-07-08 18:44
    Re: It's only necessary if everything else on that circuit using the "PWM" is OK with the Cap's effect/s.

    I think you meant "It's only unnecessary" or various equivalent phrasings.

    Mike
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-08 18:50
    I stand corrected.
Sign In or Register to comment.