Hot water tank temperature monitoring

Both to the computer or in a chain PC → Programmer → emonTH

Apologies, my edit was still not clear enough. Yes, as a chain, making sure I have the pins aligned correctly (ground to ground).

1 Like

Did you download the sketch from Github, have you edited it and have you put it into your “Sketchbook” (Arduino-speak for the directory where the IDE expects it to be, or a sub-directory thereof. Where’s that - where you set it: File →Preferences)?

If it is there, you need to get it into the IDE (File→Sketchbook → follow the tree to where you put it), and then compile and upload it (Sketch →Upload using programmer).

(You can edit using the IDE - I prefer my trusty Notepad++ .)

Ah, I was under the impression that I needed to pull the existing sketch from the device first (is this possible?).

I have the amended sketch ready to go in my text editor* but I haven’t added it into the IDE yet, as I was trying to overcome what I thought was the prerequisite hurdle first.

Can you confirm that the Board and Programmer options are on the correct settings before I attempt an upload?

Thanks, all, for your help.

[*I used to use Notepad++, but discovered Visual Studio Code a couple of years ago - it’s fantastic!]

1 Like

No, it’s not possible. The device has only the compiled code, not human-readable source.

“Board” is Arduino Uno
“Port” is whatever appears and disappears when you plug in and unplug the programmer (USB end from the computer)
“Programmer” doesn’t matter for this - mine is set to AVRISP

I gave up on Windoze when I got this machine with Windoze 8 on it. Enough said.

If that refers to VSCode, it is multi-platform (and open source IIRC) even though it is an MS tool.

My “daily driver” is a Mac, but I use Windows and Linux as well on a daily basis. To be honest, they’ve all reached a parity in my view and the GUIs all the look the same to me these days.

Yes, the thing I love about VS Code is the cross-platform nature so I don’t have to keep interrupting my muscle memory. And, MS have indeed open-sourced a lot of their projects these days - who knew! The MS of today is very different to the MS from Windows 8 era (I used to share your reservations…).

Compilation error:

Line 101:

#include <SI7021.h>

Can’t find mention of this library on either the Learn page or the V1.x or V2.x GitHub pages.

Searching GitHub globally yields 13 different repos that have it and Google has countless more results.

Any idea which repo has the correct library I need?

Edit:
There are references to AdaFruit’s libraries throughout OpenEnergyMonitor repos, so I would I be correct in assuming this is the one to install?

Edit2:
Apparently not. The filename is different and it specifically says it is only for their own board.

I don’t have an emonTH V2, and G&T appear to have omitted a link from the top of the source file. I think the Adafruit one is more likely than most to be a valid choice.

Let’s ask @Gwil
Where is the library for the SI7021? There’s no mention of it and no link in the comment at the top of the source file, where it should be.
[Not everybody can or wants to use platformio - it screwed my system up for a start.]
Then, can you add it to the tables in Learn→Electricity Monitoring→Using the Arduino IDE for all 3 OS’s please?

I think it may be this one.

In the platformio.ini file it mentions a hash on line 28:

Si7021 @c5ce0922ef

Searching PlatformIO libraries for SI7021 leads to this one which mentions that hash as a version number and includes a link to the above GitHub page.

Reckon my detective work checks out?

I can’t see a copyable link there - I’m now very, very suspicious of anything related to platformio, having been badly burned by it.

[Edit]
Looks like it’s stolen from LowPowerLabs…
[Edit 2]
And that’s 500 / 504 to me.
I can get to GitHub - LowPowerLab/SI7021: Si7021 temperature & humidity sensor arduino library and that’s all.

Yes, GitHub is down for me as well. I managed to have a look at it but, alas, I was too late to download the repo zip file, so I shall have to wait :timer_clock: :roll_eyes:

I shall take heed and stay away from PlatformIO (I didn’t want to have to learn how to use yet another tool to get this job done anyway!).

Thanks for confirming my hypothesis nonetheless.

Very wise.

I keep a local download of the Git stuff that I need, and don’t allow it to update my working files. I have a script to do that.
I downloaded and installed platformio, looked at it briefly, thought (like you) ‘Hmm… yet another IDE to have to learn’; then continued with my old ways as there was stuff I needed to get on with. In the process, I ran my script to update my Git copy and there were errors all over the place - it seems that I’d told platformio to USE those as sources and instead it MOVED the directories, causing my script to fail. That’s the behaviour of malware, in my book. Platformio got deleted double-quick. Then I had a few hours restoring everything to their rightful places. :rage:


I’ve managed to download the raw files now, but can’t do any more for a while.

[Edit]
Yep, as I suspected. The platformio files are byte-for-byte identical to the LowPowerLabs
SI7021.zip (3.1 KB)

If you then get an error about “ShowString”; here is what to do: Arduino IDE compilation errors

Oh boy, this is a world of pain.

Next compilation error (not one listed on your thread):

Line 202:
'load_config' was not declared in this scope

The full error message is attached (I can’t see how to paste it into a preformatted text box on this forum): error2.txt (3.5 KB)

Looking at the repo (emonth2/firmware/src at master · openenergymonitor/emonth2 · GitHub), load_config is declared in the config.ino file.

Maybe this file should be a header file - then included in the sketch?

The file should be in Github, alongside the main source file. Download it and put it in the same directory.

In fact, you should have downloaded both files together and kept them in the same directory, as both are needed. (And I agree, the Arduino world is dumbed down, seemingly to make it harder for those of us used to ‘conventional’ edit - compile - link cycle.)

config.ino is intimately bound to the associated main sketch, even though all the config.ino’s are similar. The function is to initialise the sketch, either with values retrieved from EEPROM or from the user via the serial interface.

I suspect it was Glyn who decided that the functions should be in a separate file rather than included as part of the main file. It makes sense to me, the ‘config’ happens only at startup, thereafter the main file runs on forever. But there’s no technical reason that I know of to necessitate a separate file - the dedicated functions (i.e. most of the config.ino file) can’t be shared with another sketch.

No joy, exact same error message as before.

Arduino IDE seems to recognise the config.ino file exists though, it automatically opened it as a new tab next to the main sketch file.

It still thinks “‘load_config’ was not declared in this scope”?

I’ve put the SI7021 library into my libraries directory and compiled my emonTH_V2 on the second try - after declaring ShowString.

load_config( ) is the first function in the file - it is there, isn’t it? If it isn’t, you must have the wrong config.ino.

You are compiling the main file for the emonTH_V2 (unfortunately it has the decidedly non-unique name src.ino)? It starts with the comment
emonTH V2 Low Power SI7021 Humidity & Temperature, DS18B20 Temperature & Pulse counting Node Example
and the last change was
V3.2.1 - (30/11/16) Fix emonTx port typo

@Gwil, @glyn.hudson

I see an error in config.ino, lines 44-48. The curly brackets are wrong, they should be deleted. As it stands, if a value is not set for case ‘i’, it falls through to case ‘b’. It only “works” and doesn’t cause a problem because bandToFreq( ) returns zero and the if in case ‘b’ also fails, but it’s a problem in waiting.

      case 'i': //set node ID
        if (value){
          nodeID = value;
        break;
      }

should be

      case 'i': //set node ID
        if (value)
          nodeID = value;
        break;
      

alternatively

      case 'i': //set node ID
        if (value)
        {
          nodeID = value;
        }
        break;

but the brackets are not strictly necessary.