I have a LED dimmer switch which outputs a DC 0-10v signal. I want to apply this to an Arduino analog input pin, which has a max voltage of 5V, so I need to divide the voltage in half.
I experimented with an LM2596 buck converter, but it does not respond to variable input voltage, but maintains the 5V output until the input is no longer sufficient and then the output drops off rapidly.
I tried a simple voltage divider with two 500 ohm resisters. This does respond to variable input voltage, so it's a viable solution, but the response is not as linear as I would like.
Question - is there another (relatively inexpensive) solution which provides a more linear response?
I'm a hardware beginner, so please excuse if my question seems naive. Thanks!
odlumb:
I tried a simple voltage divider with two 500 ohm resisters. This does respond to variable input voltage, so it's a viable solution, but the response is not as linear as I would like.
It is as linear as you can possibly get. What makes you think otherwise?
odlumb:
I have a LED dimmer switch which outputs a DC 0-10v signal. I want to apply this to an Arduino analog input pin, which has a max voltage of 5V, so I need to divide the voltage in half.
I experimented with an LM2596 buck converter, but it does not respond to variable input voltage, but maintains the 5V output until the input is no longer sufficient and then the output drops off rapidly.
I tried a simple voltage divider with two 500 ohm resisters. This does respond to variable input voltage, so it's a viable solution, but the response is not as linear as I would like.
Question - is there another (relatively inexpensive) solution which provides a more linear response?
I'm a hardware beginner, so please excuse if my question seems naive. Thanks!
It should be perfectly linear. Is the LED dimmer outputting a PWM signal? This could cause all kinds of strange analog readings. Try this:
10v from led dimmer >---- 1K ----*------*----> to Arduino ADC
| |
1K === 470uF or so
| | (not critical)
com (gnd)
See what I did? Added a capacitor to average (smooth) the PWM signal. Easy to try... see if it helps.
Note that I used 1K for the divider because the Arduino ADC likes a 10K or lower source (signal) impedance.
It could be that the value of the resistors you chose is too low, and that the non-linearity is due to the loading effect of your potential divider on the dimmer's output.
For a 10V output, the dimmer has to supply 10mA to power your circuit.
Try increasing the resistor values by a factor of 10 or 100.
A buck converter is a valid solution if you want to reduce the source voltage to power something. It is not appropriate in this case because you are treating the output as a signal, not a power source.
How do you know the DC voltage is 10 volts ? Is it in the specification of the device or did you measure it ?
If you measured it, with what ?. An oscilloscope would be ideal because, as has already been pointed out, the power may be pulsed (as would be usual for controlling the brightness of a led)
You have ensured that the output of this LED controller is fully isolated from the mains ?
Part of what you are seeing is drift in the value of the resistors and possibly the collapse of the signal supply because of the loading. Change to at least 10K on the resistors, that is still within the input impedance tolerance of the arduino a/d. One of the answers shows a low pass filter, that would help however check the time constant to be sure it is in the range you need. Another 10K resistor from the divider to the cap would be a good start with maybe a 0.22uf. try this on line calculator: https://in.element14.com/time-constant-calculator?ICID=lp-calc-time-WF1529210.
Good Luck & Have Fun!
Gil
I'm replying to everyone who responded, thank you so much for your input. It's really heart warming to get so much support.
I'm going to try all your suggestions, I will get back to the forum with anything interesting. This stuff is fun!
To 6v6gt, I don't have an oscilloscope, I measured the output with a cheap digital meter (10.02V). Is a standard 0-10V LED dimmer usually a PWM output?
In general the problem I'm observing is that the LED(s) are not dimming all the way to OFF, which is what I want. So when I say the voltage divider I fabricated was not so linear, I probably said something stupid - the behavior of the LED(s) was not linear to my eye (subjective). In general, crudely speaking, 10 down to 2 volts does some dimming, but not a lot. 2 down to 1 volt was dramatic. The dimmer never reaches 0, it seems to stop at only 1 volt minimum, although specifically advertised as a 0-10V device. That explains why I can't dim to OFF. At just 1 volt the LED(s) are still MUCH brighter than I expected, or wanted.
I'm working in a pure HW environment at the moment, eventually this will all go through a home made Arduino XDM controller, and I can tweek things accordingly in SW. But I would like to get it right in HW first and understand what I'm doing.
JohnLincoln:
It could be that the value of the resistors you chose is too low, and that the non-linearity is due to the loading effect of your potential divider on the dimmer's output.
For a 10V output, the dimmer has to supply 10mA to power your circuit.
Try increasing the resistor values by a factor of 10 or 100.
An LED driver is a relatively high power, high output current device. I doubt that a few mA of load from a voltage divider bothers the LED power supply at all.
6v6gt:
A buck converter is a valid solution if you want to reduce the source voltage to power something. It is not appropriate in this case because you are treating the output as a signal, not a power source.
How do you know the DC voltage is 10 volts ? Is it in the specification of the device or did you measure it ?
If you measured it, with what ?. An oscilloscope would be ideal because, as has already been pointed out, the power may be pulsed (as would be usual for controlling the brightness of a led)
You have ensured that the output of this LED controller is fully isolated from the mains ?
THAT is a very good point. I never thought about mains isolation.