# 4 CT emonBase using emonTx and Pi Zero W

**URL:** <https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580>\
**Category:** Hardware\
**Created:** [14 February 2018 18:53 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580 "2018-02-14T18:53:40Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [24 February 2018 13:25 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/21 "2018-02-24T13:25:19Z")

</div>

> [@Bramco](#):
>
> Is there a case for having a short cable to allow for more flexibility in positioning the emonESP or PiZero?

For completeness, I have a short (200 mm) length of ribbon cable with 6-pin header plug to header socket, which I always use on one end of the programmer to allow it to be not ‘fixed’ to whatever while I’m using it, and a USB extension lead on the other end.  
OK, my use case is probably different to most because my almost exclusive use of all emon kit is either answering problems here or developing sketches.

---

<div class="post-metadata">

**Author:** ![Bramco](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/b/34f0e0/32.png) [@Bramco](https://community.openenergymonitor.org/u/Bramco)\
**Post date:** [25 February 2018 12:18 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/22 "2018-02-25T12:18:16Z")

</div>

> [@pb66](#):
>
> I used the extended “stacking” headers because I didn’t want the Zero flapping around, I was looking for a more ridged attachment with the WiFi antenna held high and away from the metal case

Might be interesting to test it with the zero strapped to the case of the emonTX just to see if there is any issue with the wifi. Although fully understand the concept of having the zero fairly rigidly attached to the side of the TX

> [@pb66](#):
>
> The description, price breakdown and the pro’s and con’s should tell users more about what is or isn’t included. eg the emonESP isn’t cased

Good point, might be an idea then to have some indication (\*) to show that some configurations can be DIYed at a lower cost.

> [@pb66](#):
>
> I would rather pay an extra £7 with my initial order and have it to hand if the need arises, rather than paying £10 and waiting for it to arrive after having discovered I need one whilst trying to install or debug an issue.

Hmmm - not sure about this one. It should certainly be an option on the configuration drop down when you are ordering and something to indicate it might well be a useful option. The emotional difference between £7 uplift when you are ordering and maybe don’t yet realise you need it and the £3 difference when you do find you need it isn’t comparable for me. Folks might not even notice the £3 extra it has cost them when they find they do need one. But let’s leave that to Trystan and Glynn.

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [29 March 2020 14:18 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/23 "2020-03-29T14:18:01Z")

</div>

> [@pb66](#):
>
> I would like to explore whether we can get 4ct’s and a RFM base running on an emonTx, If we can I would like to try @Robert.Wall’s unitless CM lib with a close coupled connection between the Pi and the Tx so the Pi can do all the calibration and phase correction calculations whilst the Tx focuses on just continuous sampling and RFM reception.
> 
> The Pi can handle multiple pulse counters which the emonTx(due to limited interrupts) and emonPi (due to no easy access to the gpio) cannot. [One of these](http://cpc.farnell.com/tuk/skh4/cat-6-surface-mount-socket-4-port/dp/CS3077007?ost=cs3077007&ddkey=http%3Aen-CPC%2FCPC_United_Kingdom%2Fsearch) would allow easy “plug’n’play” connection of up to 4 optical pulse counters or temp sensors. I’ve already done separate Python scripts for [2 optical pulse counters](https://community.openenergymonitor.org/t/directly-connecting-to-optical-pulse-counter-with-rpi/1294) and for 18x ds18b20’s so if we can get emonHub rolling again these new interfacers wouldn’t be hard to implement at all.

Now I have found this thread (no idea why I would not remember it), I’m reviving it as I wonder if you did any more on this @Robert.Wall, @pb66?

I think it is a great idea and definitely worth looking at again @TrystanLea.

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [29 March 2020 14:45 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/24 "2020-03-29T14:45:57Z")

</div>

I did nothing further because it would involve big changes/additions to emonHub, and life’s too short to learn everything about everything.

If you’re going to move the greater part of the processing into the Pi, then it’s definitely worth, not pursuing, but looking at again in a fresh light with a view to doing the minimum - really only the data collection - inside the emonTx.

I’m still not sure how that will run with still handling serial data from the RFM, but it’s got to be worth a look.

---

<div class="post-metadata">

**Author:** ![haffle](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@haffle](https://community.openenergymonitor.org/u/haffle)\
**Post date:** [16 February 2021 16:02 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/25 "2021-02-16T16:02:17Z")

</div>

An embarrassingly long time ago I managed to get three RaspberryPiZero’s c/w emonTx boards to send data to my emonPi via wi-fi, but for some reason I could never get the fourth one to work for more than a day or two.

In case it was something to do with my wiring on the pins on the Zero, I have just set it up on a RaspberryPi 4 c/w emonTx board instead - using ethernet for now. I have only connected one CT lead, and the cable it is wrapped around is not powered up at the moment, so I would expect a zero or thereabouts value.

Within emonHub of the new Pi in the Barn, I hashed out all of the `RFM2Pi` section, and within the SerialTx section I gave it a `nodename = Serial_PiZero_topbarn` - which is what I called it last time. I didn’t turn the emonTx’s RF off as I didn’t get involved with the Arduino side of things, although I suppose it may have remembered that from last time?

Looking at my Inputs page on my emonPi, the node Serial\_PiZero\_barn is not updating, but a new node of rx is; what might the cause of this be?

Sorry if I am being dim (again), but it has been so long since I did all of this that I have forgotten some of the details … 😳

TIA

 ![Screenshot 2021-02-16 at 15.59.10](https://community.openenergymonitor.org/uploads/default/original/3X/0/0/00d23d66d20ce00a1e35c16e41f179bb9bf47060.png)

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [16 February 2021 17:20 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/26 "2021-02-16T17:20:59Z")

</div>

Dim? You’ve posted on an 11 months old thread, I can’t remember 11 days later 😧

I’m rather lost about what you’re doing. Remember, you know your setup, all we know is what you describe.

> [@haffle](#):
>
> In case it was something to do with my wiring on the pins on the Zero, I have just set it up on a RaspberryPi 4 c/w emonTx board instead - using ethernet for now.

Have you connected an emonTx to your Pi Zero W, hard-wired using serial, then you’re sending that by Wi-Fi to the RPi4 running emonCMS, which is also feeding into your LAN on wired Ethernet? What IP address and APIKey did you give it in its emonhub.conf?

> [@haffle](#):
>
> I didn’t turn the emonTx’s RF off as I didn’t get involved with the Arduino side of things, although I suppose it may have remembered that from last time?

If you have never turned it off, it’s on. If you turned it off “last time”, it should still be off unless you didn’t save the setting, in which case it will have reverted to the saved setting, or defaulted to on.

> [@haffle](#):
>
> a new node of rx is [updating]; what might the cause of this be?

Are we looking at emonCMS **NOT** on the RPi4 you mentioned earlier?  
Your emonPi is obviously receiving something from somewhere. If it’s in emonHub, it didn’t come via the LAN, and as it’s not wired, it must be by radio.

---

<div class="post-metadata">

**Author:** ![haffle](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@haffle](https://community.openenergymonitor.org/u/haffle)\
**Post date:** [16 February 2021 18:33 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/27 "2021-02-16T18:33:02Z")

</div>

Thanks @Robert.Wall .  
Instead of connecting a PiZero to an emonTx using 5 jumper wires & then communicating to my emonPi running emonCMS via wifi, for this Barn I have connected a RPi4 to the emonTx using 5 jumper wires, and then connect to the emonPi / emonCMS via ethernet. NB: I use a local emonCMS on my emonPi, not the “hosted” [emoncms.org](http://emoncms.org). I am not quite sure how to answer the “serial” bit of your question, unless using the jumper wires means serial.

The emonPi is 192.168.2.50, and the Pi4(/emonTx) is 192.168.2.54; this is the first section of the RPi4/emonTx’s Emonhub conf, which shows where I hashed out the RFM2Pi section, set a serialTx nodename and told it where my MQTT broker(?) is - NB: I use my emonPi for MQTT brokering.

```auto
#######################################################################
####################### emonhub.conf #########################
#######################################################################
### emonHub configuration file, for info see documentation:
### https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md
#######################################################################
####################### emonHub settings #######################
#######################################################################

[hub]
### loglevel must be one of DEBUG, INFO, WARNING, ERROR, and CRITICAL
loglevel = DEBUG
### Uncomment this to also send to syslog
# use_syslog = yes
#######################################################################
####################### Interfacers #######################
#######################################################################

[interfacers]
### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
#[[RFM2Pi]]
# Type = EmonHubJeeInterfacer
# [[[init_settings]]]
# com_port = /dev/ttyAMA0
# com_baud = 38400 # 9600 for old RFM12Pi
# [[[runtimesettings]]]
# pubchannels = ToEmonCMS,
# subchannels = ToRFM12,
#
# group = 210
# frequency = 433
# baseid = 5 # emonPi / emonBase nodeID
# calibration = 230V # (UK/EU: 230V, US: 110V)
# quiet = true # Disable quite mode (default enabled) to enable RF packet debugging, show packets which fail crc
# # interval = 300 # Interval to transmit time to emonGLCD (seconds)
  
[[SerialTx]]
    Type = EmonHubTx3eInterfacer 
    [[[init_settings]]]
        com_port= /dev/ttyAMA0
        com_baud = 115200 
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,

        nodeoffset = 0
        nodename = Serial_PiZero_topbarn

[[MQTT]]

    Type = EmonHubMqttInterfacer
    [[[init_settings]]]
        mqtt_host = 192.168.2.50
        mqtt_port = 1883
        mqtt_user = emonpi
        mqtt_passwd = emonpimqtt2016

    [[[runtimesettings]]]
        subchannels = ToEmonCMS,

        timestamped = True

        node_format_enable = 1
        node_format_basetopic = emon/

[[emoncmsorg]]
    Type = EmonHubEmoncmsHTTPInterfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,
        url = https://emoncms.org
        apikey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        senddata = 1 # Enable sending data to Emoncms.org
        sendstatus = 1 # Enable sending WAN IP to Emoncms.org MyIP > https://emoncms.org/myip/list
        sendinterval= 30 # Bulk send interval to Emoncms.org in seconds

#######################################################################
####################### Nodes #######################
#######################################################################

[nodes]<<SNIP>>

```

I don’t think I inserted my local emonCMS’s write API key anywhere with this RPi4 / emonTx.

I am 99% sure I did turn the TX’s RF off last time - and would have saved it, so I will assume for now that it is off.

> [@](#):
>
> Are we looking at emonCMS **NOT** on the RPi4 you mentioned earlier?  
> Your emonPi is obviously receiving something from somewhere. If it’s in emonHub, it didn’t come via the LAN, and as it’s not wired, it must be by radio.

The screen grabs in my earlier post are what shows within emonCMS on my emonPi, yes. If I look at the emonCMS Inputs on the RPi4 / emonTx, ALL are `n/a NULL`. This is a snippet of the emonHub log on the RPi4 / emonTx…

```2021-02-16
2021-02-16 18:28:47,948 DEBUG SerialTx 1096 Timestamp : 1613500127.947417
2021-02-16 18:28:47,948 DEBUG SerialTx 1096 From Node : Serial_PiZero_topbarn
2021-02-16 18:28:47,949 DEBUG SerialTx 1096 Values : [1098, 0, 0, 0, 0, 0, 0, 11]
2021-02-16 18:28:47,949 DEBUG SerialTx 1096 Sent to channel(start)' : ToEmonCMS
2021-02-16 18:28:47,949 DEBUG SerialTx 1096 Sent to channel(end)' : ToEmonCMS
2021-02-16 18:28:48,144 INFO MQTT Publishing 'node' formatted msg
2021-02-16 18:28:48,144 DEBUG MQTT Publishing: emon/rx/Serial_PiZero_topbarn/values 1098,0,0,0,0,0,0,11
2021-02-16 18:28:56,797 DEBUG SerialTx 1097 NEW FRAME : MSG:1099,Vrms:0.00,P1:0,E1:0,T1:0.00,T2:0.00,T3:0.00,pulse:11
2021-02-16 18:28:56,798 DEBUG SerialTx 1097 Timestamp : 1613500136.797482
2021-02-16 18:28:56,798 DEBUG SerialTx 1097 From Node : Serial_PiZero_topbarn
2021-02-16 18:28:56,799 DEBUG SerialTx 1097 Values : [1099, 0, 0, 0, 0, 0, 0, 11]
2021-02-16 18:28:56,799 DEBUG SerialTx 1097 Sent to channel(start)' : ToEmonCMS
2021-02-16 18:28:56,799 DEBUG SerialTx 1097 Sent to channel(end)' : ToEmonCMS
2021-02-16 18:28:56,983 INFO MQTT Publishing 'node' formatted msg
2021-02-16 18:28:56,983 DEBUG MQTT Publishing: emon/rx/Serial_PiZero_topbarn/values 1099,0,0,0,0,0,0,11

```

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [16 February 2021 18:59 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/28 "2021-02-16T18:59:08Z")

</div>

From the log…

> [@haffle](#):
>
> `Publishing: emon/rx/Serial_PiZero_topbarn/values`

Which is why you see what you do.

> [@haffle](#):
>
> ```auto
> node_format_enable = 1
> node_format_basetopic = emon/
> 
> ```

I was going to say you are using the wrong format `node_format_enable` because the topic it is published on says `emon/rx`, but you haven’t. I wonder if the Timestamped option is causing the issues.

`timestamped` doesn’t work for that format (I think) so try taking it out.

Alternatively, use the JSON format.

```auto
        # Single JSON payload published - use with Emoncms MQTT
        node_JSON_enable = 1
        node_JSON_basetopic = emon/

```

---

<div class="post-metadata">

**Author:** ![haffle](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/h/d07c76/32.png) [@haffle](https://community.openenergymonitor.org/u/haffle)\
**Post date:** [17 February 2021 09:48 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/29 "2021-02-17T09:48:07Z")

</div>

Many thanks @borpin - that has worked perfectly, and the data is coming through to emonCMS on my emonPi.

```auto
# timestamped = True

# node_format_enable = 1
# node_format_basetopic = emon/
        node_JSON_enable = 1
        node_JSON_basetopic = emon/

```

I had looked for where the node name **`rx`** was being created but couldn’t find it.

Next step will be to try to add thew wps\_supplicant file to the microSD card, and swap out the Pi4 for a PiZero.

EDITED TO ADD: Well that went well - all now sorted. Phew! Thanks for everyone’s help - hugely appreciated.

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [17 February 2021 12:09 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/30 "2021-02-17T12:09:16Z")

</div>

> [@haffle](#):
>
> `# timestamped = True`

Using the JSON format, you can timestamp if required.

---

<div class="post-metadata">

**Author:** ![rdc-Green](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/rdc-green/32/17995_2.png) [@rdc-Green](https://community.openenergymonitor.org/u/rdc-Green)\
**Post date:** [23 April 2021 10:51 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/31 "2021-04-23T10:51:25Z")

</div>

i’m trying to connect a Pi Zero W (via Ethernet to [http://emonpi](http://emonpi) using a USB to Ethernet adapter) to an emonTx via serial. I can’t get any connection on the local network to emonpi. Am I missing something? I am using the emonSD image that was working on my emonbase, which I have edited to disable wifi.

I currently have a usb to Ethernet adapter connected to the Pi Zero W, which is in turn connected to an Ethernet to usb adapter going into my laptop.

---

<div class="post-metadata">

**Author:** ![borpin](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/borpin/32/193_2.png) [@borpin](https://community.openenergymonitor.org/u/borpin)\
**Post date:** [23 April 2021 11:47 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/32 "2021-04-23T11:47:49Z")

</div>

> [@rdc-Green](#):
>
> via Ethernet to [http://emonpi](http://emonpi) using a USB to Ethernet adapter

At the base level, does the device appear on your network? Try the IP address rather then the mDNS that can be unreliable.

[edit]

> [@rdc-Green](#):
>
> I currently have a usb to Ethernet adapter connected to the Pi Zero W, which is in turn connected to an Ethernet to usb adapter going into my laptop.

No that won’t work for any device. Plug it into your router.

---

<div class="post-metadata">

**Author:** ![rdc-Green](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/rdc-green/32/17995_2.png) [@rdc-Green](https://community.openenergymonitor.org/u/rdc-Green)\
**Post date:** [23 April 2021 11:50 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/33 "2021-04-23T11:50:54Z")

</div>

Thanks @borpin i’ll try that when i get home this evening.

---

<div class="post-metadata">

**Author:** ![pb66](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/pb66/32/27_2.png) [@pb66](https://community.openenergymonitor.org/u/pb66)\
**Post date:** [23 April 2021 13:00 UTC](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580/34 "2021-04-23T13:00:51Z")

</div>

> [@rdc-Green](#):
>
> i’m trying to connect a Pi Zero W (via Ethernet to [http://emonpi](http://emonpi) using a USB to Ethernet adapter) to an emonTx via serial.

Another solution might have been to use a RPI B+ rather than a Zero W as that has inbuilt Ethernet (but no wifi) and several full size USB ports, they are super cheap, not _quite_ as cheap as a Zero W, but possibly more suited to the application at hand. (Plus double the memory IIRC).

[Previous page](https://community.openenergymonitor.org/t/4-ct-emonbase-using-emontx-and-pi-zero-w/6580.md?page=1)
