If you recall my last post, I was seeing lousy throughput over WiFi using the ESP8266 module. I had decided to write new firmware for the module based on the Arduino Core for ESP8266 project. That project provides the base SDK from Expressif (the chip/module maker) and a set of libraries that make it easier to access all sorts of functionality on the module.
Besides solving the horrendous data rate problem, I also wanted to replace the stock AT command set with something that was easier to write code for and more specific to my project. I started from scratch on the command interpreter and introduced a simple, consistent set of commands to configure just the features I wanted with an emphasis on an asynchronous architecture. That part was completely successful and allowed me to remove a lot of troublesome code from the Teensy-side library.
But my throughput testing showed the module to be no faster than when it was running the stock firmware. What the hell? It took a few days of Googling around and head scratching to finally find the problem and solution. It turns out the WiFi module was sending packets one byte at a time even though I was writing many hundreds of bytes at a time. That's a very bad thing to do and totally explains the lousy results I was seeing. The solution to the problem was to move to the "development" version of the Arduino Core for ESP8266 project which includes a fix for this problem. Basically, I downloaded the latest version and recompiled my code, and viola, the throughput went up by a factor of 200! I'm now seeing over 220 kB/s, which is well above my requirements. Problem solved.
But while I was looking for a solution to the problem, I came across the ESP32 module. Made by the same company, Expressif, that makes the ESP8266, this new module has only been on the market for a few months. It's a little difficult to get your hands on, but I managed to get a development board that I'll be playing with in the coming months. This new module is interesting because:
It's got a dual core processor
It's clocked at a higher speed than the processor on the ESP8266
It includes Bluetooth
It's programmable just like the ESP8266
Basically, I can replace the much older HC-06 Bluetooth module as well as the ESP8266 WiFi module. It saves money, circuit board space, precious I/O pins, and allows me better control over Bluetooth, just like I now have with my new ESP8266 firmware. In the coming months, I'll be porting my ESP8266 code to the ESP32 and working on getting Bluetooth up and running. I've already removed the HC-06 Bluetooth module from the prototype in anticipation.
Good news all around. Meanwhile, I've also made progress with the SD card and IMU, which I'll write about soon.