WIFI module ESP8266 for IoT

I got interested interested in ESP8266 WiFi module after reading New Chip Alert: The ESP8266 WiFi Module (It’s $5) article. Why is it cool? It’s a WiFi module with an SOC, making it somewhat similar to TI’s CC300. ESP8266 is an UART to WiFi module that you can pick for less than $5 USD.

ESP8266 is a really cheap and easy way to connect any small microcontroller platform (for example Arduino) wirelessly to Internet. The microcontroller on the module takes care of all the WiFi, TCP/IP stack, and the overhead found in an 802.11 network. It’s addressable over SPI and UART, making this an exceptionally easy choice for anyone wanting to build an Internet of Things thing. You can use AT commands to connecyt to WiFi networks and open TCP connections without need to have TCP/IP stack running in your own microcontroller: You can simply connect any microcontroller to this module and start pushing data up to the Internet. This might be why it seems that ESP8266 has pretty soon become every hacker’s favorite WiFi chip.

The ESP826 module I bought from Electrodragon is simple having only the ESP8266 IC and one other IC in it. The WiFi antenna is integrated to circuit board. The whole module is just size of post stamp.

ESP8266

The other side of the he module des not have any components, just 8 pins I have attached wires to in this picture.

ESP8266_2

The ESP8266 is a chip that turned a lot of heads recently, stuffing a WiFi radio, TCP/IP stack, and all the required bits to get a microcontroller on the Internet into a tiny, $5 module. It’s an interesting chip, not only because it’s a UART to WiFi module, allowing nearly anything to get on the Internet for $5, but because there’s a user-programmable microcontroller in this board.

There’s a catch, right, there’s always a catch on the cheap products. One thing is that ESP8266  pretty much doesn’t exist outside China. Ordering from China is not  a problem nowdays, but when all the documentation is in Chinese, that can be a problem. But fortunately there has been projects to get ESP8266 translated data sheet.

I had enough information, so I need to get one module to test. I ended up ordering ESP8266 module from Electrodragon (check module data). ESP8266 from Banggood.com would have been cheaper bit taken longer time to get because ESP8266 module was listed to out of stock at the time.

The module and IO pins run at 3.3V.  For testing I used USB To RS232/TTL PL2303HX Cable Adapter  and 5V to 3.3V regulator module to do the connection. I used separate 3,.3V regulator module because I wanted to guarantee that the module can get enough current (over 200 mA on peaks) (some other USB-serial adapter ICs have 3.3V regulators built in them but can’t give enough current out). Wi07c ESP8266 module data and different project examples got me started pretty well.

 

ESP8266_test

Test commands at 115200-N-8-1 serial port settings:

AT+RST
AT+CWMODE=1
AT+CWJAP=”SSID”,”PASS”

AT+CWJAP=”AndroidAP”,”XXXX”
AT+CIPSTART=”TCP”,”www.epanorama.net”,80

AT+CIPSEND=0,n: Where n is the length of the request string.

AT+CIPCLOSE

The results with those were promising. Wiring ESP8266 to your favorite microcontroller platform has pretty much everything you would need to do with an Internet of Things thing. That’s good enough, but things are even better.

It has turned out that it is possible to do run your own coode on the module itself: An SDK for the ESP8266 WiFi Chip turns the ESP8266 into something much better than a UART to WiFi module; now you can create a Internet of Things thing with just $5 in hardware. You can write the software using C programming language and GCC compiler to processor in the module (80MHz Tensilica). Included in the SDK are sources for an SSL, JSON, and lwIP library, making this a solution for pretty much everything you would need to do with an Internet of Things thing. Looks interesting, I just have to find time to test that out…

 

Review articles on ESP8266

First impression on the ESP8266 serial-to-WiFi module

The Current State of ESP8266 Development

Review on the new and cheap esp8266 WiFi module – video

The Current State of ESP8266 Development

Sites on ESP8266 information:

Wi07c ESP8266 module data

Nurdspace ESP8266

Hackaday ESP8266

FreeIO ESP82666

translation of the datasheet and AT command set

ESP8266 WiFi module

Project pages:

Using the ESP8266 module
A Development Board for the ESP8266

ESP8266 and PL2303HX-gpio adventures

Update Firmware ESP8266Cloud Update - also video

A Proof of Concept Project for the ESP8266

The ESP8266 Becomes a Terrible Browser

ESP8266 Retro Browser – Accessing a web site with an ESP8266 serial WiFi module and an Arduino Mega

Keep an Eye on Your Fermenting Beer with BrewMonitor

ESP8266 weather display

An ESP8266 Based Smartmeter
Checking Email With The ESP8266 – reads the subject and sender lines from the latest email and displays it on an LCD
ESP8266 Wifi Temperature Logger – using the ESP8266 and Arduino to update a remote Thingspeak server

Adding wifi to a desk lamp with the Wi07C (ESP8266)

Places to order:

ESP8266 module from Electrodragon

ESP8266 from Banggood.com

SDK:

An SDK for the ESP8266 WiFi Chip
The ESP8266 SDK is finally herealong with a VirtualBox image with Ubuntu that includes GCC for the LX106 core

Source code examples:

306 Comments

  1. Tomi Engdahl says:

    IOT based Voice Controlled Home Automation using ESP8266 and Android App
    https://circuitdigest.com/microcontroller-projects/iot-based-voice-controlled-home-automation-using-esp8266

    Welcome to another exciting Project in which we will build a Voice Controlled Home Automation System using ESP8266 Wi-Fi module, where you can control your Home AC appliances using your Voice though an Android App from anywhere in the world. Yes, your dream of making your loads (Light/Fans) to turn ON or OFF by simply using a voice command is going to come true at the end of this project.

    Just like in the previous project we are going to program our ESP8266 module with the help of the Arduino IDE. There is a slight modification made in the program. This modification is made so that your ESP8266 connects to a constant IP address every time it establishes a connection with the Router.

    Port Forwarding your ESP8266 IP:

    The first step is to enable Port forwarding in your router (modem) so that you can access your ESP from anywhere in the world, just by entering your public IP. Whenever our ESP8266 connects to our home/office router it will be given a Unique IP address and this IP Address is used to access the ESP8266 through web browser. This IP address is restricted within your Home/Office Network, meaning you can’t access it globally; it can only be accessed by devices that are connected to your router. Port forwarding is the Technique through which we can make this webpage load globally. After port forwarding you can use your public IP to access this webpage from anywhere in the world. Sounds cool right!! Let see how we can get this done. To do this you know the following beforehand.

    1. The manufacturer name and IP address of your Router. This can be easily found by looking at the router. The IP address will also be mentioned on a sticker. If not Google to know your Routers IP.

    2. The username and password of your routers login page. Most routers will have user name as “admin” and password as “admin”.

    3. The IP address allocated to your ESP8266 module. This is the address that you use to access the webpage of the ESP module.

    4. The IP address of your Internet service provider (public IP address). This can be found by simply Goggling “what is my IP”.

    Creating Applets using IFTTT service:

    We are one step away from completing this project. The last step is to create the Applets in the IFTTT website. This is where we instruct our Moni for different voice commands to control different Home appliances at home.

    Reply
  2. uniquetees.us says:

    The art has been designed. I have a relationship with the printer, who has printed quite a few other runs
    of shirts for me.

    Reply
  3. Tomi Engdahl says:

    Garage Door Opener Logs to Google Drive
    https://hackaday.com/2017/01/15/garage-door-opener-logs-to-google-drive/

    A garage door opener is a pretty classic hack around these parts. IR, Bluetooth, WiFi, smartphone controlled, web interfaces — we’ve seen it all. But if you want to keep track of people going in and out, you need some way of logging what’s happening. You could go ahead and roll up your own SQL based solution, tied into a custom web page. But there’s an easier way; you can build a garage door opener that logs events to Google Drive.

    [WhiskeyTangoHotel] was looking for an ESP8266 project, and a garage door opener seemed just the ticket. It’s simple enough to code up, and control over WiFi comes in handy. Interfacing with the garage door was simple enough — the existing opener uses a simple push button, which is easily controlled by wiring up a relay to do the job. Logging is as simple as having the ESP8266 send requests to IFTTT which is set up to make posts to a Google Sheet with status updates.

    The project is fairly basic, but there’s room for expansion. By using separate Maker Channel triggers on IFTTT, different users of the garage door could be tracked.

    ESP8266 WiFi Garage Door Opener from any Web Browser
    http://www.whiskeytangohotel.com/2017/01/esp8266-wifi-garage-door-opener-from.html

    Reply
  4. Tomi Engdahl says:

    BBSing with the ESP8266
    http://hackaday.com/2017/06/17/bbsing-with-the-esp8266/

    Modems have been around for longer than the web, and before we had Facebook we had the BBS scene. Somewhat surprisingly, people are still hosting BBSes, but have fun finding a landline these days. [Blake Patterson] is one of the leading aficionados of retocomputers, and recently he took it upon himself to review an interesting new device. It’s the WiFi232 Internet Modem, a device that turns a WiFi connection into something a computer with a 25-pin RS-232 connector can understand.

    The WiFi232 is made by [Paul Rickards], and given the last few years of WiFi-enabled retrocomputing projects, it’s exactly what you would expect. Onboard the WiFi232 is an ESP8266 module emulating the Hayes AT command set. Baud rates from 300 to 115200 are supported, with power provided through a USB mini jack or solder terminals.

    The Wonderful WiFi232: BBSing Has (Literally) Never Been Easier
    http://www.bytecellar.com/2017/05/30/the-wonderful-wifi232-bbsing-has-literally-never-been-easier/

    Over the past year or so, I’ve been loading up SyncTerm and logging in to various telnet-accessible BBSs here and there — nothing too consistent

    Paul’s WiFi232 Internet Modem is an inexpensive device that lets you BBS the way it was meant to be done, on hardware from the golden age of the Bulletin Board System.

    In a nutshell, it works like this: The WiFi232, as far as your vintage computer is concerned, is a Hayes telephone modem. It accepts standard AT commands as well as AT commands that go rather beyond the standard Hayes commandset. The purpose of the device is to act as a bridge between your serial port and your local WiFi router. It has a 25-pin RS-232 data interface and a Mini-USB connector for power — it should work with any computer sporting a standard serial port.

    Reply
  5. Tomi Engdahl says:

    Practical IoT Cryptography on the Espressif ESP8266
    http://hackaday.com/2017/06/20/practical-iot-cryptography-on-the-espressif-esp8266/

    The Espressif ESP8266 chipset makes three-dollar ‘Internet of Things’ development boards an economic reality. According to the popular automatic firmware-building site nodeMCU-builds, in the last 60 days there have been 13,341 custom firmware builds for that platform. Of those, only 19% have SSL support, and 10% include the cryptography module.

    We’re often critical of the lack of security in the IoT sector, and frequently cover botnets and other attacks, but will we hold our projects to the same standards we demand? Will we stop at identifying the problem, or can we be part of the solution?

    This article will focus on applying AES encryption and hash authorization functions to the MQTT protocol using the popular ESP8266 chip running NodeMCU firmware. Our purpose is not to provide a copy/paste panacea, but to go through the process step by step, identifying challenges and solutions along the way.

    MQTT is a lightweight messaging protocol that runs on top of TCP/IP and is frequently used for IoT projects. Client devices subscribe or publish to topics (e.g. sensors/temperature/kitchen), and these messages are relayed by an MQTT broker.

    The MQTT protocol doesn’t have any built-in security features beyond username/password authentication, so it’s common to encrypt and authenticate across a network with SSL. However, SSL can be rather demanding for the ESP8266 and when enabled, you’re left with much less memory for your application. As a lightweight alternative, you can encrypt only the data payload being sent, and use a session ID and hash function for authentication.

    A straightforward way to do this is using Lua and the NodeMCU Crypto module, which includes support for the AES algorithm in CBC mode as well as the HMAC hash function. Using AES encryption correctly requires three things to produce ciphertext: a message, a key, and an initialization vector (IV). Messages and keys are straightforward concepts, but the initialization vector is worth some discussion.

    IVs make pattern analysis more difficult. An IV is a piece of data sent along with the key that modifies the end ciphertext result. As the name suggests, it initializes the state of the encryption algorithm before the data enters. The IV needs to be different for each message sent so that repeated data encrypts into different ciphertext

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *

*

*