Giter Club home page Giter Club logo

433home's Introduction

433 MHz Power Switches Frontend

This is a simple network front end for a set of wireless remote power switches in my home. It sets up an HTTP server, drives a 433 MHz transmitter and displays the current status of the power sockets. The design is responsive to work on phones as well as desktop computers.

Sockets

I got mine from a large retailer in germany, and they are branded "REV". There's only a few protocols for those radio power outlets, but instead of opening it, looking for the radio chip ID and adapting an existing library, I found it quicker and easier to just reverse engineer the timing of the signals with a receiver (they come together with the transmitter for just 1-2 Euros) and a logic analyzer. If you want to take the other route, however, there's an excellent library that covers most wireless control protocols at RC Switch.

Control sequences

Power up the receiver and connect a logic analyzer to the data line. Then press buttons on the remote and capture the sequence. Take note of the timinig. I only captured three on and three off signals (since I only have three power sockets). The encoding seems to be a return zero code, where a "1" is encoded by the data line being high for 875us and then low for 275us, and the "0" is encoded by a high for 275us and then low for 875us. A command has 25 bit, where the 3rd nibble seems to encode the channel id, and the 6th nibble (counting from left to right) is either on or off.

This is what one command looks like on the analyzer output: Sample trace output

I repeated the process for the other buttons on the remote as well and those are the sequences I measured:

1 ON    1101 0101 1101 0100 0000 1100 0
1 OFF   1101 0101 1101 0100 0000 0011 0

2 ON    1101 0101 0111 0100 0000 1100 0
2 OFF   1101 0101 0111 0100 0000 0011 0

3 ON    1101 0101 0101 1100 0000 1100 0
3 OFF   1101 0101 0101 1100 0000 0011 0

The remote sends each control sequence 5 times in a row, but I went with 10 times, because my transmitter only runs on 3.3V and the signal needs to pass through walls. From what I can tell, this seems to work quite reliably. The transmitter could take up to 12V, if more range is needed.

HTML

There's only one page, which is the html template in the /data folder. The favicon and the CSS are seperate files and get served statically through SPIFFS directly. The html is parsed by the program before delivery and certain wildcards are replaced with dynamic values. This slows down page delivery quite a bit, so I will probably move the system info to a seperate page and only parse for the button states. The request gets sent through a POST request, because I find that to be a much cleaner solution than using GET.

This is what the whole thing looks like on a my phone... third button currently has nothing connected to it (obviously). Page on phone

And that's what it looks like in a browser. One of the next steps will be adding DNS support. Page on phone

The responsive part of the HTML is nothing fancy. It basically makes text and buttons bigger and the whole page fullscreen when displayed on a phone.

TODO

  • Store button states to persistent memory in case of reboots
  • Move Server functions to seperate file
  • Implement NTP timekeeping
  • Implement Alarm control structures
  • Build Alarm interface page
  • Update screenshots with new design

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.