Monday, August 29, 2022

YA$1µC - Yet Another $1 Microcontroller

I designed my servo controller around the PIC 16F18326. Then on the Element14 site, I see the dreaded words – Available for back order, Awaiting Delivery by 7/08/23! It is not often that calculating the wait involve the year. On the other hand, ESP based modules are an ebay/aliexpress click away. So I decided to redesign my circuit around the ESP chipset. Which brings me to the well known The Amazing $1 Microcontroller article. So how do the ESP chips stack up as an Amazing $1 µC?

ESP8285 bare chips, ESP-01F modules and breakout boards for it

Most ESP chips need an external flash chip. The exception is the ESP8285 that requires just an external crystal. So this is the chip that participates in this competition. To start with, is it really a $1 uC? Not really. It is basically a wifi chip, so it does need an external crystal. In quantities of 10, the ESP8285 bare chip is available on Aliexpress for under US$0.80. An external crystal adds about 12 cents – this is just under the $1 limit. So let us persevere and take a quick look at how it rates.

Parametrics

Parametrics describes the range in the family of chips so you can go up or down in various parameters like memory, package, peripherals, etc.

If you are talking no external flash then there is only the ESP8285. But with an external flash chip, you can use the ESP8266. This is largely the same as the ESP8285 except that the flash size can be changed as it is external. The next step up, the ESP32 is sufficiently different to consider it as another family. So the only parameter that can be adjusted is the Flash size, provided you are OK with using an external chip for that.

Packaging

It is almost a family of one and the packaging is no different. There is only one choice - a QFN32 package with a 0.5mm pitch. QFN32 packages come in different pitches - the others are 0.65mm and 0.8mm - I was caught out on this while ordering breakout PCBs. But with the ESP family, the line dividing bare chips and modules is a bit blurred and there is a rich selection of modules. This is where the ESP family shines - there are endless modules available. The variables are flash size, I/O available and packaging.

Peripherals

The jewel in the peripheral crown is, of course, WiFi support.

The Core

The core is a Tensilica L106 32 bit RISC processor running at 160 MHz. It has about 50KB of RAM. The flash on the ESP family is external but o the ESP8285, it holds 1 MB of built-in Flash.

Wireless Comms

Supports TCP/IP and full 802.11b/g/n.

Supports Bluetooth

GPIO

17 GPIOs - bidirectional and can be configured with internal pull-up or pull-down. The inputs can interrupt the CPU on edge or level. Most functions like I2C use the same pins as GPIO.

Communications

SPI, I2C, I2S, UART. There are two UART ports - the second is a rudimentary transmit only port.

Other Peripherals

4 PWM ports

IR remote control interface

One 10 bit SAR ADC

Power Management

Shutting off the WiFI modem reduces power drain from 170mA when transmitting to 15mA. It has a light sleep mode at 1mA and deep sleep at 20µA.

Development Environment

The ESP-IDF framework put out by the manufacturer is a good starting point. A number of development environments build upon it. An Eclipse plugin can be used to drive the whole environment. The chip also is supported by the Arduino eco-system. I myself started with the Mongoose OS and then moved to the Platform IO based development environment.

The ESP-IDF framework comes with an RTOS and extensive support for the wifi functions. The toolset is open source.

Development Tools

Each member of the ESP family has a DevKit board by third party vendors and the ESP8285 is no exception. They have very similar construction but vary on the pin row pitch. What they have in common is an onboard FTDI with pushbuttons for reset and flash. This allows you to connect them to a PC using a USB cable. No other parts are necessary with the USB supplying the power as well.

Conclusion

We live in strange and disturbing times and the most important feature for an µC is availability. This, so far, is not a problem with the ESP8285. There are innumerable modules available for the ESP family. The costs are quite low - it is not often that you see modules and dev kits priced in single digits for single quantities. I needed it as a replacement for a PIC in a non-WiFi application. Get rid of the PCB antenna, use an ESP8285 which requires no external Flash chip and the modules can get quite small. The smallest I could find was the ESP-01F pictured at the start. It is about 10x11mm. It is relatively new and does not seem to have any breakout boards so I had to make one, also pictured above.

For a WiFi application, the ESP-M2 is the smallest module. It has a PCB antenna. It is also the module used in the dev kit.

No comments:

Post a Comment