Thursday, January 8, 2015

Wi-Fi revisited with the ESP8266 chip

The new ESP8266 chip has created quite a buzz in the recent months, and I have decided to give it a try for Wi-Fi communications between my instruments and a Nexus tablet. The ESP8266 is a 3 $ chip that can be programmed as a Wi-Fi access point (AP) as well as as client for a router (STA) at the same time if required. It can even host a small Web server. An SDK (Software Development Kit) is available to configure the microprocessor to specific needs.

In my case, I use it as UDP server to send the serial output generated by my system. The UDP packets are sent at the 10 Hz rate, and contain a payload of 76 bytes (mostly measured and calculated values in floating-point format). The payload contents are described here. And how the calculations are made is described here.

The Nexus tablet is programmed as a UDP client, connected to the ESP8266 AP network visible to any Wi-Fi device. When the tablet software sends a ‘START’ message to the ESP8266, it is bombarded back by the 10 Hz packets until it sends a ‘STOP’ message. These data are used to refresh the displays in real-time on the tablet. Many different custom displays can be swapped around. Any resemblance to recent professional first-class displays is not coincidental: the Android graphics capabilities are impressive.

Here is the prototype arrangement used. The ESP8266 is a 3.3V device, and a logic level converter is used on the 5 V serial signal from the system.

For development with the SDK and programming, I used this Eclipse-based tool-chain, on a Win7 64-bit machine: Espressif DevKit for Windows.


  1. Your posts are inspirational and very useful, thank you! I am building a small yacht and have decided to do as much of the electronics as I can myself. Apart from the cost savings, I will need to learn a great many new things to get this right, I have no real knowledge of electronics, micro processors and the last time I programmed anything I was in varsity and using fortran! Still, I am figuring a lot out as I go, but I need a point in the right directing with respect to your graphics on your displays. How do you do the graphics on computer and in android?

    1. Richard, for PC applications, I have used both:
      Microsoft Visual Studio 2005 (C++ with MFC classes), and Microsoft Visual C++ 2010 Express.
      For Android, I use Android Developer Tools (Java).

      In all these environments, I am using the same approach:
      - a thread is continually monitoring the serial input from the instruments, and when a complete data packet is received (10 times per second),
      the main thread is asked to refresh its graphics view through an 'invalidate' command
      - the main thread then draws in memory the next image to be displayed, using the new data, and when finished, splashes the new image on the screen, creating a movie-like experience at 10 Hz.

      For several displays, I re-use a background image to which I add the needles and numbers corresponding to the current data.

    2. Thank you. I'm going to focus on the hardware side first, but already starting to look at the options you mentioned.

  2. Hi, I've just about completed a project converting my old wind and boat speed sensors to output NMEA and then transmitting the info via a ESP8266 01.
    Can you give me more details regarding you nexus app and where or if i can download it:

    1. Hi Chris, my source code for the app is always changing and never in an acceptable form for publication. In this blog, I try to illustrate the main ideas and leave the details out for clarity. If you have a specific task in mind, let me know what you want to achieve and I may provide some useful feedback or directions.