Experimenting with the ESP8266

Recently co-hacker Jay pointed this out to me: http://rayshobby.net/esptoy/ It’s basically a little board that has an even smaller daughter board (an “ESP-12”..more on this shortly) soldered right onto it, plus a USB-serial converter, a 3v regulator, an RGB LED and a button, and it boots up running a little LUA-based firmware that let’s you load little LUA sketches on it. He’s actually running the NodeMCU code on it. A very cool little board that let’s you get little Wifi ‘node’ up and going with minimal effort at the very low cost of $17! He also references a project that led him to put together first the ESPToy 1.0, then the current 1.2. The 1.0 basically combined an ESP8266 with an Arduino, but in 1.2, he did away with the Arduino part entirely.

I was intrigued that the author had basically loaded his own firmware onto the ESP8266 (the ‘ESP-12’ module) little device and started digging into it a bit more. So, it turns out the ESP8266 line of modules have their own embedded 32bit processors, the wifi protocol stack and hardware, and some on-board flash.  They expose GPIO pins and a serial port. Most amazing of all – you can get “bare-bones” ESP modules for less than $5! So, I decided to dig deeper. The LUA runtime is OK, but there aren’t a lot of libraries out there for talking to other things using it. For instance, I’m currently kicking around the idea of an arduino-powered, web-connected universal IR remote – I’d like the greater versatility of Arduion programming, rather than LUA…and the idea little $5 Wifi-connected arduino-like devices is crazy!

So, it seems like there is at least one project out there to program these suckers using the Arduino IDE and code. I’m going to blog my experience here..

ESP Module VariationsFirst step – I ordered a couple of different ESP devices. I should point out that there are a bunch of ESP modules (ESP-01 through ESP-12 at this point).
They’re basically all the same chipset in various configurations exposing different pins and with different (or non-present) on-board antennas.

Then there are many device that have an ESP variation mounted on them an break the pins out to more convenient configurations, add voltage regulator and buttons, etc, and are still very cheap (<$5).

ESP-07 MotherboardESP-12 With Additional ComponentsI got an ESP-07 on a more-or-less bare motherboard and an ESP-12 on a board that has an regulator, RGB LED, LED’s on several GPIO’s, and apparently a photo sensor. The ESP-07 package included an external Wifi antenna that can be snapped on to provide better range than the on-bard ceramic antenna. The ESP-12 package also came with a USB-serial converter that is necessary to connect to these things. I already had one, but figured a spare wouldn’t hurt. Neither of these had any documentation with them.

 also ordered a couple of the ESPToy’s just for the hell of it too 🙂

Bare Motherboard with REgulator I should also point out that first one DOES have a 3v regulator on the back side – even the seller didn’t seem to realize this, but its clearly depicted in the bare version he also sells 🙂

Anyway, having the regulate on-bard is big plus, since it will make actually using them with simple 5V (e.g., USB) supplies easy. (Update: I message the eBay seller to tell him it did have a regulator and he indicated the next version will not, since the chip used on this one is pretty low power. ESP-07 drawing a lot of power is a topic I’ve seen more than once…for instance, they say not to try to use the 3V supply from the FTDI serial adapter like the one in the ESP-12 package, above).

So… here goes..

Everything came at the same time. I plugged an ESPToy in first, since it was the easiest – just plug in a mini-USB cable and it powers up. It fires up the first time with a simple demos that goes into Wifi host mode and serves up a simple HTML page that lets you set the RGB values of the LED. It worked fine..ok, time to go drill into the ‘bare’ modules some..

So, at first, I had trouble getting either to do much. Neither would report or respond to anything over the serial port or show up on Wifi. It seems like there is a lot of variation in terms of what the default firmware is intended to do, but supposedly you should be able to get to a command prompt and do AT commands more or less right off the bat. I tried different baud rates – apparently older firmwares may be 115200 or 57600, while the latest is supposedly 9600 – all to no avail. I was focusing mainly on ESP-12 board and, finally, GPIO JumperI started wondering about the jumper. To flash new firmwares on these suckers, you have to hold GPIO0 (zero) high when you power the board on – this puts it in firmware flash mode. Maybe the jumper is for doing that? Yes! I took the jumper off (and also verified my conjecture with the multimeter) powered it on and right away, a new Wifi network, “AI-THINKER-9B5AC7”, showed up. It took some googling to find the Wifi password, which is “ai-thinker”. I also now get a whole bunch of output over serial as it starts up (my version is operating at 115200 buad) it shows it’s listening on Hitting that url with my browser now produces a “We have a GET request” message on the serial port.

I still get get no response from AT commands, though. My theory is there is a non-standard firmware on this device that leaves AT mode to run the little HTTP demo app. In bit, I’m going to try flashing it with a newer firmware. At this point I also still haven’t gotten any response at all from the ESP-07.


This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Experimenting with the ESP8266

  1. OK – LOT’S of interesting progress. First, It’s clear you want a good firmware. The firmware that came on the ESP-12 package definitely didn’t keep the AT command console active. First I tried the instructions from here http://www.xess.com/blog/esp8266-reflash/ and was able to flash the .9.2.2 version. This got me a prompt, and was at 9600 baud, but AT commands still didn’t work. This blog http://diy.viktak.com/2014/12/first-experiences-with-esp8266.html indicated they had luck using the image from here: https://drive.google.com/folderview?id=0B3dUKfqzZnlwRjFaNTUzZFptbzg&usp=drive_web The .9.5.0 firmware from there (AI-v0.9.5.0 AT Firmware.bin) worked! One other hiccup – the motherboard, which carries the RX and TX pins down to a three-pin connector along with ground, transposes rxtx. So, if you hook up to the three pins, you have switch which jumper is connected to which if you move to the breakout pins coming straight from the ESP-12 module. By the way the NodeMCU flasher (https://github.com/nodemcu/nodemcu-flasher) is a little nicer than the basic one mentioned above..it will apparently flash NodeMCU firmware by default, but lets you select a .bin file too, plus has more bells and whistles.

    Now the little ESP-07 motherboard…try as I might, I could not get it to do anything. No terminal, wouldn’t flash..nothing. Finally, I broke out the multimeter again. Turns out the ESP module was not well soldered to the motherboard – some of the touchpoints, including GPIO0 – which is critical to entering flash mode – and the RX and/or TX pads weren’t connected! I reflowed the pads and presto! It started taking flashes and I’m basically where I am with the other board.

    Next, I’m going to scope out NodeMCU a bit – try out some LUA scripts and whatnot – then see if I can’t get some Arduino code to flash to one of these guys.

  2. More Success…

    Got the Arduino ESP8266 programmer from here: https://github.com/rogerclarkmelbourne/arduino-esp8266
    Under Tools, set Board to “Generic ESP8266 Board” AND set Programmer to “esptool”. Pasted a simple webserver sketch, edited for my ssid/password, put board in firmware upload mode, and clicked upload. It connected and started serving HTTP right away.

    Next, following the turorial on this page http://randomnerdtutorials.com/esp8266-web-server/ I flashed it back to NodeMCU using the nodemcu-flasher, and uploaded a sketch using ESPlorer (https://github.com/4refr0nt/ESPlorer). Worked like a charm.

    Really awesome stuff. I figure NodeMCU will be good for basic stuff, but when I need more complex libraries, there’s like to be a bigger base of support for Arduino at this point.

  3. Pingback: ESP8266 Update | Austinlightguy's Blog

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s