An ESP32 project worth looking at…

…especially if you’re a farmer.

You might have noticed that it has been fairly quiet around here recently. That’s mainly because real life has been getting in the way quite a lot, but also because what little spare time I have has been taken up by a new project. I’m not ready to spill the beans on what that project is quite yet, but you can get a couple of fairly strong hints on what direction I’m going (!) by taking a look at the beautifully executed work of Matthias Hammer (and his daughter) on their autonomous equipment project. Note that Matthias isn’t limiting his work just to autonomous control of the tractor, but is also extending the project to automate the other agricultural equipment that he uses.

Matthias is using ESP32s in his project as replacements for the Arduinos used in the base AgOpenGPS project. He has a few videos up on YouTube giving a guided-tour through the equipment, as well as showing the tractor at work. If you’re at all interested in GPS/RTK and autonomous vehicles, his (short) videos, GitHub repository and the AgOpenGPS web site are all worth a visit (even if you’re not a farmer).


Modtronix ESP32 Ethernet Gateway

This was spotted by Jean-Luc, over at CNX Software.  It turns out that Modtronix are not only still around, but they’re getting into the ESP world now, too (and I count both of those as being good news …I still keep a functioning Modtronix SBC45ECR1 board in my spares box).

Modtronix are currently running a crowdfunding campaign for an Ethernet-enabled ESP32 gateway board over on Crowd Supply (which has already reached its target).  The board is interesting in that it not only has Ethernet, but also a micro-SD card slot for extra storage, an additional STM32F030F4 ARM Cortex-M0 processor which, by default, is configured as an i2c expansion, a type-C USB port for power and data and a barrel-jack as an alternate power input (up to 16v).

The STM32F030F4 is the baby in that processor range, with only 16k of flash and 4k of RAM, but still makes this an interesting combination.  Unfortunately, at the time of writing, the GitHub repository doesn’t have any code posted, so we’re going to have to wait and see just how many of the little ARM chip’s peripherals are available to the ESP32.

One tip for navigating the Modtronix GitHub is that the schematics for the main board are actually there, but just not in the “pcb” directory …they’re in the “images” directory (and also linked from the in the “docs” directory).

Arduino ESP32

Various tech news sites (see CNX-Software’s coverage here) are reporting Arduino’s release of an ESP32 enabled board in the Nano family.  Named the “Arduino Nano 33 IOT”, the module looks a little underwhelming at first glance (especially given its $18~20 price tag), but it may be worth digging a little deeper into the specs if you have some specific applications in mind.Arduino Nano 33 IOT

The board sports a u-blox “Nina” ESP32 (which we covered here at about this time last year as one of the few FCC certified ESP modules), providing WiFi and Bluetooth capabilities for the onboard Arm Cortex-M0+ SAMD21.  The board also has an LSM6DSL six-axis IMU and an ATECC608A cryptographic support chip, which are both directly accessible from the ESP32 via the I2C bus.  The connection between the SAMD21 and the ESP32 module is via the SPI bus.

That additional crypto chip gives the ESP32 (and the Nano) the ability to securely store up to 16 keys, certificates or encrypted data, as well as providing hardware support for:-

  • Asymmetric sign, verify and key agreement.
  • Symmetric SHA-256 & HMAC hashing and AES-128 encrypt/decrypt.
  • PRF/HKDF for TLS 1.2 and 1.3.
  • Secure boot support.
  • Random number generator.
  • A unique, 72-bit serial number.

At least some of these features are apparently already supported via the Arduino WiFiNINA library.

It may be a little early to pull out your credit card, though, as the module isn’t going to be shipping until July.

ESP32 + W5500 — Simple Working Example

NOTE [Nov 2020]  —  It seems as though the “June 2019” fix (immediately below this paragraph) is no longer required.  I downloaded the project directly from the GitHub repository and compiled with the latest version of PlatformIO (5.0.2) a few days ago and it compiled, uploaded and worked with no changes at all, so I’d suggest you try it and only use the following fix if you see the “invalid abstract” errors.

Update June 2019  —  A couple of people have mentioned (both here and on GitHub) that they are having difficulty compiling the code for this project, with “invalid abstract return type” errors.  This turns out to be an upstream problem caused by a non-backward compatible modification of the Espressif  arduino/ESP32 library.   You can force the build to use an older (compatible) version of the library by changing a single line in your platformio.ini file:-

—  platform = espressif32
++  platform = espressif32@1.6.0

Thanks to @maniekQ for documenting this workaround.

Over the past couple of days, in the course of answering questions on the popular article on adding an ethernet port to the ESP8266, I found myself putting up a link to some new code for a work-in-progress project which simply replaces the ESP8266 with an ESP32 (which seems to make a lot of sense, given the falling cost of the ESP32 modules, nowadays).  ESP32 + W5500 moduleWhile that project is for an ESP-Now gateway, it seemed like there was a need for a nice, simple test and verify project where people can do a minimum of work with the hardware (an ESP32, a W5500 module, some jumper leads and a breadboard) and get a working result in a reasonably short time.  I’d said in various places that it shouldn’t take too much work to modify the code for the ESP-Now project to handle any of the examples shipped by default with the Arduino Ethernet library, so that’s what I’ve done.

Here’s the code (along with the pinouts in the README) for the simple “UdpNtpClient” example, munged very slightly to work with the ESP32Output exampleAll it does is connect to an NTP server, retrieve the current timestamp and display the UTC time.  This is basically a 30-minute project to produce a working demostration of an ESP32 using hard-wired Ethernet.

The configuration uses a static IP and network setup (router/gateway, netmask and DNS), as the original ESP8266 project seemed to have problems with DHCP (and quite honestly, I just haven’t gotten around to trying it with the ESP32 version, yet …let me know how it goes if you do).  All of the configuration options are in the “local_config.h” file.

The original library example code uses a single NTP server, “”, which seemed a little anti-social to me, so I’ve added several of the more popular geographical pools into the config file and updated the default target to be the main “”.   You should choose the one closest to you (unless you’d like to see how unreliable bare UDP really is, in which case you might like to try “”  —  apologies if you’re reading this from McMurdo Station 🙂 ).

Recent Updates (March 1st, 2019)

Otto Winter has been continuing his updates to esphome with improvements to the set-up wizard and the addition of min/max settings for rotary encoders (esphome enables you to add an ESP8266 or ESP32 to Home Assistant without writing any code).

Theo Arends has been working on reducing stack space usage in Sonoff-TASMOTA to fix some intermittent crashes.  If you’re having issues, please upgrade to version or greater (see this post for more details).

Phil Bowles has been updating the API documentation and examples for his esparto rapid development framework for the ESP8266 (available as an Arduino IDE library; write concise, working code with no setup() or loop() functions).

Xose Pérez has made lots of changes to his espurna replacement firmware for ESP8266 devices over the past few weeks, with support for more than twenty new products added and the incorporation of many fixes (both from Xose himself and submitted by an ever-growing community of users).

Rich Heslip has published an ESP32 project, “Motivation Radio BLEMIDI”, to add WiFi and Bluetooth functionality to Eurorack based modular synthesizers.  The hardware for this module is also open source and available from a separate repository, courtesy of Jim Matheson.


Recent Updates (Feb 14th 2019)

I’ve added Mike Rankin’s Twitter feed to the ESP32 links section (RH column).  Mike has several ESP8266 and ESP32 projects in his Github repository and usually has some interesting commentary on his Twitter feed (ongoing status, problems, fixes, etc).  His latest project, a rechargeable-coin-cell based ESP32 mini board, is definitely worth a look, as are his previous ESP8266 creations.

Theo and his merry band of helpers have been hard at work pushing out more updates to Sonoff-TASMOTA.  Along with some code refactoring at the end of January to change “boolean” types to “bool” and “byte” to “uint8_t”, some other interesting updates have just slipped out in the last couple of recent releases:-

  • Templates.  This is a great new feature which allows people to  add new device GPIO definitions via JSON templatesA repository for user-submitted templates has already been created.
  • Support for multiple ADS1115 devices on the i2c bus.  If you’ve been limited by the single AtoD pin on the ESP8266, you can now add up to four, four-channel ADS1115 devices (on unique addresses) to the i2c bus and have them automatically recognized.
  • Numeric operators “==”,  “!=” ,  “>=”  and  “<=”  added to rules (the previously existing  “=”  string comparator frequently produced unexpected results when used in a numeric context).
  • HASS discovery and status for sensors.

Martin Ger has just updated his esp_wifi_repeater package to handle MQTT QOS (in version 2.2.5).

Adding Alexa control.  Phil Bowles has released a tiny Wemo emulator library, “weenymo.  It’s about 60 lines of code and adds Alexa on/off functionality to your ESP8266 projects (and don’t forget to check out his “esparto” rapid development library while you’re visiting his GitHub repository).

Otto Winter has integrated the esphomeyaml and esphomelib projects under the umbrella name of “esphome.  If you haven’t come across either (any) of these before, the basic idea is that a user can write a short configuration file and have code automatically generated for an ESP8266 or ESP32.  With esphome, you can have an application up and running on your ESP in a few minutes without writing a single line of code yourself.

ESP32 board pricing

I’ve been a little surprised (and a lot disappointed) that ESP32 board prices haven’t fallen so very much since the introduction of the ESP32 module, so I was very pleased ESP32-DevKit-v1when recently, while searching eBay for something completely different, I came across this vendor selling ESP32-DoIt DevKit v1 style boards (a NodeMCU look-alike) for less than $5 each.  As it was a vendor I hadn’t used before, I cautiously placed an order for a couple and sat back to wait for the postman’s knock.

I received email notification that the boards had shipped within 12 hours of placing the order and the boards themselves arrived nine days later, which is better than normal turnaround (and in fact, the items which I’d been searching for originally and which I’d ordered from a different vendor within a few minutes of the ESP32 order didn’t arrive until five days later).  Having had a couple of bad ESP8266s shipped to me recently, I made a point of doing some initial testing of the modules when they arrived, and both programmed and ran a test application without any problems.

Getting good, working modules at that price and shipped promptly was information which seemed worth sharing and I started writing a post for this blog, only to find when I went back to the vendor’s site that he’d put the price up.  I hit the big “Delete” button and more or less forgot about it.

Over the past couple of days I’ve been playing with one of the modules for another project and I realized two things.  1- I’d forgotten to leave feedback for the vendor (now done) and 2- His updated price is actually still very good (even if it doesn’t break that $5 barrier) …which lead to this post.

As usual, I have to say that I have no relationship with this vendor, other than being a satisfied customer (on the basis of one order), but if you’re looking to help push down the prices on ESP32 modules, he (or she) is definitely worth considering.

-WARNING-  I’m writing this at the start of February, which is also the start of the Chinese New Year holiday, so you can look forward to an extra ten days delay if you order right now.  😦

u-blox produced ESP32 has FCC approvals

Update 15th May 2018 — Between writing the first draft of this article and pushing the big red “Publish” button, the prices for all of the items mentioned here have already changed (downwards), so please refer to the u-blox AG online site for the latest, up-to-date pricing for your area.

u-blox AG, the Swiss company famous in hobby circles mainly for their excellent (and cheap) little GPS modules, have started selling two new standalone WiFi modules, the NINA-W101 (external antenna connector) and the NINA-W102 (module mounted antenna).  u-blox AG's NINA-102 moduleThe W101 is priced at $US 8.75 and the W102 is $US 9.48, direct from u-blox in bulk (250, or more).  While that price is fairly competitive for an ESP32 module (assuming that the one-off price isn’t too far out of that particular ballpark), the cost of the development board is a bit excessive, at US$ 99 (again, available directly from u-blox AG’s on-line shop).

The antenna on the W102 model (shown above) is neither the older SMD-chip type nor the PCB trace type.  It seems to be a custom made planar inverted-F antenna (PIFA), distinct from the existing ESP modules in that it stands over 1mm higher than the RF shield on the module.  u-blox AG provide suggested sizing for orientation and ground-plane sizing in their datasheet.

The NINA-W10 series data-sheet makes interesting reading and, although the u-blox document doesn’t come right out and say “this is an ESP32”, it doesn’t keep it a secret, either (on a couple of the pages there’s a footnote reference saying “See the Espressif ESP32 Datasheet for…).

Although neither of these modules is particularly hobbyist friendly (ref the solder-side of the W102 module in the photo, above), many IOT designers will be excited to see that they are FCC approved for the U.S. (and RED/FCC-equivalent for many other countries, too) and that u-blox AG offer support for integrating the modules into an end product as a “grantee” (if you understand the FCC process that last part will hopefully make sense to you).

In the same “Short Range, WiFi” product category are the closely related NINA-W131 and W132 products which appear to be almost identical, except that Bluetooth isn’t available.  Details on these two modules are a little sparser than the W101/102 variants.


ESP8266 GPS NTP Server in the making

Chris Liebman is my kind of maker.  His projects are interesting, practical and almost always have the words “work in progress” somewhere in the (usually brief) description.  I was led to the NTP-server project when following up on his (ESP8266-based) AnalogClock creation (a method of keeping el-cheapo analog clocks in perfect time, even across power outages and daylight-savings time changes, using an ESP8266 and NTP).

The NTP-server is another “work in progress” project, with very little information, Breadboard prototype NTP serverother than the code, available.  It does hit a couple of sweet spots for me, though:-  NTP from a GPS PPS (pulse-per-second) signal and being ESP based (although the breadboard picture shows an ESP32, rather than ESP8266).

Chris is using an Adafruit “Ultimate GPS Breakout” board to provide the PPS signal, as well as serial time and date information to the ESP (the GPS communicates with the ESP via the standard serial pins, while debug-terminal output goes to Serial1).

I have to admit that I haven’t managed to get Chris’ code to compile successfully, yet (you’ll need to download some of Chris’ modified versions of several required libraries to get even close), but this certainly looks like one to keep an eye on (and I’m wondering if a lead soldered to the ‘status’ LED on one of those cheap, USB, GPS dongles would work reliably as a PPS signal source in this case).



Adding an Ethernet Port to your ESP32

Frank Sautter has an interesting post on his blog on adding a physical ethernet connector to an ESP32 development board.  The board he chose was the Waveshare LAN8720 and, apart from Frank Sautter's LAN8720 Adapter Boardone gotcha with GPIO0 during resets, it appears to be a fairly simple build.  The LAN8720 already has (some!) support from Espressif, so this seems like a nice, easy and relatively cheap way to build yourself a WiFi-to-Ethernet gateway.

Frank has detailed the connections for his adapter board and included a nice bottom view (left), so that it should be fairly easy to duplicate his build.  The LAN8720 boards themselves are currently available on eBay for about $3 each.

[Wiz5500 Version]  If, on the other hand, you’re looking for information on how to add an ethernet port to your ESP8266, check out this more recent article…