Measure UC Battery Module Voltage

Hi,
is there a way to get the current voltage from the battery modul in C# project.
May be to drive a charging station…
Thx for any help
René

What battery module you refer to? And what SOM or board you are using?
At first i would say to couple back the battery voltage to a analog input using a voltage divider.

Hi David,
thanks for reply and sorry for these uncomplete questions.
I use a Spider board and battery modul from here:
https://www.ghielectronics.com/catalog/product/394
René

Look at the schematic. Pin 3 of the battery module is connected to a voltage divider network. Both resistors are shown as 100k? This should mean the voltage is divided by two. You might have to measure whatever value GHI settled on for build as the ? Seems to indicate that they might change it.

Hi,

At first i try this:


Socket socket = Socket.GetSocket(1, false, null, null);
Gadgeteer.Interfaces.AnalogInput batteryPinThree = new GT.Interfaces.AnalogInput(socket, Socket.Pin.Three, null);
Debug.Print(batteryPinThree.ReadVoltage().ToString());

Here i run in a exception: Socket 1 does not support type ‘A’.

Also this:


Microsoft.SPOT.Hardware.AnalogInput batteryPinThree = new Microsoft.SPOT.Hardware.AnalogInput((Cpu.AnalogChannel)Pin.IO24);
Debug.Print(batteryPinThree.Read().ToString());

There is also a exception.

When i try to use Cpu.AnalogChannel.ANALOG_0 i read a value but I’am not sure, is that the right channel?

Thx for any help
René