I’ve been looking for a project to use the ESP8266 (ESP-03) wireless module. While playing around with these modules I figured it would be nice to have a place to send debugging data to without using the the serial terminal. I figured I could hook up a 16×2 display (QC1602A) that I ordered a while ago with the ESP and have a sweet wireless display unit. Unfortunately the ESP doesn’t have enough GPIOs to drive the display. I ended up ordering an Arduino Pro Mini of Ebay to control the display, which would in turn fetch the display data through the ESP.
The first problem I encountered was that the QC1602A display runs at 5V but the ESP8266 runs at 3.3V. Converting the logic levels would be a bit cumbersome because you need a minimum of 6 data lines to drive the display. I looked into getting a 3.3V version of the display and came across an article that described converting the display to 3.3V. That conversion is actually pretty simple and when combined with the 3.3V version of the Arduino Pro Mini (which comes in both 5V and 3.3V) would allow to run the entire circuit at 3.3V. The Arduino actually allows any input voltage between 3.3V and 12V and has a VCC pin that outputs regulated 3.3V.
The Arduino voltage regulator (MIC5205) allows for 320mA of continuous current draw with peaks of 500mA. The display runs at ~20mA, the ESP peaks at 215mA and the Arduino peaks at 150mA. Combined that’s around 385mA peak current draw which should be within the specs of the voltage regulator. Keeping things simple I just connected an USB cable to the Arduino which makes for a nice portable solution.
- 1 x QC1602A v2
- 2 10uF 0805 caps
- 1 330R 0805 resistor
- Max660 voltage converter
- 1 x Perfboard
- 1 x Arduino Pro Mini
- 1 x ESP8266-03
- 3x 10k 0805 resistors
- Hookup wire
- 10k pot
- USB cable
The whole project cost me around $15 for all components including shipping.
On the software side 2 components are at play. There is a simple sketch for the Arduino that receives information from the ESP and sends it to the display. I wrote the main controlling component with NodeJS/ExpressJS, as a job queuing system in combination with a simple API. The API allows to push information to the display via a GET request. This API is what makes the display a handy debugging tool. To get use out of the display while it’s not being used for debugging I wrote several jobs for the queue that show information like date/time, weather, system load, network traffic, GitHub notifications, the next Google Calendar event and unread GMail Messages in a continuous rotation. It is pretty easy to add more jobs and I plan to add support for more in the future.
The source code for both components is available here:
Initially I looked into running the ESP with the NodeMCU LUA firmware. I thought it would be easier than dealing with the AT command API of the original ExpressIf firmware. I discovered though that there is the great WeeESP8266 library, that neatly wraps the AT commands and makes it pretty straight forward to get the ESP working with the Arduino. This has the advantage that you don’t need to write any additional software for the ESP.
Some of the ESP modules default to 9600 baud and others to 115200 baud for the serial connection. SoftwareSerial doesn’t work reliably with higher baud rates. The module I got was an 115200 baud version. It didn’t work at all with SoftwareSerial. I changed the baud rate to 9600 baud and it worked fine after that. The AT command to change the baud rate to 9600 is the following:
You can find detailed info on the parameters in the ExpressIf documentation. You have to be careful with this process. In my first attempt I set one of the parameters wrong and had to re-flash the ESP to be able to connect again. You can use AT+UART_CUR to temporarily change the baud rate, then do some tests and then use AT+UART_DEF to permanently change it.
Below some images of the build.
UPDATE: I designed and 3D-printed a stand for the Altoids tin. You can download the SketchUp file here.