Connecting EmonTx to RaspberryPi

Hello all,

Overall question: How do I connect my EmonTx to my RaspberryPi?

More information:
I’m Marie from the United States. I’m working on a senior design project that is intended to use an EmonTx in order to monitor current and voltage. I’d like to connect it to my Raspberry pi. I was told by my project members that it isn’t possible to connect a RaspPi to EmonTx, however I noticed these links:

Post on connecting RaspPi with EmonTx
Github link
Similar Archived Post

I searched “serial-direct” as was suggested and saw a post that linked this: WikiLink on Direct Connection

My project partner said he tried to connect the RaspPi like this and it fried his RaspPi so I’m a bit nervous on trying this. I did read the wiki link I provided above and I do have the wires properly connected to the EmonTx. Is there any editing I need to do with the code that’s in the github? This wasn’t my part of the project and my project member had been giving false updates, so I admittedly don’t know much about hardware, but I am capable of learning and I pick up fairly quickly.

Thank you for reading. If I’m missing any information, please let me know and I’ll add it expeditiously.

This is indeed where you should be looking:

If you don’t want to use a direct wired connection, you can add an RFM69Pi 433MHz Raspberry Pi Base Station Transceiver to turn your RPi into an emonBase that receives the data via ISM band radio.

Thank you for replying, I appreciate it. I’m going to try reassembling everything in about half an hour. The link you sent me says that no firmware change is required for firmware that’s 2.5+, I have the EmonTX V3.4.3 so I shouldn’t have to make any firmware changes/updates/etc like the one that was listed in the Github link that I posted earlier, correct?

No, that sketch looks OK. Even so, it’s a relatively simple matter (if you have the USB - FTDI programmer) to install the Arduino IDE and reload a different sketch.

Hi, one more question for you. How do I see the information output from the EmonTx? I have it serially connected to my RaspPi and it properly powers on, I haven’t touched the firmware as we mentioned earlier, but is it possible for me to see output if I’m not using emoncms?

I see that the link we used earlier mentions this: “The direct serial output Arduino sketch/firmware for the emonTx v3 can be uploaded with a USB-to- serial adapter. Once uploaded, use the Arduino IDE serial monitor - set to 9600 bps - to verify the emonTx is printing values to the serial port.”

If I’m not using an arduino, I figured maybe I could use pyserial instead. Does that make sense? Would that mean I do need to update/change the firmware for the emonTx?

What softwre / image have you loaded onto the Pi? Is it the EmonSD image? If so, emonhub will pick up the data and pass it onto EmonCMS (with a config tweak)…

Via the original link you will find this link emonhub/conf/interfacer_examples/directserial at emon-pi · openenergymonitor/emonhub · GitHub

Thank you, Brian! I think the source of my confusion is not understanding where these tweaks go. Also, I’m not able to use EmonCMS and I’m trying to work around that. The image I have loaded onto the Pi is Buster, if that makes sense. I’m not sure how to get the EmonSD image on my pi, as of yet. I’ll google it right after I get into my lab. If it helps, here’s some additional information on what I’m trying to do:

I have a RaspberryPi 3 Model B that will be connected to an EmonTx, a temperature sensor, and a solar cell. The goal is to receive current and voltage data from the EmonTx, temperature from the temperature sensor (already functional), and voltage from the solar cell. Where I will implement this system will not have access to the EmonCMS (this is an international senior design project; from my understanding EmonCMS also costs money?) and so I am trying to avoid using that if possible. I just want to make sure that the EmonTx is currently working and is running appropriately by printing out the data.

As for the software/image I’ve loaded onto the pi, I apologize but I am unsure. All I have done so far is connect the EmonTx to my RaspberryPi (it successfully receives power from the Pi).

I’ve been following these links and trying to piece everything together:

Firmware Modification

Step 3b for updating/loading firmware

Serial communication with pi

Am I somewhat on the right track? Am I way off? I’m sorry if I am missing something simple.

Edit (2:34PM EST): After googling, I found this: EmonSD Pre-Built SD Card and this Self Install using EmonScripts

If you download our SD card image of emonCMS, that is ready to be written to an SD card and will run on your RPi. That emonCMS is free once you have an SD card. It’s for which we make a small charge to cover hosting expenses. AS Brian mentioned, a small change to the configuration will enable the serial input from the emonTx.

Alternatively, to see (but not easily record) the data from the emonTx, use the FTDI port and a programmer connected to a computer USB port and the Arduinio IDE. I know that works, platformio might be able to do that, but I don’t know and can’t use it because it screwed my system up.

Thank you, Robert! That makes more sense. Are the links that I put in my edit the correct ones for getting the SD card image of EmonCMS? As for the small change to configuration, does the configuration change need to occur after I get the SD Card image?

When you say “but not easily record”, does that mean it wouldn’t be recommended to try to put it into the pi’s mysql database? The way that the project works is that there may be intranet, or even less likely, internet, but I am trying to be a least reliant on those possibilities as possible.

I looked up the information about the FTDI port and the programmer too. I would have to order the programmer in order to do that. But that is an alternative solution, correct? If I use emonCMS, I should be fine?

The SD card image is a complete operating system for the RPi. The config file you need to tweak is accessible via a web browser when you have started the Pi (and let it update itself via the Internet).

I mean that data will appear on your laptop/desktop computer. If you’re using the programmer, the RPi running emonCMS is not part of the set-up. It’s either/or. The data appears in what is effectively a ‘terminal’ window, and needs to be copied and pasted into a file to be recorded. Hence ‘not easily’ .

Indeed. The programmer will also allow you to upload new or altered sketches to the emonPi should you need to, so it’s something that we recommend.

You should be. But if something goes wrong, you’ve one equation and two unknowns. A programmer would most probably resolve that.

The EmonSD is simply a Raspian Buster image with emoncms & emonhub preloaded and the partitions of the SD card modified to suit a situation where there is a lot of data writes that can wear SD cards out quite quickly.

Just get a second card and flash the image. One warning, it does do a load of updates on first boot so leave it for a good while to get itself setup.