Wrong battery level readings

Hi,

We have 8 emonTHs, and 1 gives the ‘wrong’ battery level data. It says 1.5 V, even when we put new batteries in there.

Anyone know what I can do about this?

Thanks

Is it a new purchase or a fault that’s just appeared? If new, when did you buy it and what colour is the board?
Where does it give the wrong data - on the FTDI connector and the Arduino serial window, emonCMS or what?

HI @Robert.Wall , sorry about the lack of info.

We ‘got’ this at the end of 2016, by an engineer who installed the heating system/mvhr/passive house. The board look like this: https://community.openenergymonitor.org/uploads/default/original/2X/e/ea412484d6a3c5ee47cc6bd5bbb0befe00d0a6fc.jpg (it seems to be v2?).

We have an emonPi, which shows those readings of 1.5V.

I checked the ‘config’ files in EmonHub, the node has the same settings/configurations/numbers etc as the other emonTH. So the readings seems ‘legit’ … The temp/hr/rssi are all in line with another emonTH I have placed next to it. I also used a volt meter to test the batteries, and they are the ‘same’ voltage as another emonTH, which shows around a 3.0 reading.

Anything I can do to correct this?

I think there is a very slim possibility that the emonTH sketch has been changed - this might have happened before you got the unit, but I can’t think of a reason to do so, unless someone was experimenting. If you have a programmer, it would be possible to reload to original sketch.

One question - is the reading rock solid, or does it change with battery condition, i.e, is it working but the scale is wrong? If it’s a constant value, I can’t suggest a cure other than to try reloading the sketch. If it’s wrongly scaled, then adjusting the appropriate value in the line scales = in emonhub.conf to give you the right numbers as shown on your meter is the best I can suggest. If it’s exactly 1.5 when the true battery voltage is exactly 3.0, then the final 0.1 becomes 0.2.

Hi,

The battery level is 1.5V. Since I just started investigate/use the emonPi/TH/Tx myself (after 1 year being used and installed by engineer) I just discovered that it had a ‘wrong’ battery reading.

The Temperature and RH readings seems to be fine.

I am happy to learn how to reload the sketch, but needs some beginners clues how to do that.

P.s. I have another thread only trying to figure out how to change the node name on emoncms.org (totally new beginner here)

Thanks for your help.

You need:

  1. A programmer
    (Those from other places might or might not work out of the box.)
  2. The Arduino IDE & libraries. The instructions to get yourself set up are in ‘Learn’, under “Using the Arduino IDE”.
  3. The sketch. Get the whole “src” directory from emonth2/firmware at master · openenergymonitor/emonth2 · GitHub
    and move it complete with contents into the “sketchbook” directory of the Arduino IDE.

Beware connecting the programmer. The connector is not polarised, line up “GND” on the programmer and emonTH.
The main sketch is (confusingly) src.ino, but config.ino is part of it and is included automatically. Compile and upload.

Click the ‘pencil’ icon, rename it, click the tick.

1 Like

Ok, that’s helpful! I google that I came upon this:

So, since this is a emonTH on node 30. I will also need to adapt the src.ino into node 30 right?

I guess I will need to get one of these programmers first! Thanks.

P.s. I saw your reply on my renaming thing… I think we misunderstood what I wanted to rename… it is the node’s name on emoncms.org (not emonPi).

Ok, I am getting there. Spend quite some time on your forum and websites now. Came across an upload tool, which simplifies my life:

Have asked for ordering the programmer tool. Was tempted to get something from amazon, but relented to avoid any difficulty. (Also couldn’t really find anyone on the forum sharing alternatives).

Hope it works.

@Robert.Wall

I followed instructions here about compiling. I followed until step 4 and 5. Step 4 (building/compiling) I get ‘issues’

Compiling .pioenvs\emonth2\src\src.ino.o
C:/Users/Admin/Downloads/emonth2-master/firmware/src/src.ino: In function 'void loop()':
C:/Users/Admin/Downloads/emonth2-master/firmware/src/src.ino:452:19: warning: unused variable 'last' [-Wunused-variable]

unsigned long last = now;
^
C:/Users/Admin/Downloads/emonth2-master/firmware/src/config.ino: In function 'void save_config()':
C:/Users/Admin/Downloads/emonth2-master/firmware/src/config.ino:100:22: warning: comparison between signed and unsigned integer expressions 
[-Wsign-compare]
for (int i = 0 ; i < EEPROM.length() ; i++) {
^
In file included from C:/Users/Admin/Downloads/emonth2-master/firmware/src/src.ino:78:0:
C:/Users/Admin/Downloads/emonth2-master/firmware/src/config.ino: At top level:
.piolibdeps\JeeLib_ID252/RF69_avr.h:122:13: warning: 'spiInit' defined but not used [-Wunused-function]
static void spiInit (void) {
^
.piolibdeps\JeeLib_ID252/RF69_avr.h:154:16: warning: 'spiTransfer' defined but not used [-Wunused-function]
static uint8_t spiTransfer (uint8_t cmd, uint8_t val) {
^
C:/Users/Admin/Downloads/emonth2-master/firmware/src/src.ino:480:13: warning: 'writeReg' defined but not used [-Wunused-function]
static void writeReg (uint8_t addr, uint8_t value) {
^
C:/Users/Admin/Downloads/emonth2-master/firmware/src/src.ino:484:16: warning: 'readReg' defined but not used [-Wunused-function]
static uint8_t readReg (uint8_t addr) {
^

I am not sure why this happens, than when I upload, it adds more stuff on it, see below:

^
Linking .pioenvs\emonth2\firmware.elf
Checking program size
Building .pioenvs\emonth2\firmware.hex

text       data     bss     dec     hex filename
14808       468     629   15905    3e21 .pioenvs\emonth2\firmware.elf
 [SUCCESS] Took 28.96 seconds
 
 [SUMMARY]
Environment emonth2             [SUCCESS]
Environment isp                 [SKIP]
Environment emonth2_deploy      [SKIP]
 [SUCCESS] Took 28.96 seconds
Uploading firmware remotely
Could not find active agents. Please start it before on a remote machine using `pio remote agent start` command.
See http://docs.platformio.org/page/plus/pio-remote.html

Could someone help?

OK, a bit of false alarm.

You have to click UPLOAD and not UPLOAD TO REMOTE. So the manual is not correct anymore, and the upload icon is now defaulted to ‘upload to remote device’.

remote

remote2

Well @Robert.Wall, I managed to upload the firmware with the above mentioned warnings. The emonTH then shows 3.1V!!! But that is only for the first input, the second input after 60s, it reverts back to 1.5V. So no luck here, do you have anymore recommendations?

I can’t use platformio, so I’ve no idea what is happening with that. You can however ignore the warnings, some are things that ought to be tidied up but have not been, some are simply saying there are library functions that you’re not using.

That is weird!
Have you a second Node 30 on the system?

Where are you reading 3.1 V as the first reading, then 1.5 V afterwards? Is it at the Serial Monitor via the FTDI connector, or via your emonCMS? (You should see “batt:31” for 3.1 V in the Serial Monitor.)

[Edit]
If you’re seeing 3.1 V then 1.5 V at both, try copying this line (442)

      Serial.print("batt:"); Serial.print(emonth.battery);

and put a copy immediately below line 385, to give you:

    emonth.battery=int(analogRead(BATT_ADC)*0.0322);                    //read battery voltage, convert ADC to volts x10
    Serial.print("batt:"); Serial.print(emonth.battery);

If you get 3.1 V from the this new print, and 1.5 from the original, there’s a problem with the voltage being changed after it has been read.

Thanks @Robert.Wall

I deleted my previous post, which was a bit of sharing my exhaustion to get the serial monitor to work (which didn’t). But of course one minute after I posted I found one (solution documented/shared here).

  1. no we do not have another node 30

  2. previously I only read from the emonPi. currently I can read this:

  3. after you I updated the firmware with your suggestion I get this:
    Capture

In both cases the first reading is 31 (or 32) and then subsequent reading is 15.

So… (hardware) broken?

That could be a possibility. I cannot see or think of anything to explain what’s happening - especially as everything else seems to be working. Let’s see what @glyn.hudson has to say.

At least we know the value isn’t being changed between reading it and transmitting it, so the software seems to be OK. It’s almost as if the scaling factor - the “0.0322” in
emonth.battery=int(analogRead(BATT_ADC)*0.0322); is being changed, or it’s reading something else, after the first time it’s sent, but I can’t see how that can happen.

@glyn.hudson anything you could help us with this?

Am I right in understanding that this issue only effects 1/8 of your emonTH’s? If so it sounds like a hardware fault issue. Please contact shop support: [email protected]

@Gwil I hope you received the emonTH unit back from me! Let us know if you find any causes for that emonTH.

Thank you, we received the board. We loaded it with the latest sketch (V3.2.3) and it looks to be working fine - the battery voltage readings are correct:

Does it continue to show 3.2 V? @Amaravati reported the first reading correct, then it dropped to 1.5 V.

1 Like

Ok, we’ve been logging it to a feed and it is reading 1.6V consistently - we are seeing the same thing happen.

3.0 initial = 1.5 subsequent
3.2 initial = 1.6 subsequent

Looking closely at the board, pins 8 and 9 of the atmega 328 are not in contact with the board.