noizZze

Ruby, Rails, Elixir and mobile development blog

Linking ESP8266 with Arduino

I found it super-hard to find meaningful info on how to link a tiny little ESP8266 (ESP-01 in my case) to an Arduino and talk to it.

Schematics

Things to notice here is power regulator 1117-33 that converts 5V of Arduino board into stable 3.3V for ESP8266. We could probably use 3.3V Arduino output, but I read it's not powerful enough for when the module is transmitting. Also I wired Arduino D11 to RXD of ESP8266 through voltage divider, so that 5V is also converted to 3.3V range. Logic level converters can be used here, but I have none handy, so divider be it.

alt

Software

My module was initially in 115200 baud mode. When you don't know that it may cause a lot of confusion. Arduino I have isn't quick enough to do any useful work and catch up, so I had to find a way to switch module to a lower baud rate.

The module speaks AT-commands, and there are dangerous sequences that can brick your module that I won't write here to save everyone from trouble. Here's a pretty good one instead:

AT+UART_DEF=57600,8,1,0,0

It switches UART into 57600 baud mode with 8 bits, 1 stop bit, 0 for parity and 0 for flow control.

Here's the small program that lets you talk to the module in Serial Monitor tool.

#include <SoftwareSerial.h>

SoftwareSerial wifi(10, 11); // RX, TX

void setup() {  
  Serial.begin(115200);
  while (!Serial) { }

//  wifi.begin(115200);
//  wifi.println("AT+UART_DEF=57600,8,1,0,0\r\n");

  wifi.begin(57600);
  wifi.println("AT+GMR\r\n");
}

void loop() {  
  if (wifi.available()) Serial.write(wifi.read());
  if (Serial.available()) wifi.write(Serial.read());
}

Resources

FFMPEG fade in/out expressions

Alpha expressions to help you fade in and out video elements in time.   Read More

Easy options parsing in shell scripts

Simple cheat sheet on shell script option parsing using getopts.   Read More

Elixir meets Docker.io

Detailed recipe of how to build your app Docker image and run it efficiently.   Read More

Cross-platform app links

Notes on making app links work for Android and iOS with XML/JSON samples and Titanium snippets.   Read More

Filtering ListView in NativeScript

Simple and easy to grasp example of how one would filter a ListView in NativeScript.   Read More

Understanding NativeScript binding patterns

NativeScript has one terrific, yet sometimes misunderstood, feature -- data bindings. In this post I would like to lay it out so that it's easy to grasp and start using.   Read More

Dash docset for NativeScript

Release notes for the NativeScript Dash Docset.   Read More

Global data sync in Android apps

This post contains some insights into how global and user-specific sync works in Android apps. Highlights some poorly documented areas of the process.   Read More

Chat rooms app in Elixir in 15 minutes

Showcase post that touches a tiny part of what Elixir and the accompanying tooling can help you build in very short time. Covers Phoenix and Websockets.   Read More