-
http://www.instructables.com/id/Use-ESP8266-to-Internet-enabled-AC-Appliances/
Food Living Outside Play Technology Workshop
Use ESP8266 to Internet enabled AC Appliancesby shinteo on
December 28, 2014
Table of Contents
Use ESP8266 to Internet enabled AC Appliances . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . 1
Intro: Use ESP8266 to Internet enabled AC Appliances . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . 2
Step 1: . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 2
Step 2: . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 3
Step 3: . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 3
Step 4: . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 4
Step 5: . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 5
Step 6: Savour the moment . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . 6
Related Instructables . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . 6
Advertisements . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . 6
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . 6
-
http://www.instructables.com/id/Use-ESP8266-to-Internet-enabled-AC-Appliances/
Author:shinteo always two there areYour focus determines your
reality
Intro: Use ESP8266 to Internet enabled AC AppliancesInternet
controlled AC Appliances with ESP8266
ESP8266 is a very low cost WiFi transceiver that can be added to
any existing microcontroller based setups via UART (serial link) to
enable the system to communicateover the Internet via WiFI. In this
guide, the objective is to achieve the epitome of IoT inspired
setup; that is to control an AC (Alternate Current) electrical
appliance overthe Internet using ESP8266. The outcome of this
setup: a command to be sent from a website through the WiFi network
to ESP8266 with Arduino Mega to turn on an AClamp for 2 seconds.
The AC lamp is a place holder for any electrical device to be
"Internet Enabled".
The following diagram describes the necessary parts and setup
for this apparatus. On the left is an Multiplug modified with SSR,
In the middle is Arduino Mega. On thebreadboard is ESP8266 and
sparkfun logic level shifter. Arduino Mega Pin7 is for SSR, Serial2
pin16,17 for UART with ESP8266, and Serial0 for USB serial
monitor.
An IoT controlled AC appliance can be quite daunting to
construct. Setting up such apparatus requires cross domains
knowledge such as computer networking,electrical, electronics,
programming, administering software on the Operating Systems
(linux) of a server (or just another computer), and the often
unspoken (and hairpulling moments) troubleshooting techniques.
Combining several key building blocks to this setup can be
overwhelming. Not to worry, because the divide and conquerapproach
can be adopted to R&D (Replicate & Duplicate) this setup.
Which has been conveniently divided, constructed, and described in
the following sections. It ishighly recommended to construct the
building blocks/modules and tested for functionality, prior to
assembling this apparatus.
The necessary building blocks/modules of this setup is broken
down into the following
1. Computer Networking: Setting up a WiFi Access Point/Router.
Setup wifi security, either OPEN, WEP or WPA. DHCP for the
connecting clients (the computer andESP8266). PING-ing the devices
on the network. DMZ for TCP server (if necessary, use for Internet
side to access)2. Electrical & Electronics: Setting up the IoT
inspired SSR Multiplug, and setting up ESP8266 with Arduino Mega;
connecting the SSR Multiplug to ESP8266 withArduino Mega
3. Programming (software): Firmware for ESP8266 on Arduino Mega
to control the SSR Multiplug upon receiving a command. Server side
software for sending a packet(that contains the command) from a TCP
server through TCP/IP to the ESP8266 port 8266.4. Administering OS
(linux): install the necessary software packages Tornado, Python,
and Pip.5. Testing/Troubleshooting
the following diagram describes the apparatus getting ready to
be tested.
The following video describes the operation of clicking on the
website to send a command via WiFi to ESP8266 with Arduino Mega to
turn on the AC lamp for 2 seconds.
Step 1: Computer Networking
Parts needed: WiFi Router Note: ESP8266 defaults to IP address
of 192.168.1.XYZ out of the box. Both the ESP9266 with Arduino Mega
and the server will connect tothis WiFi Router network of
192.168.1.XYZ/24. Ensure that firewall rules are removed
temporarily or a permit all are applied during testing.
1. setup WiFi Router to issue IP Address via DHCP using the IP
address pool 192.168.1.XYZ; subnetmask set to /24 e.g
255.255.255.0. With the router available onhand, it is configured
to allocate IP address in the range of 192.168.1.2 to 99 to PC.
Just a matter of personal preference.
2. setup WiFi security, OPEN, WEP, or WPA. Current setup on
existing WiFi Access Point/Router. For the sale of simplicity
during testing, OPEN can be configured. Forlong term usage, it is
recommended to configure for WPA.
3. Configuration on different brands of WiFi Router might be
slightly different from one and another. RTFM. Alternative: Modify
the settings in ESP8266 to suit the networkaddress on the existing
WiFi Router network.
-
http://www.instructables.com/id/Use-ESP8266-to-Internet-enabled-AC-Appliances/
Step 2: Electrical & Electronics
Parts needed: IoT inspired Multiplug modified with SSR; ESP8266
connected to Arduino Mega.
Th details steps of modifying a multiplug with SSR is available
on instructables
http://www.instructables.com/id/IoT-inspired-multiplug-using-SSR/
or here
http://shin-ajaran.blogspot.sg/2014/11/iot-inspired-multi-plug-modified-with.htmlThe
details steps of connecting an ESP8266 to Arduino Mega is available
on instructables
http://www.instructables.com/id/noobs-guide-to-ESP8266-with-Arduino-Mega-2560-or-U/
or here
http://shin-ajaran.blogspot.sg/2014/12/noobs-guide-to-esp8266-with-arduino.htmlonce
these two building blocks are ready, connect pin7 of arduino mega
with the signal pin of the SSR. VCC on the SSR to 5V on arduino and
GND to GND on arduino.Ensure all components are connected to the
common ground.
Step 3: Software (Programming)There are 2 pieces of software
necessary for setting up this apparatus. One, the firmware that is
residing in the Arduino Mega with ESP8266 and controlling the SSR
inthe multiplug, and the other is the software residing in the
linux server to send a "command" via a website.
The firmware deals with the necessary parameters of ESP8266 to
connect to a WiFi network, and waits for the "command" from the
server via TCP port 8266. The portnumber is a deliberate choice,
but it is not recommended to choose ports that are in the "well
known" e.g port number < 1024. Choose ports that are in the
ephemeralports region if it pleases you. The "command" is a keyword
sent by the server side software, e.g "LED". Upon receiving this
keyword by the ESP8266 and Arduino Mega,pin7 is held high for 2
seconds and then held low for testing purposes. The "command" is a
variable that can be customized. Out of convenience, and also the
discoveryof the LEDServer software on github, the keyword "LED" is
used.
The server side software is obtained from github out of the
convenience. why reinvent the wheel??? Many thanks to contributor!
Please follow the github URL below for adetailed descriptions on
the static html page and python. Every time the button send is
pressed, the string "LED, R, G, B" is sent to ESP8266. Essentially,
only the "send"button and the keyword "LED" are used by this setup
in particular. The original intention of this server side software
is to use the variable R, G, B that is of type integermeasuring
from 0-255 for setting the colour of neopixel LED strip.
Alternatively, and for the sake of simplifying the server side
software for testing there is an opensource tool sockettester v3.0
can be used. URL herehttp://sockettest.sourceforge.net/ The ESP8266
LED Server software is used as an example for the sake of
complicity to the explanations of this IoT setup.
code for firmware here:
https://gist.github.com/teos0009/60d9d10b9441cc2bc0a2
code for server software on linux here
https://github.com/Doomhammer458/ESP8266-LED-Server
-
http://www.instructables.com/id/Use-ESP8266-to-Internet-enabled-AC-Appliances/
Step 4: Administering OS
Since the chosen server side software mentioned earlier runs off
linux; there are several pre-requisite steps needed. In this setup,
a virtual machine running ubuntu 14.04desktop is assumed, and a USB
WiFi adapter is connected to this virtual machine. The server side
software requires python, Tornado webserver that can be installed
viapip.
1. Configure USB WiFi adapter to connect to the WiFi router.
This step varies, depending on the WiFi security setup such as
OPEN, WEP or WPA.
Existing WiFi network is using WPA, so it has to be set up
accordingly.
apt-get install wpasupplicant wireless-tools
nano /etc/network/interfaces
#add in the following ssid and wpa password
auto wlan0 iface wlan0 inet dhcp
wpa-ssid "the_SSID"
wpa-psk "the_password"
#restart
2. install pip (if it is not installed) sudo apt-get install
python-pip3. install tornado (if it is not installed) pip install
tornado4. execute the server side software as per the instructions
in github. The following diagram describes this operation.
-
http://www.instructables.com/id/Use-ESP8266-to-Internet-enabled-AC-Appliances/
Step 5: Testing/Troubleshooting
check IP address of the devices from WiFi Router's management
console, and ping the devices. The following screenshot describes
this operation of ping.
Test ESP8266 for functionality using AT commands.The following
diagram describes the AT commands used for testing.
-
http://www.instructables.com/id/Use-ESP8266-to-Internet-enabled-AC-Appliances/
Step 6: Savour the momentSavour the moment
Related Instructables
A newbie'sguide to setupESP8266 withArduino Mega2560 or Uno
byshinteo
ESP8266 WiFitemperature andhumidity sensorby EasyIoT
ESP8266 WiFIwater leaksensor byEasyIoT
ESP8266 WiFirelay switch byEasyIoT
An inexpensiveIoT enablerusing ESP8266bygopinath.marappan
Blink forESP8266 native,like arduinousing Windowsby
jbeemster
Advertisements
Comments2 comments Add Comment
Akin Yildiz says: Dec 28, 2014. 5:44 PM REPLYnice to see so many
great tutorials on this wifi module.. i've been waiting for
something this cheap/small for a long time. i have all the parts
needed for thisproject, hopefully i'll get to it one day. I will be
using your instructions. thank you..!
shinteo says: Dec 29, 2014. 1:44 AM REPLYhi akin, you are more
than welcome to use the data uploaded :)