Arduino and ESP8266: Starting up

For those starting up using the ESP8266 and Arduino what follows is some information to get things rolling:

First make sure that the ESP8266 is powered properly, through an external 3.3 volt supply or through and external supply with a 3.3 voltage regulator, that can provide enough power to the ESP8266 chip. We are talking here in the 300mA and upward rages…

We can use the Arduino UNO or Mini Pro, but with a single UART, either its connected to the computer or to the ESP8266.

It’s possible to use the Software Serial library, but it only works for simple tasks with low rate output from the ESP8266.

Here it is a simple sketch that feeds the ESP8266 from the computer through an arduino board using the SoftwareSerial library:

#include <SoftwareSerial.h>
SoftwareSerial esp8266(6, 7); // RX, TX

void setup() 
{
 // Open serial communications and wait for port to open:
 Serial.begin(115200);
 esp8266.begin(9600);
}

void loop() // run over and over
{
 while (esp8266.available()>0 )
 Serial.write(esp8266.read());
 
 while (Serial.available()>0 ){
 esp8266.write(Serial.read());
 delay(100);
 }
}

I’ve grabbed this code from somewhere on the net, but here it is again…

We can now use the computer to comunicate with the ESP8266, but the computer terminal emulator must add a \n at the end of the \r when pressing ENTER, otherwise it won’t recognize the AT commands. The picocom program can do this easily: picocom –b 115200 –omap crcrlf /dev/ttyACM0
For exiting the picocom program just press CTRL-A + X

Advertisements

One thought on “Arduino and ESP8266: Starting up

  1. Pingback: ESP8266 – NodeMCU / LUA – unsort Links | Asimetris 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 )

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