blog:personal_diy_pi_powercontrol

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
blog:personal_diy_pi_powercontrol [2019/10/23 09:30] johnblog:personal_diy_pi_powercontrol [2019/10/23 10:09] (current) john
Line 20: Line 20:
  
 There are single socket versions available, but for my use, the 4-way power strips are the most efficient use of space - each socket being individually controlled; on/off, via a pre-programmed RF remote. There are single socket versions available, but for my use, the 4-way power strips are the most efficient use of space - each socket being individually controlled; on/off, via a pre-programmed RF remote.
 +
 +Energenie also offer a specific add-on hat, for use with a Raspberry Pi, but a lot of people have found that the generic Hope RFM69 radio module (which is an SPI bus-interfaced radio module) works just as well.
 +
 +=== Duplication of remote control functionality ===
 +
 +One of the problems with the Energenie RF system, is that out of the box, the handsets are pre-programmed with device codes which you pair with the sockets. It's not possible to read what those codes are (which would be necessary, in order for the power sockets to respond to another radio device), and there's nothing on the handset or PCB to say what those codes are.
 +
 +There **is** a [[https://github.com/whaleygeek/pyenergenie/issues/81|method]] to analyse the radio signals from the remote, with a software defined radio, but as I [[https://github.com/whaleygeek/pyenergenie/issues/106|learned]], there is something going on between the handset and power sockets that means you are not guaranteed to replicate the device codes perfectly using a different radio module.
 +
 +As it turned out, needing to do that wasn't strictly necessary; putting the power sockets in their "pair with handset" mode, and sending the power on signal from the Pi radio module was enough to get the power socket to pair with the //slightly different// signal that the Pi was sending. Et voila! Power sockets now able to be controlled by the Pi.... of course, I had to replicate this pairing for each of the power strips I owned (14, at last count), since each one was responding to a different device ID, but once that was done, each strip and socket could be addressed individually.
 +
 +----
 +
 +==== Touchscreen User Interface ====
 +
 +So I technically had a way of controlling the sockets, but I needed a way of interacting with that functionality.... keeping track of a dozen or more remote controls was **not** what I wanted to do.
 +
 +I had done a little bit of [[https://www.libsdl.org/|libSDL]] programming for my [[blog:car_stuff_pycosworth|Cosworth ECU]] interface project, and had since done a little more at [[https://www.ncl.ac.uk/|work]], so I thought I could knock together an interface using a simple touchscreen board for the Pi.
 +
 +So this is what I came up with:
 +
 +{{:blog:pi_buttons_2.jpg?600|}}
 +
 +Scrollable pages of buttons that are mapped to individual power sockets on the remote control power strips. The action of the button can be toggle from on to off by the middle icon on the bottom row (green for power-on, press to toggle to red and set to power-off).
 +
 +I also added a couple of [[https://energenie4u.co.uk/catalogue/product/MIHO004|power monitor plugs]]:
 +
 +{{:blog:miho004_website.jpg?200|}}
 +
 +...these are strictly broadcast-only devices which send a burst of power metrics over the same RF signal as the power sockets, approximately every 60 seconds. The PyEnergenie project also had support for these, so I was able to pull this data in using the same RF module used for controlling the sockets, displaying it on the touchscreen at the press of a button:
 +
 +{{:blog:pi_monitor.jpg?600|}}
 +
 +This screen let me monitor the power use of all of the sockets in the room in (almost) real time. There is a lag for the power monitor sockets to re-broadcast their data (it's every 60 seconds or thereabouts), but it's good enough to see the loading on the 4 wall sockets in the room, along with the various power strips that run from them.
  
 ---- ----
Line 25: Line 59:
 ==== Where's the code? ==== ==== Where's the code? ====
  
-More content we go here, but for now:+More content will go here, but for now:
  
 https://github.com/megatron-uk/sdlRFController/ https://github.com/megatron-uk/sdlRFController/
  • blog/personal_diy_pi_powercontrol.1571819411.txt.gz
  • Last modified: 2019/10/23 09:30
  • by john