Huge huge fan of ESP32s over Arduino/RPi/etc for any/all projects where I can do so. I’ve probably got 15-20 ESP32 projects around the house, and have done somewhere around 80-100 for other people.
Arduino does a great job with marketing but at the end of the day you could do 99% of Arduino projects with an ESP32 for 1/10th the cost, use less power, and get way more features at the same time, while still using the Arduino IDE or VS Code with Platform.IO.
Agreed - they deliver a very flexible, cost-effective, performant MCU. Downsides (to me) are toolchain and power consumption.
Has the Arduino toolchain been enough for home automation? I’ve been playing with Zephyr, but when I’ve gotten down into those gritty late-AM Saturday night programming hours, actual library support seems to be patchy, outside Arduino and Espressif toolchains.
I ended up running MicroPython on the Sonoff Dual R3 (a cheap and cheerful box about the size of a fig, controlling two separate line voltage relays) but GPIO access is really unsafe, which makes it useless for sensing, but fine for control. For everything else I use the ESP-WROOM-32, a fairly ancient dev board, and it’s highly capable, but I get the sense there are better boards for prototyping in 2023.
I want to emphasize that MicroPython is actually really great, especially on the ESP-32. I was pretty skeptical (having written both Arduino and ESP-IDF code) but after using it a bit, it solves a wide range of problems for me. I was surprised to see that interrupts in python actually can be fast enough to be useful, and it can control a number of the peripherals through DMA, which means you can often do stuff at hardware speeds w/ no CPU involvement. You also get a REPL and a real filesystem for free. And I know I can always take whatever I've written and transliterate it to ESP-IDF.
Not the person you’re replying to, but I’ve built a battery voltage monitor (to alert if my home generator battery is discharging) and am working on temperature monitors for my BBQ and oven! Those have been left on accidentally in the past
There are 2 flavors of the ESP, depending on model. The Xtensa cores and RISCV, go with the RISCV variant. The Xtensa variant requires you to use their compilers, which are derived from he ones provided by Cadence. There's a better path long-term for the RISCV cores to get tooling on par to what's available for ARM.
Toit is where it's at for esp32 projects. It runs on a VM system called Jag, which lets you basically deploy containers to an esp. It also handles updates via wifi, logging and all that, while giving you a terse language with quite a lot of packages to build things with.
I don't have any use for them, but I am also a fan of the ESP32, mainly because it represents having the desktop computers of my 9th grade (similar somehow to PC1512) available on the palm of my hand, and with much better hardware.
So many variables due to application, so camera streaming will use more that a humidity/temp/pressure sensor that deep sleeps for a minute, awakes, reads and sends the data and pops back to sleep.
A good YouTube Channel I find for microcontroller aspects is - Andreas Spiess
I was about to go off on a rant about how power hungry the ESP32 is. But having a look its not as bad as I remembered (or perhaps I was thinking about the 8266)
depending on the board you can get it to as low as 15ma in "normal" use(light sleep microprocessor only, modems off). But when the wifi is on it chows down powers.
The chips various Arduino-like chips are 5mA active, 500uA when light sleeping, 5uA in deeper sleep, and hundreds-nanoamps in deepest sleep.
15mA "light sleep" is really heavy actually compared to most things IMO. Hell, the Nordic Semiconductor nRF5340 uses 5mA _WHEN TRANSMITTING ON ITS RADIO_.
ESP32 is in that zone between the low-power (and ultra-low power) uCs and Raspberry Pi. ESP32 is ~20mA to 50mA, comparable to RP2040 (which I also consider to be very "heavy").
Arduino-chips, like the ATMega328pb (as old as it is), is on the scale of "Years on AA batteries of sleep". While chips like ESP32 are on "Hours of AA batteries of sleep".
--------
The only advantage to ESP32 is its WiFi. If you need anything else at all, there's a lot of better chips available. In particular, Teensy is probably the best board for ~50mA to ~100mA levels that the ESP32 finds itself in.
Personally, I'd would say another advantage is sdk. IMO ESP-IDF is up there with Silabs and nRF in the top tier of dev experience. Then STM/TI etc and Microchip a very distant last.
The ESP32 isn't ideal for basic battery stuff that needs to be awake all the time, or size constrained stuff - that's where nRF and BLE shines (or Silabs/Cypress).
However, in deep sleep you can get 10uA< which is decent assuming you wake up rarely, do a bit of WiFi work and go back to sleep.
For the right job (powered stuff that needs BLE, WiFi or ethernet, maybe hosting a local webserver for config and/or mqtt) the ESP32 is an absolute bargain compared to alternatives and a pleasure to work with to boot. The modules also typically have lots of flash onboard, ideal for embedding web UIs.
> nRF5340 uses 5mA _WHEN TRANSMITTING ON ITS RADIO_.
I mean that is bluetooth radio, so its cheating just a little :)
No, I get your point. the ESP stuff I do spends most of its time in deepsleep, so yeah the 15ma is not great, but its not _that_ much of an issue because I can just wake up less often. Not having to use C is even better though.
10 year previous me would be screaming at my attitude. I remember when the pyboard came out and I was very much "pfftt, amateurs. 35mA to do nothing very fast"
However having lots of connectivity really makes up for the not great consumption. I don't have to slap on an RF solution, or like I did 12 years ago, use a horrific ethernet->rs232 bridge.
However if I need online low power consumption, I'll need to use STM32, and cry at how bad the documentation is(or was, I've not tried to use it for years).
The Cortex M23 and Cortex M33 chips seem to be the lowest power I can find.
That's Microchip's SAM L10/L11, STM32U5, and the Nordic Semiconductor chip I mentioned earlier. Probably a few more out there (ARM sells their core to many different companies after all).
Well, it's shit if you want something battery-powered (at least "needs a lot of work" to get good standby") but for everything else, comparing to what it can do and how much it costs, it's fine.
A little off topic: Is there a video compression chip that I can put on a board with an ESP32 to make a live streaming camera similar to what can be done with an RPi or Jetson Nano?
Depending on the project, but either find a nearby USB port (I have home temperature sensors powered off the back of my TV, and other projects off USB ports around the house) or use battery power. Batteries can last months on ESP32s if you set them up right. They have great deep-sleep modes and can use practically nothing unless they're actively needed.
Why use ESP32 if you're powering with PoE? Might as well use an "Ethernet-on-board" like Teensy 4.1, and then use a PoE splitter (ex: https://www.adafruit.com/product/3239) to power it.
Why pay for WiFi power (which is rather expensive) when you literally are sending Ethernet communication wires to your uC ?
Personally I'd take an ESP32 over a teensy 4.1 unless you specifically need the extra GPIOs or something. The teensy's are great hardware, but you're stuck with either Arduino or hand rolling.
You don't pay for WiFi power if the RF amp is off, and ESP-IDF for me is far better to work with than the Arduino software ecosystem especially once the complexity starts going up.
Also, if you just want to make widgets and not learn embedded development esp-home is brilliant.
Arduino does a great job with marketing but at the end of the day you could do 99% of Arduino projects with an ESP32 for 1/10th the cost, use less power, and get way more features at the same time, while still using the Arduino IDE or VS Code with Platform.IO.