[SOLVED] Can ESP32 board be used as an Arduino? - Page 1
Forum section: electronics / general

author: eti
author_rank: Super Contributor
timestamp: September 20, 2022, 12:18:21 am
content: 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!

author: ledtester
author_rank: Super Contributor
timestamp: September 20, 2022, 02:47:49 am
content: 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.)

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: September 20, 2022, 02:54:53 am
content: https://www.freetronics.com.au/blogs/news/etherten-and-ethermega-victims-of-the-global-chip-shortage

author: tooki
author_rank: Super Contributor
timestamp: September 20, 2022, 06:35:52 am
content: Quote from: eti on September 20, 2022, 12:18:21 amOne 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 boards2. The Arduino software framework3. The Arduino IDEsThe 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 frameworkandESP-IDF (ESP32’s native framework) simultaneously.

author: pcprogrammer
author_rank: Super Contributor
timestamp: September 20, 2022, 06:50:54 am
content: 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.

author: tooki
author_rank: Super Contributor
timestamp: September 20, 2022, 03:37:37 pm
content: Quote from: pcprogrammer on September 20, 2022, 06:50:54 amHuh? 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.

author: pcprogrammer
author_rank: Super Contributor
timestamp: September 20, 2022, 03:44:29 pm
content: 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

author: tooki
author_rank: Super Contributor
timestamp: September 20, 2022, 04:11:23 pm
content: Well yeah, but clones are available ofeverything. 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 aregood enough, they arenot100% 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.)

author: tooki
author_rank: Super Contributor
timestamp: September 20, 2022, 04:13:01 pm
content: Regardless, the original question is "can I use an ESP32 as an Arduino in a pinch", to which I'd reply that not onlycanyou, it's a significant upgrade in many ways.

author: eti
author_rank: Super Contributor
timestamp: September 22, 2022, 12:10:08 am
content: 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.

author: tooki
author_rank: Super Contributor
timestamp: September 22, 2022, 06:27:37 am
content: 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.