Arduino Headless Setup & ESP8266 (WIFI cheap chip!)

Rather Stunning MCU!!! — #arduSerie 16

J3
Jungletronics
5 min readSep 25, 2016

--

This very cheap chip has 48 times more RAM for data them the Arduino.

This chip has some secrets to setting it as a web server, it is what we will see in this article.

Specifications:
ESP8266 is Tiny, Self-contained, low-power, low-cost, SOC(System on a Chip), have ability to send/receive TCP/IP network via an antenna that's etched on its circuit board, have a number of pins that are capable of send/receive signals
Processor: ARM ESC DA8626
Serial-to-WiFi IC
802.11 b/g/n WIFI
Support: PWM, SPI, SERIAL, I2C

Hello hobbyists, I bought this chip and plan to use it in our implementation of the Weather station.

Playing with ESP8266 via the web in the amusement park

This chip has some secrets to setting it as a web server, it is what we will see in this article.

This very cheap chip has 48 times more RAM for data them the Arduino.

We took the ATmega 3286 off to use Arduino only as a serial port… ups! we bypass it!!!

The interesting thing is that the community has created the framework for work on the ARM directly with the Arduino ide.

So we will use ESP8266 in stand-alone mode.

Let’s get started!!!

Scheme to flash & run the sketch below or follow this post.
Pinout & Color-Guide — see jumpers colors!!! 👆

Go to Arduino IDE, menu File> Preference, and paste the address below into the “Additional URL boards Manager”:

http://arduino.esp8266.com/stable/package_esp8266com_index.json

Then go to the Tools menu> Board> Board Manager … Install the ESP8266 board plugin and have fun with examples!

Have patience, the code is large and the downloading takes time!!!

To put the ESP8266 in programming mode, simply connect GND to the GPIO0 Module and pulse GND to Reset while Arduino is compiling.

After loading the Arduino programming in ESP8266 reset the module by putting the GPIO0 pin to float and pulse GND to Reset again!

Works like a charm and the examples brought by the Espressif Community are fantastic!!!

There are several and what I did was the Hello_Server (shining with JSON).

Let’s quickly review the code.

Guided by a fellow programmer and partner of Jungletronics Ishida (https://github.com/alexishida?tab=repositories) who could point us in the right direction, we modified the output code to JSON. The idea is to connect the Arduino with sensors and to make it serving restful web service.

We will use JSON and HTTP REST as communication protocols. We are very close to this dream !!

Code (GitHub REPO):

We carry the necessary libs. There are two variables of our wifi network and set the server on port 80. Standard right?!

We keep a variable for the led but t in the module. We declare the method that handleroot().

The setup is used to configure the LED as output, put the serial in 115200, firmware standard began our wifi, and print a blank line, according to HTTP protocol.

While the connection is not established, a point is printed on the serial.

MDNS is a simple implementation of multicast DNS query support for an Arduino running on the ESP8266 chip. Only support for resolving address queries is currently implemented.

The (This) line server.on: inside this part, we can put how many links we want.

The loop to manage the client session.

keep watching this video series because we will present the assembly of a board to help you with prototyping this chip. We use little solder. See our result:

CADDY — For ESP8266 Module to sit into!!! To program use this USB adapter; To run it use this one. Or follow this post.

Collision Condition & Route to Nowhere:

Collision Condition & Route to Nowhere

Let’s assume we want to connect all together: Arduino, ESP8266 via USB cable from your laptop.

In this scenario, the Arduino sends to your computer while the

ESP8266 tries to transmit too in the same way.

Ops!

Certainly, data will collide !!!

Garbled data cannot be properly interpreted by ESP8266 — You cannot program Arduino or talk to it from your computer while ESP8266 is connected to a computer serial.

Now in another scenario (green on the graph).

The computer sends a message to the Arduino.

Oops again!

Which route to follow? There are two options!

Who does not know where to go, go nowhere!

This is a collision condition and route do nowhere scenario!

Both try to transmit to the computer at the same time.

ESP8266 will most likely RESET!!!

Now let’s separate the components.

First, remove the Atmega chip from Arduino and program ESP8266, or, better, bypass it!! (see video below)

Then plug back the ATmega and program the Arduino

Simple isn't it?

Use module ESP8266 in WiFi and Arduino in standalone mode!!!

Thanks for watching the video (read this article) !!!

Bye!!!

Download all Project Files

Troubleshooting:

When initiating the upload process in the Arduino IDE, press the Upload Button and simultaneously hold the White Wire connected to RST through 10k Ohms, providing a pulse on the GND. This action should be performed a few seconds before the Arduino indicates the uploading phase, typically during the compilation process. Ensure that the Orange Wire (GPIO0) is grounded during this time.

Once the upload is complete, detach the Orange Wire from the GND, allowing it to float momentarily. Subsequently, while opening the Serial Terminal, provide another pulse on the GND using the White Wire. Verify that the Serial Monitor acknowledges the:

Connecting to <your_wifi_ssid>
……
WiFi connected
Server started
<your_port_number>

Do not forget to edit the code according to your WiFi network;) <your_wifi_ssid> and <your_port_number>

Based on: Renato Aloi’s Tutorial (Thanks a lot for your hard work Aloi!!!)

Migrate from: http://jungletronics.blogspot.com.br/

Related Posts

Meet IoT Boards: ESP8266 & ESP32 — Which are the best? ESPs or RPis or Arduino Boards? IoT — Episode #01

Arduino Headless Setup & ESP8266 (WIFI cheap chip!) — Rather Stunning MCU!!! — #arduSerie 16

Flashing The Official ESPRESSIF Firmware in ESP8266 !!! — Easy ESP8266 Flashing!!! — #arduSerie 17

Get Started Using AT Commands w/ ESP8266 — Multiple Connection as TCP Server — #arduSerie 19

Your First NodeMCU/Lua Script Flash on ESP8266!!! — Let’s get our feet wet with NodeMCU/Lua and see what happens !!- #arduSerie 20

— Edited in Nov 2018 — Grammar corrections w/ Grammarly — Send code to gist —Troubleshooting

— Edited on Jan 2024 — Grammar corrections w/ Grammarly and some links to adapter —

--

--

J3
Jungletronics

Hi, Guys o/ I am J3! I am just a hobby-dev, playing around with Python, Django, Ruby, Rails, Lego, Arduino, Raspy, PIC, AI… Welcome! Join us!