Is there an example of the right way to use an ESP8266 module?

Hello all,

I'm new to the Arduino world. Trying to do as many instructables as I can with the parts I have. But I have been looking all over the web for a simple ESP8266 tutorial, with not much luck.

First of all, is this part not meant to be used with an arduino? Most of the tutorials out there use a USB to TTL module like a FT232RL to write programs to it and use it standalone. Furthermore, it operates on 3.3V making it a pain to make it communicate with an arduino. It also seems to require a tiny bit more amps than the safe range for Arduino's 3.3v port, so it requires its own power supply? Last but not least, it apparently requires its own serial port, so it doesn't work with anything less than an arduino mega?

I'm just getting really frustrated with this part. I thought it would be a simple wifi module for arduino, but it seems to be anything but. Can anyone just point me to a simple tutorial that makes it work with an arduino? Everything I found either didn't have schematics at all, or were using unsafe voltages like plugging it directly to the arduino saying "it works fine for me", or not showing half the circuit and using unclear explanations of what they are doing.

Alternatively, can list what parts I'd need to run it properly, in addition to a FT232RL? Do I definitely need a separate power supply? Or can I work some magic with capacitors, resistors or something? Do I need something like a voltage regulator? A relay? A 2xAA battery pack? A microcontroller of some kind?

Alternatively, can anyone recommend a different wifi module that is actually arduino friendly?

Many thanks in advance.

The ESP8266 - there are several different modules - are a major pain the neck to get working.

You may want to look at https://www.particle.io/

The particle.io website has some pretty cool projects. I guess I'd be getting a photon as a arduino+esp8266 replacement?

Sadly I don't think I'd be able to find these in the backwater country I live in though.

obuw:
It also seems to require a tiny bit more amps than the safe range for Arduino's 3.3v port

Correct. The ESP8266 uses a lot more current when the WiFi radio is active than a standard Arduino 3.3V pin can supply, this will make it unreliable.

obuw:
so it requires its own power supply?

It should be connected to a voltage regulator that can supply enough current. I've read that can be as high as 800mA, other sources say 500mA.

obuw:
Last but not least, it apparently requires its own serial port

Correct

obuw:
so it doesn't work with anything less than an arduino mega?

No, you can use it with an Uno or Leonardo, etc. The Uno only has one hardware serial port so if you connect that to the ESP8266 you can't use it for anything else. You can also use the SoftwareSerial library to use pins that don't have hardware serial capability to communicate with the ESP8266 but you will need to change the baud rate of the ESP8266 from the default rate of 115200 because SoftwareSerial doesn't seem to work reliably at that speed.

I'm glad you're aware of the inaccurate information on the majority of the ESP8266 with Arduino tutorials. It's really a shame there's so much bad information on this topic. I've had success using a couple of ESP8266 shields:

http://www.aliexpress.com/item/Original-DOIT-freeshipping-ESP8266-ESP-13-WiFi-Web-Sever-Shield-for-Arduino-UNO-R3-2560-esp8266/32685676668.html
This one is the best price, the only problem I've found is it comes with a custom firmware. If you want to use the shield with any Arduino library/sketch that is written for the standard AT firmware then you will need to update the firmware using a USB-serial converter. This makes it not so beginner friendly.

http://www.aliexpress.com/item/ESP8266-ESP-12E-UART-Wireless-WIFI-Shield-TTL-Converter-For-Arduino-UNO-R3-Mega/32676295676.html
This one is twice as expensive for some reason but it does come with the AT firmware.

The trick with both of those shields is they are connected to pins 0 and 1, hardware serial pins. This means if you use them with an Uno or Mega you can't use Serial.print() to send output to the Serial Monitor as you normally would do, you need to use Serial exclusively for sending commands to the ESP8266.

This isn't to say that the only way to connect an ESP8266 with a standard Arduino board is to use a shield but it does eliminate some of the potential problems.

The other option is to just program the ESP8266 directly using the esp8266 Arduino core: GitHub - esp8266/Arduino: ESP8266 core for Arduino. In some ways this is actually easier because you don't have to worry about level shifting and serial communication and you can buy a nice ESP8266 board for $2.60 so much cheaper than Arduino+shield but you'll find some differences between the ESP8266 core and the Arduino AVR Boards core. The ESP8266 core is very lacking in documentation. You will frequently find that a library or sketch that works fine with an AVR doesn't work with ESP8266. So this option is not very beginner friendly either.

My take on the ESP's

They are a learning curve for sure and I had to wade through a few tutorials before I got it right.
That said the easy inclusion in the IDE makes working with them a breeze nowadays.

Once you get the hang of it they just work.

I snagged a few of those super cheap psu pucks from Ebay to bring down my voltages and even with that it takes up less space (esp 01) than many of the Arduino offerings. great if you want to just put simple sensors around.

There is actually quite a lot of documentation around but you do have to be wary of some of it.

I also have the shield that Pert mentions first and yes that is a PITA to play with and the documentation for that one is almost non existent.

A lot of the examples I tried on the ESP didn't need too much rework to get going but the lack of decent analog ports (only one) can be a challenge.

Price wise you just cannot go wrong with them so throwing a few IOT devices together can cost pennies compared to using MKRs, feathers, huzzah's etc etc. especially if you use the nodemcu's or esp 01's

Both the Arduinos and the ESP's have different niches they can fill and both are good in some way.

Ballscrewbob:
I also have the shield that Pert mentions first and yes that is a PITA to play with and the documentation for that one is almost non existent.

Actually that one is better documented than most of this Chinese stuff. That's not to say it's actually well documented but the bar has been set so low it's a pleasant surprise to find any at all:

Now the second shield has nothing. It says on the board "More info & tech support please go to elecshop.ml". That's a joke. If you go to that site it's just a taobao shop in Chinese. There's no documentation or tech support. They don't even tell you which pins the ESP8266 is connected to. Apparently these sellers can't comprehend that spending just a little bit of time documenting this stuff will pay off many times over in increased sales. The target market isn't electrical engineers, it's beginner electronics hobbyists.

@ Pert

There is actually a little more info than that if I can find the links.

I spent about a month talking to the actual developers who admitted they were rushed into releasing it and that it wasn't able to do a lot of what the sellers were stating.

The seller just wanted more information about what I was using it for and how I had it set up etc and that went on until the refund period had run out (gotta watch some of those sneaky eBay sellers) but the developer kindly refunded it so in the end it didn't cost me anything.

It's still sat around here somewhere gathering dust.

@Ballscrewbob what problems did you encounter with that shield?

I've spent more time working with the second one but so far didn't have any problems with the first.

I usually don't use shields in my projects but I have a friend who doesn't have much Arduino experience who wanted to make a WiFi connected burglar alarm so I suggested he use a shield to make it more simple and bought a couple for myself so I could help him out. He has been using a couple of the second shields for a few months now with no problems and bought some of those cheap DOIT shields to get the cost down for making more units but I think he's been too intimidated by the firmware update instructions to proceed.

I had issues making it talk to the UNO and the only way to fix it was the major reset where you hold down the buttons for a while.

It was also stopping and starting randomly despite having enough power.

Also had a bad habit of forgetting login passwords too and some settings did not always take hold.

Never managed to get it above wireless G which wasn't a big issue but I bought it after seeing it said B,G,N.

If I used it on its own it was quite stable but after all the messing around to get a simple web page server going I swapped to other ESP's and have never looked back.

Now whenever I get an ESP first thing I do is upgrade the firmware to the floating point and then throw it at the Arduino IDE.

No more quirky LUA windows etc.
Maybe if I find it again I will try that approach to the shield.

Moving house at the weekend so lots of my stuff is in limbo until I get a workbench back up and a whole raft of other more important (to the wife) jobs done.

Were you using the firmware that the shield ships with? I wonder if it was a software or a hardware issue.

I tried the shipped firmware and another recommended by the DoIt doctors of intelligence (or whatever they call themselves)

Neither had the desired results but I am pretty sure they have made changes since then as the newer ones have more pins. This one is almost 9 months old.

Ballscrewbob:
another recommended by the DoIt doctors of intelligence

Was that the standard Espressif AT firmware? I immediately changed the firmware to the latest AT firmware on mine once I realized they had some weird custom one on the shield. The shipped firmware seems like it might be useful for some applications but I wanted to use a library written for the AT firmware so it was useless to me.

The Adafruit ESP8266 Huzzah is $9.95 and worked first time for me using their tutorial (as a stand-alone device...not connected to an Arduino). I also easily got a number of the example sketches to work with no problems. Subsequently, I had some issues, but got a quick response and fix from gitters.

It also has level shifting on the UART and reset pin, and an on-board 3.3V out, 500mA regulator.......