Community
OpenEnergyMonitor

OpenEnergyMonitor Community

Three Phase kWh data logger using emon tx- base

Tags: #<Tag:0x00007f1bd6db3d98>

I need a Kwh data logger which will record half-hourly kWh data for a period of 6 months or more to local storage.

This will be for a number of different solar PV projects in West Africa, so the system must not require any internet connectivity. in some locations, there won’t even be a cellular connection.

I am happy to manually retrieve the data from the site so do not require any remote monitoring.

Some sites are three-phase, 4 wire I believe but would be good to have 3 wire capabilities.

Can someone provide advice on the best solution please? im new to the open energy monitor kit, and not handy with a Raspberry Pi.

Our standard offering is unlikely to fit your requirements exactly, but with a few small modifications I think we could solve your problem.

I would propose an emonTx V3.4, with a wired serial connection to a Raspberry Pi.

The emonTx with the standard software is most likely not capable of averaging over a 30 minute period - our normal averaging period is 10 s, but our standard single-phase sketch already sends the accumulated Wh values every 10 s, and with a small addition to the code, the 3-phase sketch can do likewise. The 3-phase sketch can be set up for 3-wire (treating the supply as 2 phases & neutral) or 4-wire systems.

The Raspberry Pi would run our logging and display software emonCMS, and record the data to its SD card (and, if an Internet connection is available, to a base server somewhere in the world also running emonCMS). emonCMS is already capable of recording data at ½-hourly intervals, so you would have on record the accumulated value every half hour. emonCMS is available from the shop on an SD card, or you can download an image and flash your own SD cards, as you prefer.

So for each installation I think you need:
1-off emonTx
1-off a.c. adapter to suit the local voltage - line-neutral for single phase and 4-wire 3-phase, or line-line for 3-wire 3-phase,
1-off, 2-off or 3-off current transformer as appropriate,
1-off Raspberry Pi & case
5 V Raspberry Pi power supply
1-off emonCMS on a SD Card
You will need to make up a 3-wire serial connection to connect the emonTx to the Raspberry Pi.

To load and configure the emonTx’s and set up emonCMS
A portable computer with the Arduino IDE loaded,
1-off Programmer & lead.

Depending on the quality of the electricity supply you are monitoring, you might like to consider a battery backup/UPS for the Raspberry Pi. I’m afraid I have no experience of those, so I cannot advise you, but I think one of my colleagues here might be able to help in that regard.

As Internet time won’t be available, you might also want a real-time clock on the Raspberry Pi too.

The EmonCMS Agile App, generates half-hour data. I was going to suggest to @TrystanLea, that there could be a means of downloading this half hour data which would then suit this need (although the 6 months may be a challenge as it will be a large data set).

Perhaps a post-process method @TrystanLea?

1 Like

Thanks a lot for your considered reply,

yes, 10 second data would be fine I can post-process, what file format does the data come in on the SD card?

OK, so I would need a to modify a raspberry PI so it has an internal clock and a backup power supply?

Could you provide the rasbery PI with the software preloaded, or do i need to buy this separately?

The power on-site is unreliable so will be turning off several times a day, what impact would this have on the raspberry pi if there is no backup power supply? obviously, data is only required when the Raspberry Pi is on, but i guess if no internet time is available then the time stamp will be incorrect.

I’m not too great with raspberry Pis and all that more a power systems engineer. How much knowledge will i need to set this up and working,

Also, once it has been set up once, how easy will it be for others to use, if given instructions? as several different people will use this kit with varying knowledge.

Thanks again

Ah, I didn’t realise that you could do that, in which case an absolutely standard installation (as far as the emonTx and emonCMS itself is concerned) will be fine. Given power values, emonCMS can process those into accumulated Wh or kWh and store those. The data format is our own, fully documented in the ‘Learn’ section here. Learn→Electricity Monitoring→Timeseries

That is what I anticipated. “what impact” - in short, I think a very bad one - quite possibly fatal for the card and any data on it, so a UPS that can do an orderly shutdown of the Pi would be a very sensible precaution, probably necessary. And I presumed that accurate time stamps would be at least desirable, if not necessary also.
I’m not sure how the PHPFINA database would cope, I suspect you would need the timeseries one. @TrystanLea ?

I was drives and controls principally, before I retired. Some knowledge is the honest answer. Setting up emonCMS is reasonably straightforward once you’ve cracked the basic thinking, but I’m not an emonCMS expert, so I can’t tell you too much about the niceties and details. And a basic knowledge of the ‘C’ language will help when customising the emonTx.

As for others using - it depends on how good the instructions are and what they will be doing! If it’s a matter of taking the SD card out of the Pi and putting a new one in, then all they really need to know is not to pull the card out until the Pi’s been shut down properly, which can be done from the Web interface, or which an intelligent UPS should do for you.

Would i need to customize the emon Tx for this application?

For the single-phase installations, the default sketch should work ‘out of the box’.

For the three-phase, there are just too many variables for that to work. The way the software is written, it’s the same program for all options. You need to choose which you need, edit a setting and then compile and upload to the emonTx.

E.g. for 3-wire or 4-wire, that particular switch is

#define WIRES 4-WIRE      // either 4-WIRE (default, measure voltage L1 - N) or 3-WIRE (no neutral, measure voltage L1 - L2)

so for a 3-wire supply, you change it to

#define WIRES 3-WIRE      // either 4-WIRE (default, measure voltage L1 - N) or 3-WIRE (no neutral, measure voltage L1 - L2)

(Any other way, and it could be a case of which one to choose out of many dozen (if not more), if all the possible combinations were each a separate sketch.)

Thanks again for your support,

So in summary I could use the EmonTX + Pi solution. but I would need to add an internal clock and UPS to the Pi my self (you cant support on this)

and the user would need a laptop and basic C programming skills to set it up at each site, selecting between 2 wire 3 wire or 4 wire supply.

Cheers

I think a real-time clock would dispense with any doubts about the time period that a set of samples belonged to. I don’t know anything about that nor the UPS, but there are people here who have done that - maybe not the same person though.

and many other parameters - some might always be correct for all sites, some might not. Will the same set of equipment travel around, or will you have several sets? If the latter, a “3-wire” set and a “4-wire” set could make things easier, and of course you could set up any number of sketches and just load the right one -assuming you know the conditions at each monitoring site.
.

Search on this forum for “RTC” for idea’s there. There are serial and I2C based RTC’s, the gpio serial port is used on both an emonpi and emonbase. The I2C is also used on a emonpi, but it is still possible to do. There is a header on the emonpi board specifically for a I2C RTC and a guide in the wiki on how to fit.

Some I2C RTC can be fitted over pin’s 1,3,5,7,9 of the Pi’s gpio directly or piggy backing a rfm2pi type board with a bit of soldering. I’ve done it and there was also a more recent discussion on here to about fitting “stacking” headers to an RFM2pi to accommodate an RTC.

Regards UPS you can again search on here, many people use a variety of devices. For many years I have used a Yuasa burglar alarm type lead 12v battery and mains trickle charger to power my 5v devices via a voltage dropper and my main WiFi router via 12v so I stay connected in a power cut. I also only charge the battery during off peak or spare pv production :grin:

1 Like

I would suggest using a serial connected setup rather than an RFM one and the 2IC version of an RTC alongside.

I’d suggest powering the Pi and the EmonTX separately so the UPS only drives the Pi (Zero)

Advantages

  1. you could edit, complie and load the Firmware locally (need to do it the first time with internet connection)
  2. Cheaper (no RFM board)

Disadvantage

  1. None I can think of (but could be wrong)

For UPS, depending on time off, I’d use a LiPo setup. https://uk.pi-supply.com/products/pijuice-standard

This comes with an RTC as well so it would be perfect.

Julian posted a good write up of what he did. Avoiding wireless connections - EmonTX serial RPiZero solution

The only difference is not connecting ground and power via the UART.

1 Like

Agreed, unless there’s a requirement to know the behaviour of the supply as it dies and comes back.

1 Like

As mine does, I get a notification if the power is off more than 20mins, but no point in doing that unless there is a route out, e.g. gsm or the lan is still up as is the case with mine. Still, keeping record of outages may come in useful if they ever become too frequent.

Except you would have that as there would be no data recorded by EmonCMS and I think that PiJuice sends messages to the Pi telling it, which again could be logged.

The main downside I was thinking of was that powering both would shorten how long the UPS ran for.

That is only really an issue if you have limited UPS battery, many “PI UPS” only have enough juice to run the Pi alone for a few minuets, just enough time to do a proper shutdown. In that case yes. But the emontx draws so little that if you have a decent size battery not powering the emontx will only add a few more minuets maybe an extra 10% if you’re lucky. With mine powering the router too, it makes next to no difference if an emontx is connected. I matters of course what the emontx is doing, if it’s got 6 temp sensors and pulse counting with RFM then possibly an issue, but serial connected CT/VT monitoring only, with no rfm is negligible. If the emontx is serially connected, it would be better to treat them as a pair (one unit) or the emontx powering down might upset emonhub, plus that would mean separate supplies too.

That isn’t a good habit unless confirmed by something else (eg if PiJuice does send notice etc) because any missing data would then suggest a power outage and become less reliable.

But much of this might be considered OTT it depends on your needs/wishes and how much you are willing to put into it (effort and expense).

I only went the route I did because it seems forever for the LAN to comeback up after a micro outage and I was running a Pi + hdd emoncms server for many sites, so downtime was a consideration. I have since moved the server to the cloud and used the UPS setup for my IoT.

The current drawn by the emonTx, using…

Absolutely. The emonTx will draw about 8.5 mA continuously, add about 1.5 mA while the LED is flashing, assuming you don’t use the radio. If you do add the radio, add a further 16 mA for the 8 ms while it transmits the data once every 10 s.

2 Likes