Hello everybody. I am new with these Arduino boards and just playing around with how to program them. I am looking for some help on a design and program.
I am looking to take a 0-10VDC signal as my input signal and convert that into a 0-5VDC output signal that is inversely related to the input.
So if I have 10VDC in I need 0VDC out and 0VDC input would give me a 5VDC output. As the input rises the output falls within these ranges.
I have looked into various circuit designs but can't seem to come up with anything on this so far. I was wondering if using a small board would work with a little programming to tell it how to relate the voltages.
Thanks. The only thing I don't quite understand is the input pins and the way you have the resistors. You have analog input pin, 0-5VDC. I have a 0-10VDC signal input
The resistors wired in series from 10V to Gnd make a voltage divider. You feed the analog signal from the junction into the arduino.
Vin : resistor R1 : Vout at junction : resistor R2 : Gnd.
I just want to say thank you for all your post, I have read it from top to bottom and learned so many things. It's a very helpful thing to come across with this kind of work online because you will be able to know things that are beyond your skilss outside world. Thanks anyway.
So you're saying it does not invert?
Lets work thru an example.
You connect 5V, do a reading, get 1023 as a result.
Shift right twice (>>) to divide by 4.
Result is 255.
255 - 255 = 0;
analogWrite(0); should give 0V out.
Assumes the output is going thru a lowpass RC filter to smooth it out and not be the square wave that it actually is.
Say you put in 2.5V, do a reading, get 511 as a result.
Shift right twice (>>) to divide by 4.
Result is 127.
255-127 = 128
analogWrite(128); should give out ~2.5V.
Say you put in 1.25V, do a reading, get 256 as a result.
Shift right twice (>>) to divide by 4.
Result is 64.
255-64 = 191
analogWrite(191); should give out ~3.75V.