View Full Version : Some help required.

01-11-2009, 06:00 AM
Hello, I am using the Prop for a robotics platform and I would like to feedback the current battery voltage (leftover) to another computer but I do not have any idea on how to mesure the battery voltage using the prop. if somebody would like to put me on the right direction? Thanks a lot.


01-11-2009, 06:10 AM
Use an ADC like the 12-bit Microchip MCP3201. It's got an SPI interface so it's easy to interface it to the Propeller.


Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

01-11-2009, 06:15 AM
I am not very experimented from electronic point of view and I have a question about ADC, I think that an ADC need some kind of reference voltage to work then how could I provide a reference voltage if the robotic platform is using the same battery source that I want to measure?


01-11-2009, 06:19 AM
Yea that would work. However if you want to be real accurate a precision voltage regulator would do the trick. Make sure that the battery voltage is not greater than the Voltage max on the ADC.


You could probably get away with using some diodes to measure the voltage. Wire them up as a switch and limit the current into the propeller.

***Edited again

Just thought of a great simple idea:

Using a Varicap diode one could measure battery voltage if configured as a RC Circuit. I think there already is a RC measuring object. Since the Varicap diodes capacitance changes with respect to voltage then this could work. This is a theory however, but seems possible.

Post Edited (grasshopper) : 1/10/2009 11:30:44 PM GMT

01-11-2009, 06:38 AM
The capacitance is very small with most diodes, that idea wouldn't work. Even with "hyper-abrupt" diodes, the change is only 100 pF or so over 5V, and they are very expensive.


Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

01-11-2009, 06:40 AM
Eh it was a thought. I was about to look this all up. Thanks leon for saving me some time :)

01-11-2009, 06:52 AM
The voltage that I need to mesure is in a range of 7.5V to 14.5V.

Paul Baker
01-11-2009, 07:06 AM
Use precision resistors to divide the voltage into a measurable range then use an ADC to measure it.

Many ADCs have internal references that use Vdd to generate it, since you have a regulator putting out a stable voltage everything will work.

Paul Baker (mailto:pbaker@parallax.com)

01-11-2009, 07:08 AM
Sounds like a job for the 2 pin sigma delta adc circuit.

Paul Rowntree
01-11-2009, 07:31 AM
@jm : you are right to be concerned about using a reference derived from the same battery that you want to characterize ... The trick is to use a stabilized reference for the ADC, which can be a seaparate reference chip output or just use the 3.3 V that is driving the Prop. It will be kept at 3.3 V even if the battery source falls significantly, so then the divided-down battery voltage will be easily measurablke relative to this stabilized 3.3 V.

Paul Rowntree

01-11-2009, 08:04 AM
Thanks! I shall give it a try tomorrow. Have a great evening all!

01-11-2009, 11:23 PM
It should be possible to use a simple R-C ADC to measure the Battery voltage.
Attached is a schematic, and here is a Spin code: (only the ADC methode, and not tested)

batt = 7 'I/O Pin for Battery ADC

PUB getBatt : time
dira[batt] := 1 'discharge C
outa[batt] := 0
time := 0
dira[batt] := 0 'Pin to input
time++ 'measure time
until ina[batt] > 0 'until C > 1.4V threshold
dira[batt] := 1

You get not a value in Volt, but a value which is higher for low Battery voltage, and lower for higher Battery voltage.
(because the C is charged faster if the current is higher, and the current is higher if the battery voltage is higher).