Sending CT inputs to emoncms without emon hardware?

I have a Raspberry Pi 3 with a 16 channel Analog hat (2 x MCP3008’s) that I would like to use to monitor the energy used at my house. My thought was to take the readings and send them to emoncms. This seems to be the best way to store and display all the energy data. I’ve looked through the forum and supporting documentation (as best I could), but can’t seem to find where I would edit the code to tell it how to communicate with my setup.

I’m able to communicate with the Analog Hat, but not sure how to pass those readings to the emon system.

I imagine there is already some documentation about this, but can’t seem to find it. Any recommendations?

Thanks in advance

Joe

i’m not sure if this was posted in the right area, but any guidance?

Disclaimer: I am not a RPi expert, nor a Linux expert.

From what I can see, your Analogue Hat is an ADC only. I looks to me as if you’ll need to write a service to read and process the analogue signals in much the same way as we do in the emonTx with the Atmel ATMega328P processor and emonLib, then send the processed values (usually average power over the last n seconds) to emonHub.

It may have been done by someone here, but I can’t remember seeing anything like it. Have you searched the Archive too?

Exactly. I can write a service to read and process the analogue signals, I am just not sure how to send the values to emonHub. If I knew which files had the code that handled this, I could probably figure it out. I searched through the forum for what I could think was the right question, but sometimes it’s all in how you phrase it. Someone with knowledge of the file system could probably say, “oh ya, file xyz.py has the code that takes the processed values and sends them to file abc.123 and then they go to emonHub.”

Thanks for the reply.

Obviously, your profile didn’t give me any sort of clue about your competencies, so - given that no-one else had picked your question up - I had to write a fairly general reply, if only to let you know that you hadn’t been completely ignored.

I’m unsure of my ground here, Paul (@pb66) is the expert as he wrote emonHub, but I think it should be case of launching the values onto an input stream that has been configured in emonHub with an interfacer. Paul will get notified so, work commitments permitting, he may be able to help.

Similar project to your idea - of using the MCP3008 chips

The information is simply tagged onto a GET request URL:

Input API

If you register for an eMonCMS.org account, you can play with the API by simply coding Get requests in a browser tab and looking at the results. It’s actually quite simple.

BTW/ you can pop those MCP3008 ADC off and replace with MCP3208 for 12 bit accuracy.

When I had Beagle Bone Black receiving data from my CT’s, I used python and/or perl script to send data to emoncms.org. If you are interested, I can try looking for my old scripts.

That would be great!

Thank you

I had a python script, that read values from serial input (I had Arduino connected over USB Serial sending data to BBB). Create a python file; then chmod +x post.py; then either run it manually or have it start with you linux system, I had I auto start and run continuously in the background.

let me know if you need help with any particular parts of the script Rpost.txt (1.8 KB)

1 Like

The easiest way to get custom data into the emoncms eco-system is to use a Socket interfacer with emonHub.

If you search this forum and the old one for “Socket Interfacer” there are several examples. It basically allows you to post space separated values to a port and emonhub will manage the rest.

The data can be sent to the socket from any language but there are examples of both Bash and Python out there, how are you currently accessing the ADC hat?

The Socket interfacer is useful in it’s own right for prototyping and “one of’s” but it can also pave the way to writing a custom emonhub interfacer which I think this project is ideal for to allow users to easily add an “ADC hat” to a Pi running emonHub/emonSD.

2 Likes

Socket Interfacer… that sounds promising! I’ll do some searching for that.

I’m currently accessing the ADC Hat over SPI with a python script.

Thank you so much for that post. This would definitely work to get data to emoncms. Paul’s suggestion with the Socket Interfacer sounds like it may be the best option as it should utilized the existing buffer features and all that. But worst case, I can rig something together with a custom script.

Thanks again for the info. I was able to search and found your post here [HERE] (MODBUS TCP/IP Python send to EmonCMS - #30 by pb66) and am now getting data showing up on both localhost and emoncms.org.

Now, on to getting my Feeds set up and refining my data…