Wednesday, January 11, 2017

Internet Relay Using ESP8266 220V 10A DC 7-30V Network Relay WIFI Board Module



Summary
Latest: The board has been removed as it randomly clicks the relay.

 Using the ESP8266 220V 10A DC 7-30V Network Relay WIFI Board Module, I was able to setup an internet Relay to control an auto-gate.

Step 1.
  Configure the ESP8266 relay to automatically connect to home wifi.
  ESP8226 now becomes a local wifi relay.
  Control is via web page.
  Install ESP8266 into the auto-gate control, connect up 12VDC and the gate control relay input.

Step 2.
   Pulse the relay on a local linux box to open/close the gate using curl.

>cat pulserelay
#!/bin/csh -f
curl --data "open_relay='x'" http://192.168.1.7
sleep 1
curl --data "close_relay='x'" http://192.168.1.7

Above csh script can now open / close the autogate

Step 3: Set up URL on another remote fixed IP server

3a:    Setup a cgi on a remote linux fixed IP server

>cat opengate.cgi
#!/bin/csh -f
echo "Content-type: text/html"
echo
echo "<pre>"
echo "opening gate"
rsh raidserv /root/pulserelay
echo "gate opened"
echo "</html>"

Point "raiderv" to dynamic ip in /etc/hosts

Above opengate.cgi will rsh into local linux box "raidserv'

3b. Setup rsa keys
       ssh-keygen -t rsa
       Copy key for same user to raidserv authorized_keys.

Done.

Reference

https://ucexperiment.wordpress.com/

http://www.ebay.com/itm/ESP8266-220V-10A-DC-7-30V-Network-Relay-WIFI-Module-/182150587112



1 comment:

  1. We found that it randomly clicks the relay and removed it.

    Most probably the board overheated and rebooted.

    Now looking for wired ethernet relay.

    ReplyDelete