Community
OpenEnergyMonitor

Community

DIY emonpi using Raspberry and Uno

I have looked but cannot find an answer I can understand.
I have a raspberry pi B and I have an Arduino Uno.
How do I make my own emonpi?
I have the ct’s, I have made the input circuit and the Uno is reading the CT and VT inputs.
The bit that I do not understand is connecting the raspberry and the uno.

Regards
Paul

You need to connect the serial output of the Uno to the serial input of the RPi, in exactly the same way as we recommend making the direct serial connection between the emonTx and the emonBase in the Wiki: https://wiki.openenergymonitor.org/index.php/EmonTx_V3.4#Direct_connection_emonTx_V3_.3E_Raspberry_Pi_GPIO
(Note that the emonTx pins are not labelled conventionally - the crossover from Tx to Rx is done on-board, so the connector pin labelled TXD is looking for the Tx line, likewise the Rx.)

Hi Robert,
The bit that worries me the most is 5V and 3.3V. I read that the Raspberry and the uno run at different voltages?
Can I power the Uno from the raspberry - 5V or 3.3V?
Or
Can I power the Uno from the Raspberry USB port? And send the data via USB?

As far as I know, that’s correct. I’m not an Arduino expert and I keep forgetting that all that stuff runs at 5 V. And as far as I know, the RPi only has 5 V on it as far as the power regulator, so 5 V should be available at the USB ports (you might like to read up on the spec. sheet to confirm this).

But the I/O is not 5 V capable. If you stay with the serial connection, then you must use a pair of resistors as a voltage divider to reduce the 5 V Tx line from the Uno to the RPi (look at the circuit diagram of the emonTx Shield for resistor values: https://github.com/openenergymonitor/emontx-shield), but the signal going the other way - if you even need it, from the RPi to the Uno - should be OK.

https://pinout.xyz/pinout/pin1_3v3_power# says the 3v3 line is capable of ~500 mA on Pi B+
and subsequent models. The first generation of Pis had a linear regulator on the 3v3 line.
Starting with the B+, the linear regulator was replaced by a dual switching mode regulator.

More info here: https://learn.adafruit.com/introducing-the-raspberry-pi-model-b-plus-plus-differences-vs-model-b/power-supply


Ahh - so I can power it from the 5V and just reduce the I/O voltage.

And then how do I setup the emoncms software to read the serial data. Or is that the easy part.

There are so many components involved in this my head is spinning!
Thanks for the help.

There’s a link to that on the page I pointed you to earlier.

If you are more comfy with that you can do so, the address you need to use in emonhub will be /dev/ttyACM0 (assuming this is the first/only arduino connected) instead of the usual /dev/ttyAMA0. The arduino will then get it’s supply via the usb to, this can be “iffy” on the Arduino, but the Pi’s have particularly stable 5v rails so less of an issue.

Yes, but as Robert has pointed out, it’s only the 5v tx line from the Uno to the 3.3v rx line of the Pi that needs reducing, so a voltage divider (2 resisters) is adequate.

That depends on your sketch in the Uno. Yes it’s pretty easy if your Uno is outputting either space separated variables or key:value pairs at each update. emonhub can take either, you just need make the sketch match for the easiest solution.

Thank you.

You guys make it sound so simple.