Analog_5V - RaresPlescan/daisypi GitHub Wiki
Analog 5V inputs
Analog inputs A0, A1, A2 are connected to the ADC chip MCP3208 through a voltage divider. This is due to MCP3208 3.3 V supply which cannot be exceeded by its voltage reference or the sensed voltages.
The voltage divider provides a safe ratio of about 0.63 for the incoming voltage, allowing it for valid range of readings up to 5.25 V ( the upper lever of accepted voltage for Raspberry Pi power source ).
The resistors are 4.7 kiloohms and 8.2 kiloohms with a tolerance of 1%. The resulting voltage divider ratio which is to be used in voltage conversion is precisely 0.63566 ( the ratio ) .
As a general rule, a standard read of a voltage for A0, A1 and A2 would be as follows. The 3.3 Volts range for the ADC is divided into 4096 parts ( 12 bit ) that makes a resolution of sensing of 3.3 / 4096 = 0.000806 Volts ( the quantum ).
It also means the value read through it's ADC input has to be multiplied with this quantum of 0.000806 to have the direct sensed voltage measure, but since ours passes through a voltage divider, it has to multplied back with the ratio, which is 0.63.
The formula to be used in software conversion in order to obtain the real voltage is :
Voltage_sensed = adc_value * 0.000806 / 0.63566