Newbie Question....

Ive got a Raspberry Pi, with the current emoncms image running, and i just want to monitor some local sensors, such as...

Optical sensor - to watch the state of Power LED of a device. connected via GPIO pins.

MAX31855 thermocouple connected via SPI.

Is this possible ?

- in the future i am planning on expanding the temp monitoring to use the RFM12Pi wireless solution, but at present i only need to monitor a couple of local sensors.

At the moment I dont need the wireless function, its all sat in one location.

If its not possible with emon, any recommendations on RPi software to do this ?

Robert Wall's picture

Re: Newbie Question....

I was hoping one of our Raspberry Pi experts would pick this up. However...

Yes, I think it's possible, but I can't provide the details. You're going to need a script that picks up the values from your sensors and formats the data so that it's acceptable to emonCMS.
This http://openenergymonitor.org/emon/node/3872 might help you get started. I know Paul (pb66) is working on, or shortly intends to start, making emonHub capable of direct connections, but I'm not sure where that stands at the moment.

The "the standard rock solid forwarder image" mentioned is a precursor to the emonHub.

pb66's picture

Re: Newbie Question....

Currently there is no direct monitoring of gpio pins in emonhub (It would be nice though) and while serial uart is possible and I²C is in testing, I'm afraid SPI hasn't been tackled yet either.

I think the easiest route right now would be to write a little python script that can post via a socket to emonhub, just as oem gateway did. Here is an basic script to start with that could be triggered by cron or incorporate an endless loop

#!/usr/bin/python
import socket
#########
# Frame #
#########
# Script that results in a "frame" string starting with a node id followed by val1 val2 etc 
frame = "10 1 2 3 4"

##############
# Parameters #
##############
# HOST: hostname or IP address of emonHub
HOST = 'localhost'
# PORT: port number to the emonHub interfacer
PORT = 50011
########
# Code #
########
# Append line ending
frame = frame + '\r\n'
# Send frame of data
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send(frame)
s.close()

In emonhub.conf the [interfacers] section would require some settings like this added

[[Socket]]   # Any unique name

    Type = EmonHubSocketInterfacer

    [[[init_settings]]]

        port_nb = 50011

    [[[runtimesettings]]] 

So if you have some example code for your sensors hopefully it shouldn't be too difficult to put something together.

Paul 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.