Introduction to IOT with ESP8266
The Internet of Things is an oft-mentioned buzzword in the field of computer science and related subjects, especially in recent years. I'm sure you have came across an image similar to the one shown below:
In short, Internet of Things (IOT) seeks to embed sensors in a range of appliances and devices, expanding the user experience and further integrating various objects with the Internet for increased functionality. For example, a motion sensor could be positioned at entryways and indicate when anyone enters your home.
So, how do you start working with the Internet of Things?
If you are someone who has little experience with embedded devices and electronics, have no fear. In the beginning of this year I found myself in a similar boat.
I would recommend those in such a scenario to get themselves a cheap Arduino (Raspberry Pi may work just as well, although I don't have experience with them myself). The Arduino Nano found below should be great for a novice:
If you are willing to spend a bit more the Arduino Uno is great for beginners as well:
The Arduino movement is a mixed bag servicing hobbyists, seasoned veterans, and everyone in between. The Arduino was one of the first programmable circuit boards that can be easily programmed using a USB cable. The Arduino IDE uses a simplified version of the C++ programming language. Overall the Arduino devices and platform are very accessible and a great choice for those new to electronics.
While the Arduino is great, this post is about the Internet of Things. So once you find yourself able to upload programs and have success working with the Arduino it is time to add Internet access to your project.
The Wi-Fi device covered in this post is the ESP8266(ESP-01 shown):
The ESP8266 is a self contained SOC (System on Chip) with integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi network. The ESP8266 is capable of either hosting an application or offloading all Wi-Fi networking functions from another application processor. Each ESP8266 module comes pre-programmed with an AT command set firmware, meaning, you can \ hook this up to your Arduino module and get about as much WiFi-ability as a WiFi Shield offers, with little effort required. The ESP8266 module is an extremely cost effective board with a growing community behind it.
There are various versions of the ESP8266, some offering more functionality than others. Some ESP8266 boards are able to be directly programmed out of the box, similar to the Arduino. The Adafruit Feather Huzzah is a good option if you are new to electronics and would like to get started programming your ESP8266 as fast as possible.
You also want to purchase an FTDI module:
This is a USB to Serial device allowing you to program your ESP8266 module.
Now that all the materials have been gathered you can begin working with your ESP8266. I would recommend adding the ESP8266 library within the Arduino IDE. This is an easy way to learn a lot about your ESP device quickly. The steps to add the appropriate library are as follows:
- Open Arduino IDE , open Preferences
- Open Boards Manager from Tools > Board menu
- Type in ESP8266 and click install
- Select your ESP8266 board from Tools > Board menu after installation.
From here you will find a wealth of example sketches in the ESP8266 library. Once you ensure your ESP8266 module is working (you can achieve this by using the Blink program), move on to the WifiWebServer Sketch. This allows you to input your own SSID & Password so that your module can access the WIFI. If everything works correctly, upon opening the serial monitor, an IP address will be outputted. If you follow this in your browser, it should bring you to a server with the text Hello World! displayed.
In this tutorial you have learned how to program the ESP8266 via the Arduino IDE as well as creating a basic web server using the ESP8266 device. I will be covering various IOT projects that can be accomplished using this combination of materials in future postings. Also, I will write more on the ESP8266 as there is A LOT to cover.
Thanks for reading! I will leave you will a collection of links to aid in your study.
Resources for ESP8266:
https://github.com/esp8266/esp8266-wiki/wiki
https://cdn.sparkfun.com/datasheets/Wireless/WiFi/ESP8266ModuleV1.pdf
https://github.com/jcmvbkbc/gcc-xtensa
https://cdn.sparkfun.com/datasheets/Wireless/WiFi/Command%20Doc.pdf
https://www.esp8266.com
http://www.instructables.com/id/Using-the-ESP8266-module/
https://nurdspace.nl/ESP8266
Resources for Arduino:
Hi,
Nice article. Expecting Some of these boards in theater mail. Kookingen forward to do some experiments.
Awesome ! I will continue my tutorials, feel free to contact me if you run into any issues