Megamodem & PR55-5A Battery voltage isn't correct

I have a Megamodem sending data from a PR55-5A with water level sensor attached, to an MQTT broker. The whole setup is powered by a 12v battery, which currently reads 12.82v DC with my multimeter. the 12v battery is in line between the M12 connector, and the 4-20ma sensor, and then directly connected to the barrel connector on the PR55-5A.

The values getting published to my MQTT broker show that my battery voltage is 3.162v, instead of the 12.82v I’m expecting. I’ve also tried a 5v ac adapter, and a 12v ac adapter, with similarly low voltage readings. The AA batteries are physically removed from the PR55-5A.

Here is the raw MQTT message, and my calculated voltage:

2023-06-04 17:38:42 INFO raw data: megamodem/pub1 {"data":[126,0,25,144,0,19,162,0,65,244,61,133,255,254,194,127,0,3,3,214,54,0,45,0,27,199,1,233,122]}
2023-06-04 17:38:42 INFO {"0": {"counter": 54, "sensor_ma": 4.89, "level_inches": 5.709, "level_cm": 14.5, "battery_voltage": 3.162}}

I’m using the following formula (from the user manual) to calculate voltage:
Battery Voltage=((Battery Voltage MSB x 256+Battery Voltage LSB) x 0.00322 V

And here is my actual python code doing the calculation:

    battery_msb = payload['data'][18]
    battery_lsb = payload['data'][19]
    battery_voltage = round(((battery_msb * 256) + battery_lsb) * .00322,4)

Here is how I have the whole thing wired up:

I think you are misunderstanding what the battery voltage is indicating.

Normally the unit has 2 double A batteries installed which power the device. This battery voltage reading indicates the voltage of those batteries. If you are powering the device externally(not using the on board batteries) then this battery voltage reading should be disregarded. The device cannot tell you the external power supply voltage.

Hi @TravisE_NCD_Technica , the unit came with 4x AA batteries installed, not 2. And the voltage is always low (just over 3v) even with 4 brand new batteries installed, which should be ~6v.

So does the battery voltage value only track voltage from 2 batteries, not all 4?

And why is it returning 3.162v, without ANY batteries installed? Shouldn’t it read 0v?

2 batteries are in serial, and then two are in parallel.
so it will always read around 3.2V when the batteries are new.

the reason behind this is the onboard CPU ADC range. it goes from 0-3.3V
here is how hardware connected –
Battery >>> buck-boost converter >>> CPU

Thanks @Anil_Bhaskar . I don’t really understand the specific implications of what you’re describing to me though.

  1. Does that mean, that with 4x AA batteries installed, I can safely assume the voltage of all 4 batteries is double what is being returned? (ie: 3.2v response means 6.4v?)

  2. And along those same lines, can you explain why I’m seeing 3.1492v - 3.162v with zero AA internal batteries installed with a 12v external battery?

  3. Could that number also be indicative of my 12v battery voltage? ie: 4x the voltage? My 12v battery voltage reads 12.82v with a multimeter, and if I multiply the returned battery voltage by 4x, I’m getting 12.648v, which is at least close. But I have no idea if that is accurate, linear, etc.

The reason this is so important to me is because monitoring battery voltage is a large part of the reason I bought this product, instead of rolling my own solution with a pi zero. If I can’t get reasonably accurate battery voltage, I’ll need to put a pi zero in this remote location anyway to monitor battery voltage, and then I need to figure out wireless communication, and at that point I might as well just put an ADC on the pi, and not even use this product. The website didn’t caveat that external batteries weren’t voltage monitored.

  1. Not 100% true. In most cases, yes, but not always. What if one o the batteries is bad?
  2. External power supply goes into a step-down power supply and then goes into the buck-boost. the buck-boost doesn’t know who is supplying the power.
  3. NO

The only way to measure external power is this

  1. build a voltage divider circuit
  2. connect this voltage to ADC2
    where can you find ADC connection – Pin 1 of J10 connector.

Thanks @Anil_Bhaskar . That’s helpful.

  1. So, to make sure I understand it… Is this correct?
  • I would build a voltage divider circuit, like this:
  • I would connect V-out to pin 1 of the J10 connector on the PR55-5A.
  • I wouldn’t need to make any additional ground connections to the PR55, because it is already connected to the 12v battery ground via the barrel connector.
  1. Is the 3.3v limit a nominal rating, or is that a strict rating limit? ie: a 12v battery can exceed 13.2v, so I’m trying to figure out how to compensate for that.

  2. I looked at the board for my PR55-5A, and I don’t see any headers labelled J10. Maybe the labeling is obscured? How can I find J10? Do you have a photo of it on the board, or something similar?

  3. How will the voltage from ADC2 be represented in the payload sent to my megamodem/MQTT broker? Will it identify as another device ID? Or is it additional payload data sent in the same packet as my 4-20ma sensor data?

  4. Do I need to enable ADC2 somehow?

Thanks for your help, I appreciate it.

Bump @Anil_Bhaskar wanted to make sure you saw this. I’d like to get this figured out so I can order the parts I need to test all this. Thanks!

i think it will be best if you can send it back for a modification.
we will have to load new firmware in it. Right now, ADC only supports one channel. We will need to add one more