Hello, I need some help. I am basically replacing a POT with an arduino signal. I need a circuit that takes in a pulse train from the arduino and outputs a percentage of the source voltage.
Anyone have any ideas? I am using a Mega2560.
Thanks
cj
Hello, I need some help. I am basically replacing a POT with an arduino signal. I need a circuit that takes in a pulse train from the arduino and outputs a percentage of the source voltage.
Anyone have any ideas? I am using a Mega2560.
Thanks
cj
This question has been answered very often in the forum. Use the forum search feature...
I think I know what you're asking...
analogWrite() puts-out [u]PWM[/u]. A [u]low-pass filter[/u] can average-out the PWM to give you analog DC.
As a starting-point for the filter you can calculate the RC time constant (R x C). For example, 1uF and 1M is 1 second. (You'll typically want a lower value resistor... That's just an easy to calculate example.) If a 1 second delay/lag is OK you can use a 1 second time constant. The default PWM frequency is about 500Hz (a period of 2 milliseconds). Your filter should be at least 10 times slower than the PWM, and the slower the filter the smoother the DC will be.
The resistor in the filter should be 1/10th the load resistance or less, because it makes a voltage divider that knocks-down the output voltage and the load resistance reduces the time constant.