433Mhz wireless power control with Wi-Fi

From openPicus Wiki
Jump to: navigation, search

Contents

Introduction

This project had as objective to control low-cost easy to find 230v wireless plugs using my mobile phone. I found a cheap solution with the ELRO plugs. The challenge was to implement the remote control on the Flyport that uses a 433.92MHz module to sends out a 20ms message once a button on the phone is pressed.

Plug433.jpg

The Flyport uses standard wifi setup in ad-hoc mode. The 433.92 RF module is permanently powered with 3v from the Flyport module. The control of the RF module is very simple, sending 1/0 over OUT5 of the FLYPORT to the data input of the RF module. The driver was added as external library. The code uses the Timer4 interrupt of the Flyport to generate the pulse length; this allows transmission without any interruption of Flyport wifi process.

Implementation

The project was implemented with Openpicus 2.2 with 2 templates. One using the generic wifi template that is documented here.
A second version with “web server configuration page” available on the Openpicus web site is not yet 100% ready. The current code is included in “RFook.c” and “RFook.h” and consists of 3 subroutines:
void RFookInit(void); // called in flyport_task.c initializes the module IO + timer+interrupt
void RFookSend(UINT8 house, UINT8 plug, UINT8 state); // triggers sending one message 4 times
void __attribute__((__interrupt__, auto_psv )) _T4Interrupt(void); // generates the rf ook ouput.

ELRO protocol revers engineering

The ELRO remote control message consists of 4 parts using so called OOK coding. This means the transmitters sends out an rf signal during around 30ms, interrupted with breaks making the coding.

-Start block 300us on + 900us off
-House/Zone Address 5 bits data
-Plug address 5 bits data
-On/off 2 bits data

The data bits are a little special and can generate 3 levels
- ONE/1: 300us-on:900us-off:300us-on:900us-off
- ZERO/0: 900us-on:300us-off: 300us-on:900us-off
- FLOAT: 900us-on:300us-off: 900us-on:300us-off not used here

The message is send out multiple times from the ELRO remote control to increase reliability.

4331.jpg

Test environment

I used iPhone and iPad to test the solution. This is impacting the style files of the html code (iPhone.css) File:4332.jpg I am still looking for a better solution to design the web page interface, especially for the iPhone, the picture/format generated is not the same than on standard web browser, this means a lot of back and forward testing. Any idea improving this part is welcome.


Bonus/Additional features

As I got offered an ELRO RING/DONG set that uses the same transmission protocol, I added the “dong” function to the interface. This function allows me to ring a bell on the other side of the house, testing the distance of the solution.

Equipment used

- Openpicus Flyport starter kit
- 433.92 MHz transmitter (AM module) from used weather sensor or from hobby shop
- ELRO plugs (Pack of 3 with remote control) available from “Hornbach” or “OBI” or similar -PC with Openpicus IDE 2.2
- Fast oscilloscope to reverse engineer and document the ELRO protocol.
- iPhone, iPad

Improvement

The house code of the ELRO message is currently hard-coded in the Flyport library; the intention is to add a configuration web page to the Flyport code to setup this parameter. Hope you find this useful and that someone is interested to replicate. www.z-control.ch


Source code

Source code for Flyport

Personal tools
Namespaces

Variants
Actions
START HERE
DEVELOPMENT
HARDWARE INFO
RESOURCES
Toolbox