OpenEnergyMonitor Community

Feedback on my setup using an existing pi with emonTX connected directly via serial cable in the US with a PV system

Tags: #<Tag:0x00007f1bd6fdc408> #<Tag:0x00007f1bd6fdc278> #<Tag:0x00007f1bd6fdc0e8> #<Tag:0x00007f1bd6febf70>

I believe I have a different installation from the typical setup. I installed emoncms on an existing pi to interface with my US PV system. I had some issues getting setup and with help from the community I have a stable setup. The next part I have to do is compare the emoncms data with that reported from my electric supplied but I suspect it will be a few more weeks before I get the right data from them.

Install emoncms from github
Connect tx to tx
Set baud rate to 115,200
Configure emonhub
Set timezone for user
Configure inputs, feeds, schedules etc.
Remove tx connection - problem when emontx reboots
Add redis-cli flushall command to apache startup

My System
I have a solar photo voltaic (PV) system. Originally the vendor had a good site for tracking usage. However recently it has been extremely unreliable. I’d previously looked at emoncms and came back to it for my own system. I already had a bunch of raspberry Pi’s so I figured I didn’t need another one … I also have a bunch of 1 wire accessories installed using cat 5 cable. I figured I could use unused pairs for the emontx rather than using a wireless system.
I already had MariaDB installed. I had an older version of emoncms installed, which caused a bit of a headache. I used the instructions on github to install the latest version of emoncms.

Serial Connection
When I started, I figured it made sense to start conservatively with a small cable run. I decided to use screen as the application to use for checking the communication.

As it turns out the first mistake I made was not to read some of the pages online that state that the markings on the emontx for tx and rx are actually referring to the connecting device - unlike the typical nomenclature. So, I was connecting rx to tx, and tx to rx.

The next issue I discovered is that there are pages on the site that state a 9600 baud rate. This gave me garbage on the screen and I figured I should try different settings. I later saw reference to 115,200 - that fixed it. I had also seen that the tx connection was not needed - but for calibration the easiest way is to use the tx connection and update the emontx.

Having established connection, I went to calibrate the emontx. I used 4 CT from eBay that accommodated the larger supply cables into my fuse box. I used all 4 on the same cable connected to a kettle. I had previously bought a clip-on current sensor (to voltage) for a digital multi-meter, and added this to the cable. I actually used an Excel spreadsheet to help me work out the factor to set for calibration.I did find the latest firmware had different options from the web pages. I found it difficult to get into the setup (cr/lf needs to be sent to the emontx). When I did get in I, realized I didn’t need to change anything after all.

After that I moved the emontx to the fuse panel, put the CT on the 4 cables. I’d seen it mentioned on the site, so I made sure the arrows were in opposite directions. Of course when I powered it all up, I was getting negative values so I switched the transformers round. Incidentally, I later moved the transformer and it took me a few hours to notice that my inputs were all inverted! Unlike the UK, US plugs are often ungrounded and can be inserted either way. Almost on a whim I tried rotating the transformer and hey presto, the inputs reverted to the correct state.

This shows the electric panel. The white Current Transformers are connected to a zwave network and smartthings hub; I obtained that through the electric company by participating in a study - the monitor is pretty useless though :slightly_smiling_face: The black square CT’s were installed by my solar company.

Software configuration
Now I was getting the correct output over the serial connection, l had to configure emonhub. That was pretty straightforward. That said, I tried to switch the com port to the more typical /dev/ttyS0 and thought I had that all set, but on a reboot it resorted to /dev/ttyAMA0

### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
### This interfacer manages the EmonTx3 ESP format serial
     Type = EmonHubTx3eInterfacer
           # default com port if using USB to UART adapter
           com_port= /dev/ttyAMA0
           #com_port= /dev/ttyS0
           com_baud = 115200
           #nodeoffset = 1
           # nodeoffet can be used for multiple devices. it will change the nodeID as seen by emonCMS Inputs.
        pubchannels = ToEmonCMS,

Lessons Learned
Then configure emoncms. I made a mistake that my user ID was not the correct time zone. That was to cause issues when I setup some schedules.
I originally had tx, rx and ground connected. However, with the tx (from the pi) connected, on the emonhub restarting, it seemed to put it in to setup mode. As the emonhub in normal operation is just pushing data to the Pi, the receive line is not needed. I now just have the ground and the pi receive line connected.

After a power outage, I had an issue where the redis feeds were duplicated. This is a noted issue on the forum and the resolution was to run redis-cli flushall, however this removed the associated processing. I had a fairly significant setup of rules and had to recreate those (helped by looking at MariaDB contents). I have now added the redis command to my script that starts apache

            /usr/bin/redis-cli flushall
            $APACHE2CTL start
            apache_wait_start $?

Other stuff
Thanks for all the work that has been put in to the application and the hardware. I now have the system setup for various things. I have the solar app that shows usage. I’ve created a dashboard that gives a report for the bill month. This is reset by a cron job that fires at midnight of the when the meter is supposedly read.
I have also set up a 15 minute feed of KW/hr usage - my utility is supposed to show 15 minute usage and I want to compare the values between emoncms and the utility. Unfortunately the utility data isn’t currently available :roll_eyes:

1 Like

Thankyou for sharing your feedback @montgomeryb, nice configuration!


@montgomeryb is the second user in barely more than that many days who has been caught out by the mislabelled Tx and Rx lines on the emonTx - the first. I’ve lost count of the number of times I’ve explained it here, but the complaints continue to come in. It’s in the FAQ, it’s in many forum answers, but can the warning be put in more places where more people are likely to see it and heed it? For instance, there’s no mention that I can find in the Guide, the only mention I can find outside this forum is the Wiki.

1 Like

Thanks @Robert.Wall noted. Will add to the guide.