ESP32-C3 Wireless Adventure: A Comprehensive Guide to IoT [pdf]
espressif.com
espressif.com
I think if the US-China chip war hadn't been going on, and customers wouldn't have been paranoid of using a Chinese chip (and being in a tough spot like Huawei customers), Espressif chipsets would be waaaaay more popular.
Disclaimer/source - worked at Espressif for a bit (2017-2019)
> The ongoing US-China chip war has created a situation where users hesitate to use Chinese chips, wary of ending up like Huawei's customers. Without this scenario, Espressif chipsets might have enjoyed much greater popularity.
These chips are intricate enough to potentially contain backdoors. While it is something I never thought about with respect to Espressif, it does seem plausible that they could be a target.
They were powerful enough to do useful work and you didn't have to worry about RAM.
If I had this stuff as a teenager, I would've lost my mind...
They could indeed be, as already are all PC's, phones, TVs and any smart connected household appliance, no matter if they're built in China. I would never ever consider building a IoT home system wthout putting it behind a dedicated and firewalled hardware subnet that protects from the outside and from the inside. Ok, the firewall hardware itself could contain tampered chips with firmware instructing them to encapsulate and redirect certain traffic outside of the rules without reporting it, but that's another story; when in doubt, I prefer to consider every piece of hardware that is closed and connected as potential spyware.
As the old saying goes, "the S in IoT stands for security" - I choose to trust Google/Amazon and their peers to have an Internet-connected device, but everything else (95% the IoT devices I have) gets sectioned off to a dedicated VLAN & WLAN with no Internet access (and no access to the rest of my network).
This keeps me safe, and keeps the devices safe from each other (micro-segmentation in the access level). No need to trust what has minimal interfaces, and then I don't worry as much if I don't roll software updates every week...
Oh, don't worry, they're getting a ton of attention from the "pros" these days. In hardware no one likes to be the guinea pig if they don't have to be. But these days Espressif is not seen as an exotic choice, and their low cost, excellent feature set, and good supporting material are big draws.
Honestly it feels like they're truly just eating this market, but it's just happening (what looks like) slowly.
I forget we actually have a website, probably easier to share that and answer specific technical questions instead! https://www.venturi.io/
With #line macros injected into the compiled C output source files, JTAG debugging and other tools just work, which is quite nice.
That said, if I was on the C3 or any of the RISC-V chips I’d look at using the C toolchain directly: you can easily have “nim c main.nim” call out to a specific C compiler with your specific build and linker flags!
The one annoyance in all of the embedded toolkits when trying to use non-C/C++ languages is always CMake; companies build component systems and such on top of it which a naive C compiler usage can’t really leverage, which means you end up rebuilding the whole build toolchain again.
Easier to just stick within CMake and use Nim’s C output instead, at least for now (until I get some time to write a nimscript parser for a subset of ESP-IDF’s CMake file format…)
I also use Nim quite a bit on linux/windows for machine-learning purposes. But even on these systems, It is generally a pain to try to trick Nim into using a compiler not directly supported, as some original hard-coded flags would be incompatible with the one i am trying to use,for example NVCC .
Follow up question, Do you generally use Nim on ESP like chips which run some form of a RTOS, or also on bare-metal micro-controllers ?
To answer your follow up question; both - we’re in the process of bringing up firmware for the STM32G0 and L4 microcontrollers, and CubeMX is such a pain to try and bind as-is, we started to play with svd2nim and see if we can’t bring up peripherals that way instead. That’s a less well tread path of course, but it’s promising so far. Only downside is that’s more like Rust’s approach of rebuilding the world, but oh well
Thanks again for taking time for a detailed reply!!
I have an friend who works at ARM, he said there's a mix of people who don't understand what's happening and people who are freaking out but have no power to respond.
I have no idea what market share changes have been but speculation based on what I've heard is that EspressIf is large enough that ARM has awareness of their presence but doesn't comprehend their threat. It sounds like it's going to play out like typical market disruptor where the titans will respond too slow and too late to stop them.
Which is a long way to say that ARM has no moat here.
The great thing I find about them is, that they are "hackable". Don't want to depend on some weird company and their cloud, especially with long-lasting appliances (which outlast the company cloud or even the whole company)? Just buy something with esp8266/esp32 inside, and there's a high chance, that there is some opensource firmware (tasmota, esphome,....) available.
(disclaimer: some times the "hacking" part involves soldering irons, wires, usb->serial adapters and knowledge of electronics safety, especially with mains powered devices)
It's also great to see how with a little technical know-how, you can avoid paying 100s of dollars for some IoT tech that is reliant on more people buying overpriced hardware for it to work in the future, and instead - go for DIY or cheap hardware (e.g.: SonOff) which gets a huge audience due to their low prices, which guarantees someone like me will spend the time to get it properly supported soon enough...
All of a sudden, the premium product becomes the inferior product, because it will have a smaller market share, and therefore, fewer hackers :-)
When I worked on Matter¹, the Xtensa and RISC-V versions were basically fungible from the software point of view. (And really, so were other vendors' various ARMs.) We did find that Bloaty McBloatface² didn't support Xtensa, so I had to write an alternative.
Some then learned to tolerate ARM Cortex M.
But Espressif, this weird new and unknown Chinese manufacturer, came out with their own arch and instruction set that no one else uses (xtensa). A lot of old timers were wary.
Their price to feature ratio is unbeatable though. That go them in the maker/hobby community fast, and lately I've heard of more and more companies using esp32 for actual professional products.
Anyway, ESP32-C3 is RISC-V, and I suspect they won't do any more new Xtensa cores.
We used the ESP8266 before and the C3 is a great replacement and big improvement. The direct programming through the USB works great and our makers can actually directly flash it from the Chrome browser [2]. So the complexity of the BOM is greatly reduced.
Having two real hardware serials is a great improvement over the ESP8266 as the software serial with the ESP8266 was never 100% reliable.
So far we have produced a few hundred boards with the ESP-C3 and they all seem to work stable and reliable and we are planning to use it also for our indoor air quality kits.
[1] https://www.airgradient.com/outdoor/ [2] https://www.airgradient.com/open-airgradient/instructions/di...
“ESP8266 D1 mini v4 (USB C) or campatible”
I’d love to get one of these if they had the new 32 chip that was Thread capable
Source: have been working on an ESP32-based camera devkit (shameless plug) https://www.crowdsupply.com/maxlab/tokay-lite and a few commercial devices that use ESP32 as well.
If someone writes a book on the downfall of Arm in a few years, this is going to be a very interesting chapter IMO.
disclaimer - worked at Espressif for a bit (2017-2019)
ST, Atmel and Microchip maintain massive product catalogues so users can choose between 4MHz, 10MHz, 16MHz and 20MHz for their 8-bit, 8-pin microcontroller, and choose whether they want 1750 bytes of program memory or 3500 - but for the same price customers can get a 160 MHz, 32-bit microcontroller with built in wifi?
Why would expressif pay the engineering costs and supply chain complexity costs to make worse products, when their flagship product is already a great price?
https://www.arm.com/company/news/2021/02/arm-ecosystem-ships...
Seems in this age of open source tools the instruction set is mostly commodity anyway.
- Sure - looking at what Apple's silicon team is doing with ARM would make you think that ARM has nothing to worry about for a while. However, notice that Apple is the only one who is getting a lot done with ARM at the high end. Qualcomm, etc. aren't getting the same amount of performance. I believe that's because of the non-ARM stuff that Apple puts in their silicon efforts. Imagine in a few years, when the small companies designing and licensing RISC-V cores are not that small anymore - folks like Amazon (uses ARM cores in their servers) and Apple might have a serious alternative.
- I think open source models win in the long run, similar to Windows vs Linux, or closed version control software vs Git. The tooling around open source grows over a few years and then suddenly it feels like it's miles better than the closed options. I think similar stuff will happen with silicon.
- ARM themselves worry about this btw - not that long ago they created a website smearing RISC-V which was mostly full of FUD. Their employees revolted and made them get rid of that site: https://www.theregister.com/2018/07/10/arm_riscv_website/
Talk to someone who works at a RISC-V startup. There’s a lot of energy there. It’s going to take a while, but startups are working on every class of chip.
ARM changed the fee structure because growth has been flat, and this is a way to get money short term, not grow the addressable market. It will settle into Intel-like stagnation as a disruptor takes its markets. What's ARM's moat?
You know that ARM is used in a number of microcontrollers? There are over a 100 of them in every modern car, also in Chinese ones. So there are a billion a year alone in that area. Then all the peripherals which use either 8051 or ARM based microcontrollers, like simple things like the keyboard controller.
While I think Risc-V has its benefits. I don't know how it compares today to the scalability of the Cortex-M series starting with the M0 and then following the Cortex-A series. But I see that it is still a long way to go par.
Mind you, whether that applies to ARM is a bigger question, it's like asking whether sand is going obsolete. I have my doubts unless something radical happens in the RISC-V space commercially; I don't think Espressif going all-in would do it on its own.
However, I'm personally anticipating the upcoming releases of zigbee/matter compatible chips for my home automation endeavors (such as the ESP32-H2, ESP32-C6) and possibly their esphome support. I'm enthusiastic about building low power devices that can operate efficiently for up to a year on simple alkaline batteries. While these chips already have an effective sleep mode with low power consumption, the Wi-Fi component remains a notable energy drain.
You're very correct the wifi is a huge drain. I configured it to go into sleep mode between measurements and I was able to get 3x the life out of it, but for 2 AAs without a real battery circuit, it just meant about 36 hours.
I'm excited for the zigbee/matter chips, I'd like to really get power down so I can embed sensors in things like guitar cases.
It's been a while since I used it but from what I remember it works really well between ESP devices and you can certainly do a many to one/gateway approach. The range and power consumption is outstanding all things considered.
I get more is better, but even the c3 and c6, are really incredible overkill for most applications. Maybe another way to put it is that there is tremendous utility in just having a cheap low power chip that can read sensors, do some super basic processing on them (converting a voltage to a temperature or humidity reading, etc) and then send them back to the mothership, wherever that may live (could be the cloud) to store it and take action.
I might be missing the forest for the trees here but multicore chips with cores that push into the hundreds of megahertz, I actually don't know what the use case is. Driving touchscreen UIs?
As someone who primarily specializes in programming and only understands the basics of electronics, I often use esphome[1] for my home automation projects. I want to mention it here as it significantly lowers the entry barrier for creating functional (and funny!) projects quickly, focusing on code and capabilities (with one click, you can update any esp chip wirelessly, after the initial firmware upload via USB that you can do via a web interface too).
Working at a lower level and with code more closely tied to the machine can definitely be rewarding. Yet, it’s esphome that has revived my pleasure of working with electronics and enabled numerous complex projects that I wouldn't have even begun otherwise.
It's also incredibly powerful, and if you wish, you can write libraries to add more features. It seamlessly integrates with Home Assistant (auto-discovering the devices), but it can also be used with other interfaces.
I trust it to not disappear because I think Home Assistant acquired the project.
Oh, and it's open source too (MIT + GNU GENERAL PUBLIC LICENSE)!
And if the chip isn't quite your thing, the modules available are _excellent_.
LCD driver for ASCII art (there is an image of the back with the chip visible):
LED matrix driver:
Lots of details at <https://mabez.dev/blog/posts/>, and some examples of wifi on bare-metal at <https://github.com/esp-rs/esp-wifi>.
I hope to eventually get it working with MQTT (there may be examples already, I haven't yet looked in-depth), at which point I think this will be my go-to for the majority of my IOT projects going forward!
In fact it comes with libraries for most useful things.
Don't think those libraries will be callable from plain rust. Might need some elbow grease to use all the bundled C3 functions from rust.
But I'd also love to be able to do the project without ESP IDF, using `no_std` and smaller specific crates instead. The solution for using ESP IDF in Rust is fairly convenient, but it does require some extra steps and the disk usage is not insignificant. A pure Rust solution would be more elegant.
[1] https://esp-rs.github.io/esp-idf-svc/esp_idf_svc/mqtt/client...
[2] https://git.sr.ht/~jojo/huelia/tree/esp32-c3_and_mqtt/item/p...
https://www.mouser.ca/ProductDetail/Olimex-Ltd/ESP32-POE-ISO...
1- https://github.com/cnlohr/espthernet
2- https://github.com/cnlohr/espthernet/blob/gh-pages/hardware/...
For USB-powered development boards IMO the best option is the raspberry pi power supplies -- they are cheap, high quality, and can supply plenty of current. It's sometimes necessary to bridge over the input diode if you want to draw any significant current from the 5v pin.
If making your own boards the maximum 3.3v current is higher than you might expect (0.5A), but it's perfectly doable.
Getting a UPS for my Home Assistant node was the easy part. Like you, I was worried about the many nodes scattered throughout the house that needed power.
The solution I've come to for now is using a USB plug for mains power, that goes through a DIY USB battery bank charging board (that I got off AliExpress) that's plugged into an 18650 cell. Most of these boards can either charge or provide a 5v out, but some are happy to do both at the same time, and can act as a mini-UPS.
https://www.ieee802.org/3/cg/public/Jan2019/Tutorial_cg_0119...
In my next two project I'm going to have to run two 30ft cables because I can figure out how to get low latency wifi to work on a Raspberry Pi 2040 (where PIO is fabulous, but 500ms request latency is killing me) or without glitches on a ESP32.
Edit: hah if I read the GitHub link, my guess was right. Seems they have a patch there for you to try? Fingers crossed they fix it
Edit: apparently it doesn't. ESP32 however does. Why is the major use case for going S2/S3/C3 again ? Seems regular ESP32 has it all, and price is excellent.
You of course need some central server to collect and act upon the data. I use HomeAsssistant, but I am sure other options work as well.
Once setup, you can open any HA on a computer of your choice, plug in an esp* via usb, and flash it from your browser.
Once it's flashed over usb once, you can disconnect from your computer and flash it via OTA (i.e. remotely) in the future. You can connect whatever sensors or outputs you want and change it at any time.
https://github.com/project-chip/connectedhomeip/tree/master/...