characters which must be edited into the TeleduinoClient sketch along with
your Wi-Fi network’s SSID and password before downloading into the
ESP8266. The API key must also be used in all API calls from your browser.
Once the sketch is downloaded into the ESP8266, it will first make a
connection to your Wi-Fi network and then it will open a TCP connection to
the Teleduino server. Once this connection is made, the ESP8266 will
authenticate itself to the server by providing the API key. If you bring up the
serial monitor, you will be able to watch this interaction take place.
If all goes well, the Teleduino server will begin sending ping messages to
the ESP8266 about every five seconds. Because the ESP8266 establishes an
outgoing connection to the Teleduino server, there is no need to open any
ports in your firewall and thus create any new security concerns for your
network.
To summarize: Once the TeleduinoClient is configured, it automatically
connects itself to the Teleduino server when powered up. The Teleduino
server translates instructions received over the Internet into actions on the
Teleduino device which (in this case) is the ESP8266.
As mentioned, I ported only a (very small) subset of Teleduino
functionality. In fact, the TeleduinoClient sketch only recognizes a
setDigitalOutput API call, but that is enough to prove the concept workable.
On the second prototype shown in Photo 5, I have connected an LED to the
ESP8266's GPIO2 pin through a 1K ohm resistor to ground. If I go to my
browser and type in (this rather long URL) https://us01.proxy.
teleduino.org/api/1.0/328.php?k=<YOUR KEY GOES HERE>
&r=setDigitalOutput&pin= 2&output=1&expire_time=0&save=0, the LED
will turn on. If I try this again but change output=0, the LED will turn off.
Keep in mind that for this demo, the ESP8266 is turning an LED off and
on by way of commands entered into a browser which can be located
anywhere in the world. If instead of an LED connected to the ESP8266 you
connected a solid-state relay (SSR), you could control devices such as a light,
a heater, an alarm system, etc. The possibilities are endless.
Want to control your Teleduino device from your Android smartphone or
tablet? Check out apps like Teleduino
Controller Pro V2 in the Google Play
store.
Conclusion
This article doesn't begin to describe
the cool things that can be done using
the ESP8266. I hope after reading this
article you will come up with many ideas
for your own projects. I have a few in
mind that I may share in future articles if
there is enough interest. Please let Nuts
& Volts know if you would like other
articles about using the ESP8266.
Devices like the ESP8266 make
possible the idea of connecting almost
anything to the Internet and controlling
and/or monitoring them from anywhere
in the world. The ESP8266 is a giant step
forward in the Internet of Things (Io T)
revolution. NV
October 2015 47
OEM board-only version is
also available.
mccdaq.com/USB201
• 8 analog inputs
• ± 10 V input range
• 12-bit resolution
• 100 kS/s sample rate
• 8 digital I/O
• One 32-bit counter
• Support for Windows®,
Android™, and Linux®
©2015 Measurement Computing Corporation
info@mccdaq.com
Contact us
1.800.234.4232
USB-201
Only $99
AT A SMALL PRICE
Big
Breakthrough
in DAQ
Easy to Use • Easy to Integrate
Easy to Support
MEASUREMENT COMPUTING
Resources
The following links provide
further information about
ESP8266 devices:
Information about the ESP8266
Arduino port can be found at
https://github.com/esp8266/
Arduino.
An ESP8266 forum full of
useful information can be
found at www.esp8266.com.
The Expressif forum is available
at http://bbs.espressif.com.
The Teleduino client sketch
( TeleduinoClient.ino) is
available at the article link.