EEVblog Electronics Community Forum
General => General Technical Chat => Topic started by: eti on September 20, 2022, 12:18:21 am
-
Long story short, I have moved house and my Arduino is nowhere to be seen, it’s in storage.
Can an ESP32 (WROOM type) be used “as an Arduino”, at a pinch?
I know the IDE has ESP32 plug-ins which allow the ESP32 to be programmed *with* the IDE, but can I treat the GPIO the same as if it were a cheap Arduino? I have no money for a replacement MEGA 2560, and the ESP32 is available for same day.
Thanks!
-
One big difference is the operating voltage, 3.3V vs 5V.
This page seems to give a good summary of the ESP32 WROOM GPIO pins:
https://circuits4you.com/2018/12/31/esp32-devkit-esp32-wroom-gpio-pinout/
For instance, some pins are input only, some do not have an internal pull up.
That page also has example code for the GPIO features (ADC, DAC, PWM, etc.)
-
https://www.freetronics.com.au/blogs/news/etherten-and-ethermega-victims-of-the-global-chip-shortage (https://www.freetronics.com.au/blogs/news/etherten-and-ethermega-victims-of-the-global-chip-shortage)
-
Long story short, I have moved house and my Arduino is nowhere to be seen, it’s in storage.
Can an ESP32 (WROOM type) be used “as an Arduino”, at a pinch?
I know the IDE has ESP32 plug-ins which allow the ESP32 to be programmed *with* the IDE, but can I treat the GPIO the same as if it were a cheap Arduino? I have no money for a replacement MEGA 2560, and the ESP32 is available for same day.
Thanks!
One of the big advantages of the Arduino software framework* is how much support there is for various boards, making it a true cross-platform MCU framework. In addition to the classic AVR Arduinos (and a few non-AVR Arduinos), it supports numerous other MCU boards, including ESP32, STM32, and Raspberry Pi Pico.
Anyhow, the ESP32 WROOM and WROVER is a great, very, very popular upgrade (in most respects) from the classic Arduino boards, and at lower cost! Other than being 3.3V (which certain genuine Arduino boards also are), it’s a largely drop-in replacement. There are really only two downsides compared to the classic AVR boards like the Arduino Uno and Mega2560: compiling takes longer (since the ESP32 runs a RTOS under the hood, which must also be compiled), and it doesn’t have as many GPIOs as the Mega2560. (IIRC there do exist other ESP32 models with more GPIOs. Most, but not all, ESP32 MCUs are supported under Arduino.) Because of the ESP32’s popularity, most Arduino libraries have been battle-tested on ESP32, and in many cases have been explicitly optimized for them.
I’ve nearly completely switched to ESP32 in my projects, using PlatformIO as the IDE. (I’m vastly more productive with PlatformIO. The Arduino IDE is a toy.) The $11 for the official debugger (ESP-PROG) is well spent, though it’s a bit fickle.
Another board family that’s nice is the STM32 Nucleo boards. Many of them are pin-compatible with Arduino boards. Just bear in mind that they’re also 3.3V, and that not all Nucleo boards are supported in Arduino. One big perk is that the Nucleo boards have the debugger built in, and it works with almost zero setup. I’ve played with Nucleo boards at work, and have been meaning to order a few for myself.
IMHO the easiest way to browse what’s available is using PlatformIO (or its website), which lets you filter boards by software framework.
*”Arduino” comprises three distinct things:
1. The Arduino boards
2. The Arduino software framework
3. The Arduino IDEs
The only part that’s mandatory, so to speak, is the framework. You can mix and match the boards and IDEs at will, as I do with ESP32 on PlatformIO. It’s even possible to mix frameworks, like using ESP32 with both the Arduino framework and ESP-IDF (ESP32’s native framework) simultaneously.
-
Even though the Nucleo boards are nice eti mentioned that he does not have the money to get a replacement MEGA2560, so this rules out a lot of the Nucleo boards too, because they are not as cheap as the ESP32 boards.
The main difference is the number of pins and the supply voltage as others already mentioned.
A benefit is the wireless connectivity and the much faster processor which can make more things possible.
Edit: There is of course the Raspbery PICO, which is also cheap and supported by the Arduino development environment. It too is 3.3V and if needed there are boards with wifi.
-
Even though the Nucleo boards are nice eti mentioned that he does not have the money to get a replacement MEGA2560, so this rules out a lot of the Nucleo boards too, because they are not as cheap as the ESP32 boards.
Huh? Even the most expensive Nucleo costs less than the Arduino Mega 2560. (I looked at Digi-Key for pricing.) And the majority of them cost significantly less, with the cheapest ones being similar in cost to an ESP32 board (around $10).
I’ve got a few RPi Pico boards and I’m less impressed by them. They’re not bad, but there’s little about them that stands out (other than the PIO module, which most Arduino-level beginners won’t be using) and I find it more annoying to upload to.
-
Depends on where you look and if you are willing to wait for it. The original Arduino boards are expensive, but on Aliexpress you can get clones that are just as good for a fraction of the price. At least before this chip shortage thingy happening :)
-
Well yeah, but clones are available of everything. Comparing like-for-like (clone-to-clone or original-to-original), the Nucleos aren't particularly costly.
(And while I'd say that Arduino clones are good enough, they are not 100% as good as the originals, since they invariably use a different USB-UART chip than the genuine ones, which means that on many OSes, you have to install a driver to use them, and those can sometimes be fickle. Build quality is all over the place: some clones are very good, others are rather shoddy. Clone ESP32 boards generally work fine, but I've been disappointed by the build quality of some of them. Genuine Espressif boards are great.)
-
Regardless, the original question is "can I use an ESP32 as an Arduino in a pinch", to which I'd reply that not only can you, it's a significant upgrade in many ways.
-
Update:
Thank you to everyone for your kind and helpful advice. I eventually managed to get an Arduino Mega 2560 clone for the princely sum of £12.99 Charles III pounds.
-
Nice, that’s a good price. But I would also encourage you to pick up some ESP32 and STM32 Nucleo boards, too, when you have the chance. They’re both very worthy successors/upgrades to the classic AVR-based Arduino boards.