I am interested in learning more about the electricals behind converting an analog value to a voltage on the Controllino Mega.
I read in the sample analog input demo code that the conversion for analog to voltage uses the following code:
measurementResultVoltage = map(measurementResult, 0, 1023, 0, 31); // because the voltage dividers are dimensioned with some safety reserve
I was wondering if I could get some more details on why the exact voltage of 31 is used in this sample. Is there about a 5 or a 4.6 volt buffer safety reserve built into the Controllino’s? Maybe, this depends on a few factors that need to be accounted for .
For instance using my uncalibrated multimeter I found that using a conversion voltage factor of 30.4 was the most accurate. This could be due to a number of reasons, but if anyone with more knowledge on the Controllino’s could comment on this that would be amazing.
Have a great day!