close-circle
Close
0%
0%

ESP8266 Retro Browser

Accessing a web site with an ESP8266 serial WiFi module and an Arduino Mega 2560.

TM
Similar projects worth following
close

A simple Arduino program to access the retro.hackaday.com site via an ESP8266 serial wifi module.

Contains fairly detailed instructions for getting things working on an Arduino Mega 2560 with a version 2 module and notes on what has changed since the Seed Studios tutorial was written (for the version 1 module).

I've tried to avoid calls to delay() where possible, as these tend to do more harm than good: the default Arduino hardware serial buffer is only 64 bytes. (See SERIAL_BUFFER_SIZE in HardwareSerial.cpp)

  • 1 × ESP8266 Serial Wifi Module Circa $4.50 from AliExpress. Mine is a version 2 (115200bps, firmware 90)
  • 1 × Arduino Mega 2560 I used an "Inland" brand clone ($20 from Microcenter)
  • 1 × Bi-Directional Logic Level Converter Breakout Board Sparkfun Part # 12009 - $3
  • 1 × 3.3V Power Supply The WiFi module draws too much currentto power it from the Arduino's 3v3 pin.

  • 1
    Step 1

    Getting Starting - Changes to the Seeed Tutorial

    After a 3 or 4 week wait, your ESP8266 Serial Wifi modules have finally arrived from China. Now what?

    For a first program, most people head for the short tutorial at seeedstudios

    http://www.seeedstudio.com/wiki/WiFi_Serial_Transc...

    The Seeed tutorial is written for the version 1 module with a 57600 baud rate serial link. The version 2 module that is currently shipping runs at 115200 bps.

    Also, the version 2 module requires 5 connections rather than the 4 shown in the tutorial. You need to pull the chip-enable (CH_PD) pin high - by connecting it to a 3.3V source via a (say) 10k resistor. The CH_PD pin is to the right of the TXD pin shown in the Seeed tutorial. (Be smart and google for an exact match to your module before wiring up.)

    The tutorial uses an Arduino UNO variant. Because the module link runs at 115200, you have to use a hardware UART (serial) module to talk to it. On the UNO this is a problem, as the Uno only has one UART module. The tutorial program therefore uses a soft serial port to communicate with the monitoring PC (via an FTDI/Max232 or other TTL/Serial or TTL/USB converter).

    The soft serial port can only run up to 19200 bps. You'll very quickly find that if you attempt to suck data from the WiFi module at 115k and blow it to the PC at 19k, the buffers on the WiFi module will rapidly fill and your TCP connection will be dropped.

    You can save yourself a lot of hassle by picking up an Arduino Mega 2560 with 4 hardware UART modules. ("Inland" branded clones are available from Microcenter for $20.) This allows you to forward data to the monitoring PC at the same rate as it's received from the WiFi module. (A $20 Teensy 3.1 might be even better - see Conclusions below.)

    In this photo you can see pins TX3, RX3,TX2,RX2,TX1,RX1 at the top right of the board. They are the transmit (TX) and receive (RX) connections for hardware UART3, UART2 & UART1. UART0 is connected to the USB port (and is broken out to the left of TX3).

    Note also that in the Seeed tutorial the WifiModule is connected directly to the Arduino's TX & RX pins. You might get away with this, but you might not, and then you'll have to wait another 3 or 4 weeks for a new module. I converted the 5V serial signal from my Mega 2560 to 3.3v using a Sparkfun bi-directional level converter module. These cost about $3 and might save you tears.

    On the subject of power, you'll need a separate 3.3V power supply. The WiFi module sucks more current that the 3V3 pin of an Arduino can supply.

    To be ctd... If I can work out how to embed source code.

    void test()
    {
    Serial.println("Hurray!");
    }
  • 2
    Step 2

    Wiring Up

    So, connect the module's VCC pin to the positive rail of your 3.3V power supply, GND to the supply's ground rail, TX to (say) LV1 of your level converter, RX to LV2, and connect CH_PD to one end of a 10k resistor, the other of which is connected to your +3.3V rail.

    The LV pin of the level converter is connected to +3.3V, GND to supply ground.

    On the other side of the level converter, connect HV to your Arduino's 5V output, GND to an Arduino GND output, HV1 to RX1 and HV2 to TX1. Note that the module's transmit (TX) is the Arduino's receive (RX) and vice versa. We're using the Mega 2560's UART1 ("Serial1") to communicate with the module, so we can use UART0 ("Serial") to communicate with the PC monitor via the Arduino's USB cable.

  • 3
    Step 3

    Fritzing Diagram of Connections

View all 10 instructions

Enjoy this project?

Share

Discussions

blfuentes wrote 04/06/2015 at 12:46 point

I tried this using my arduino uno and softwareserial instead of serial1, but it didn't wok. The Get just doesn't return anything. It says SEND OK, but no more. 
I also ran the AT commands directly through RX TX connected but the same. The get statements fail for some reason. I read about flashing the esp8266 and replace the firmware for the nodemcu, so I ordered the usb 2 serial...

  Are you sure? yes | no

satsatt58 wrote 10/20/2014 at 22:31 point
I was able to learn from your code quite well and adapted it for my studies.
I tested it slightly modified with a Teensy3.1 for different Baud rates and direct connected only with a 3,3V breadboard Power supply. If i would be qualified i would make a library out of it because it is very stable and doesn't need any delays in the loop. Thank's

  Are you sure? yes | no

jaromir.sukuba wrote 10/06/2014 at 19:57 point
Perhaps I'm blind, but I can't see the source code. Could anybody, please, point me to the right direction?

  Are you sure? yes | no

TM wrote 10/07/2014 at 01:00 point
@Jaromir: there's a url in §8 (you have to click on "See all instructions" to see it).

  Are you sure? yes | no

TM wrote 10/04/2014 at 22:16 point
@carlos1wx: I've only tried 10-digit hex. If you log in to the admin account of your router, you may be able to see the hex equivalent of whatever ASCII pass-phrase you're using.

  Are you sure? yes | no

carlos1wx wrote 10/04/2014 at 21:51 point
Does anybody know if the SSID+Password works with ASCII passwords or only HEX ones?

  Are you sure? yes | no

TM wrote 10/01/2014 at 22:31 point
@Nickson: Thank you for the feedback - always a relief to know that the code works for someone else.
@Benchoff: Will do. Hopefully it will save proud new module owners a little time.

  Are you sure? yes | no

Nickson Yap wrote 10/04/2014 at 14:09 point
btw, I did not use any logic level converter. I just put 100Ohm resistor between Arduino TX and ESP8266 RX pin. Wihout the resistor, it worked just fine :P
Of course the ESP8266 was supplied with 3.3V, from the Arduino xD

  Are you sure? yes | no

Benchoff wrote 10/01/2014 at 21:39 point
Awesome! The retro edition comes in handy once again!

If you want to submit this to the tips line, I'm pretty much obligated to post it to the blog.

  Are you sure? yes | no

Nickson Yap wrote 10/01/2014 at 15:59 point
Wow!
Your code worked like a charm!
I've been looking around for tutorials but they do not work well.
I couldn't GET any data previously, Now with your code, it just worked!

Detailed documentation! Nice!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates