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).
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
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’.
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)
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).
no we do not have another node 30
previously I only read from the emonPi. currently I can read this:
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.
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]
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:
Obviously the one that got away during manufacture.
The crystal and D5? So how was it appearing to work at all? (@Amaravati never mentioned an external DS18B20, so I assume D5 not connected made no difference.)
But why/how an apparently correct first reading, then about half what it should be? That I don’t understand.
@Gwil - it possible you are counting the pins clockwise from the “pin 1 corner marker” so you are looking at pins 25 and 24, which makes more sense since ADC1 (batt voltage) is on pin 24 (the 9th pin clockwise).
Thanks for reporting back @Gwil, good to see there was indeed something not properly connected on the board. It was rather strange to have a first ‘correct’ reading, and subsequent wrong readings…