EmonTx data over ethernet sketch

I bought two emonTx shields years ago (made Oct 2013) and I would like to use them to send data to your server via ethernet rather than wirelessly. Which sketch should I use for this? I need to monitor all 4 CTs (Two for solar and two for load, I am in the US 240V system). The shield is mounted over the ethernet shield over Arduino Uno. Grateful if you could point me in the right direction.
Thanks!

Have you tried searching? The search in the top (dark blue) banner showed many archived posts, this looks promising, particularly Martin Harizanov’s:

The Wiki linked in Glyn’s post is now at EmonTx Arduino Shield - OpenEnergyMonitor Wiki

Hi Gab,

Do you have more than one PV array?
If you have only one array, and it’s a 240 Volt system (i.e connected to both hot legs as opposed to one hot leg and the neutral), then you only need one CT to monitor PV production.

Assuming it feeds in at 240 V, which is probable, but might not be guaranteed.

Post edited.

He mentioned a 240 Volt system, but that could be either the grid or his
PV system he’s talking about, so I changed my post to eliminate the ambiguity.

Thanks to all. So the question is really about a sketch to allow the emonTx to work as a shield over the ethernet shield on arduino. I had already found Harizanov’s link but it applies to a specific board which has ethernet built in. I use a standard W5100 ethernet shield, which plugs over arduino (a much more common setup). No RF transmitter chip installed on my emonTX (I do have a second one with the RF installed.
As for the domestic voltage in the US, we get 2 phases and a tap in the middle (240–N—240), providing both 240V and 120V across the tap (neutral) and each of the phases. You must measure BOTH 240V legs to get the full load and supply picture.

Just to avoid confusion for anyone reading your post no.5 above, your US supply is 120 - 0 - 120 V, so there is 120 V either leg to neutral, and 240 V across both legs.


As far as I know, there isn't a specific sketch for your configuration. Some years ago, I chased down a conflict with a particular make of Ethernet Shield, resulting in the paragraph "Arduino Compatibility". That's really all I know about Arduino and Ethernet.

(And note that the emonTx and the emonTx Shield are totally different beasts - the emonTx has the processor on-board.)

In the absence of a better suggestion, “Shield_CT1234_Voltage_SerialOnly” is probably your starting point.

True the two emonTxs are very different and you are correct on the voltage.

True for the load, but if your PV system is connected 240V,
i.e. not 120V, then you only need one CT to monitor your PV output.
(I’m in the US too. I monitor my PV system with a single CT)
I use a total of three CTs. Two on each Service Entrance Wire, and one on the PV backfeed.

The US residential electrical supply is a single phase split into two legs, hence the term split-phase.

That code Robert referenced above looks like a good starting place, just remove the RF stuff and use the Ethernet stuff.

For the most part, when Arduino board vendors do that, they keep it compatible with the Ethernet shield approach so that all the existing libraries and sketches work. There may be some minor jumper tweaks for /CS pin selection, but the bulk of the Ethernet code from that pointer above should be close to what you need whether you’re using a shield or an Arduino with on-board Wiznet.

There’s one gotcha: (taken from the page at the link above)

I used “Arduino Ethernet”, this is an Arduino with in-built ethernet for this project, not an Arduino Ethernet shield. The Arduino Ethernet Shield has a nasty bug that prevents other SPI devices from working correctly, this bug is addressed in the “Arduino Ethernet”. The bug can be fixed with hardware modifications of the Arduino Ethernet Shield with SD, see the links I provided, but this is no easy task. Alternatively you can use the Freetronics Ethercard that uses inverted PB2 CS pin (Arduino digital pin 10) to drive the W5100 SEN pin, thus allowing other devices to access the SPI BUS when SEN is low

Something to be aware of in case the use of other SPI devices is desired.

This statement is from 2012, though. Does it apply to later revisions of the shield? My hunch would be that since the bug has been addressed in the Arduino Ethernet, it has also been addressed in current versions of the Ethernet Shield. But I’m new to this, so I’m not sure.

In any case, I thought this might be of interest here:

See also here:

Thanks @Wouter_Jansen!

1 Like