/wireless-device-switching

Responsive web frontend to switch on/off device power manually or via schedule

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

wireless-device-switching

Responsive web frontend to switch on/off device power manually or via schedule


The beauty of this project is it allows you to switch on/off devices (typically lights plugged into relays) through a web frontend, which enables you to use any device with a modern browser to control the system. I've only tested this on Chrome. Additionally, you can schedule devices to turn on/off at a specific time (absolute or relative) and day of week.

The following is a list of everything you need to make this project:


(1) Set Up Your Raspberry Pi

  • Install Raspbian on your Pi
  • Connect your keyboard, mouse, and monitor to the Pi and connect your Pi to your network via WiFi or Ethernet
  • Confirm you have python3 on your Pi by typing python3 into the command line. Exit the terminal with exit()
  • Get the Pi's IP address typing ifconfig into the command line. Write this down for later.
  • Download VNC Viewer if you want to remote into your Pi from a computer. Additional Pi configurations: link

(2) Connect Hardware

  • Type pinout into the command line for the Pi's pinout
  • Connect the following chip pins to the appropriate pins on the Pi:
    • Receiver Chip:
      • GND - Any ground pin
      • DATA - Pin 11
      • DER - Not connected
      • +5V - Any +5V pin
      • +5V - Any +5V pin
      • GND - Any ground pin
      • GND - Not connected
      • ANT - Not connected
    • Transmitter Chip:
      • P - 3.3V pin
      • DA - Pin 7
      • G - Any ground pin
      • AN - Not connected
  • Of course you can use different pins besides 11 and 7, those those are the pins configured in RxTx.py

(3) Try it!

Go ahead and start the server by opening a terminal window, navigating to src/webpage/app.py, and start the server by typing python3 app.py.

To add a device, ensure you're depressing and holding the associated on/off button on the remote that came with your relays before clicking the ON Code button.


(4) Debugging

Use the src/comm/test.py file to view a particular code. I've designed this to work with 25 bit codes, so if your code is a different length, let me know. I'll work to modify the code to accept generic code lengths.

The most common failure point is (1) either your connections are poor or invalid or (2) you purchased a bad receiver. I had receiver issues until I purchased the one I linked above.