by i-Bot » Fri Mar 07, 2008 10:29 pm
by i-Bot
Fri Mar 07, 2008 10:29 pm
While you look to the posting of the code.
The AD(x) command reads the voltage on the ADx pins. The value returned is between 0 and 256 over the input range 0 to 5Volts.
To measure the battery voltage which is greater than 5 Volts, you need to divide the battery voltage by two with a pair of resistors.
The battery voltage is on the connectors down the side of the board which feed the servos. Battrey voltage is on the middle pin. You need a pair of resistors in series between the battery voltage and ground ( the pin towards the edge of the board. The two resistors should be of equal value ( between 22K to 47K ohms each)
The point between the two resistors is at half the battery voltage and is fed to the AD6 connector (pin nearest center of the board). The middle pin of the AD connectors is not battery, it is regulated 5 Volts.
Now the value read by AD(6) will be the 256 * (battery voltage/ (5Volts * 2(voltage divider)), which is what you want.
Note when the battery voltage drops below about 5.5 volts, the reference in the processor starts to drop, since this is also driven by the battery, so values are no longer valid.
While you look to the posting of the code.
The AD(x) command reads the voltage on the ADx pins. The value returned is between 0 and 256 over the input range 0 to 5Volts.
To measure the battery voltage which is greater than 5 Volts, you need to divide the battery voltage by two with a pair of resistors.
The battery voltage is on the connectors down the side of the board which feed the servos. Battrey voltage is on the middle pin. You need a pair of resistors in series between the battery voltage and ground ( the pin towards the edge of the board. The two resistors should be of equal value ( between 22K to 47K ohms each)
The point between the two resistors is at half the battery voltage and is fed to the AD6 connector (pin nearest center of the board). The middle pin of the AD connectors is not battery, it is regulated 5 Volts.
Now the value read by AD(6) will be the 256 * (battery voltage/ (5Volts * 2(voltage divider)), which is what you want.
Note when the battery voltage drops below about 5.5 volts, the reference in the processor starts to drop, since this is also driven by the battery, so values are no longer valid.