Internet of Things pt1: ESP8266

Jumping on the IoT bandwagon

It seems I can’t escape from the “Internet of Things”… at work the development tool vendors spam me with how their tools enable IoT and their wild market growth predictions; at home in my making hobby IoT articles are popping up all over.

What does a guy that has too many long term projects on the go need?  That’s right… another project! So here’s the start of what might turn into a full IoT project.  In any case the short term goal is to look at wi-fi and get my head around the ESP8266 device.

I have a new fish tank in my home office, so this will probably be my thing on the internet…







ESP8266

A lot has been written about this on the net by smarter people than me so this write up is just a simple run through of what I did to get mine working.  If you don’t know what the ESP8266 is either have a google round or read on and I’ll demo some of what it can do…

The first problem is that the 4 x 2 pin out of the chip doesn’t work with a breadboard, because the rows of pins are next to each other you can’t put it directly into a breadboard without shorting it out.

One guys solution to this issue is included in this video: https://www.youtube.com/watch?v=9QZkCQSHnko

My solution is to bend the pins out to be 90 degress from each other and solder on 90 degree pins to create the spacing:










Quick test that it actually works

These devices cost around £2 posted on eBay, I always expect stuff that does so much for such a small price to not work.  So the first test is to power it up and see what happens…


















Firstly…  this is a 3.3v device and the word is that it doesn’t like 5v.  In the image the ESP8266 is being powered with the 3.3v out of my USB to serial board that I use to program Arduino Pro-Minis. Don’t connect it to the 5v out. 

There are just 3 connections to the ESP8266 here, 3.3v, Ground and the CH_PD pin, which is the enable pin, is pulled high by a 1K resistor to 3.3v.

The velcro cable tidy is just for stress relief, holding the USB cable to the bread board. 

On the iPhone you can see the unsecured wi-fi AI-THINKER… yes! it works, just 3 connections and the ESP8266 has a wi-fi access point running, albeit not connected to anything at the moment. I notice it’s not the only unsecured wi-fi near me – roll up roll up, free wi-fi over at mine…


Digging a little deeper…

Lets use the serial of the Arduino programmer to communicate with the ESP8266…  



















This is where there were a few complications, I had a few issues. rather than go into it, I’ll just provide what worked for me.

The ESP8266 is a powerful device and it draws a fair amount of current in operation, you can’t run it just on the 3.3v supply from the USB to Serial device. You don’t need a bench power supply, but you do need a source of 3.3v that can deliver the juice when the device needs it (I read upto 400mA peak).



















So in addition to the 3 connections we started with I have added the beefier power and connected the Transmit and Receive lines of the USB to Serial to the Tx and Rx pins of the ESP8266.

So here I have the Tx and Rx being driven at 5v, I’ve read some say don’t do this and others say it’s fine.  All I can say is that trying a 5v to 3.3v level shifter didn’t work for me and I’ve been driving the serial at 5v for a couple of hours and nothing has gone bang yet.


I installed a serial program called Termite and tried out some AT commands


























Sending a command like AT+GMR gets the ESP8266 to reply with it’s version details.

AT+CWLAP gets it to list out the wi-fi networks available.

So let’s try and connect…



The blacked out bits are my login details for my wi-fi, I didn’t get the syntax right first time round.  the AT+CIFSR command returns the ip address, confirming I managed to connect to my local wi-fi with the ESP8266… magic.


The next step is to check the firmware version and see if I need to upgrade.  I have read about a Lua based firmware that people are recommending so I need to do some reading up…  

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s