Ah - thank you for that input, too.
In fact, I have another question. I could not find a 1.5M Ohm resistor, and he puts an emphasis on the 15-1 ratio. Can I use a 1M Ohm, in line with 5 100k Ohm? (Probably a silly question, but I'm new at this....)
Edit:
Looked at the Sketch, which says:
unsigned int SetVoltage(double voltage) {
if (voltage>60) {
return 0; // do not exceed 60V
}
// This function converts the voltage value (0 to 5V reading; 0 to 60V actual), into a value for an analog input (from 0 to 1024)
// If your resistor voltage divider is not perfectly 15:1 you'll need to change the formula below
// with ideal resistors and a perfect 5V Analog Reference voltage (AREF), an analog input value of 13.65 would be 1V
return (voltage*12.8);
// ideal ADC value, per volt = voltage*(1024/5)/(15/1) = 13.65
// the real value for my circuit = voltage*(204.8)/(16.5) = 12.41
// 16.5 was my measured resistor voltage divier ratio.
// I increased my calculated 12.41 constant to 12.8, by trial and error, in order to get closer to the target voltage
// My results were +/-0.2V, at a 0.1mA (100Kohm) load when powered by the Arduino.
}
So, since 60v is well beyond what I was going to try for anyway, I think I can do this:
- use a 1M Ohm resistor instead of 1.5M
- change the conditional in the above function to 50 instead of 60 - if the v is greater than 50, return 0
- change the formula to... well.... I'm not sure. The math doesn't make sense to me. I get the voltage divider bit (googled it). But, it seems like a 10:1 ratio would actually make the math easier!
Any help?
Edit2:
Oh... wait. Let me guess. The multiplier should be 20.48, which is (1024/5)/(10/1). Each volt "read" will equal 20.48 volts actual. It also looks like a bit of trial and error with the multi-meter will be necessary to tweak the multiplier. Not a big deal, as my voltage does not need to be that precise.