I ordered some ESP32-WROOM development boards on Aliexpress via the 3 for not much option (1,88 euro per board
https://nl.aliexpress.com/item/1005005623725652.html) and they arrived today.
Always test these kind of things when they arrive to make sure all is good, so connected them to my computer (USB-A to USB-C cable) and a LED was lit. The CH340 connected without problems, but no blinking LED, which I mostly find enough proof of working. So decided to test it with an example sketch in the Arduino IDE.
But that turned out to be not so simple and straight forward. I had no ESP boards installed, which was not a big problem. Open the boards manager and install the ESP boards. Version 3.07 was the newest available. This adds a ton of new boards and brings stress of choice.
A search on the net showed that "ESP32 Dev Module" was the most likely choice for the 30 pin WROOM board. Selected a simple example sketch and pressed upload. No dice, it complained about the module serial not existing.
Traceback (most recent call last):
File "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool.py", line 34, in <module>
import esptool
File "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/_init_.py", line 41, in <module>
from esptool.cmds import (
File "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/cmds.py", line 14, in <module>
from .bin_image import ELFFile, ImageSegment, LoadFirmwareImage
File "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/bin_image.py", line 14, in <module>
from .loader import ESPLoader
File "/home/peter/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/loader.py", line 30, in <module>
import serial
ModuleNotFoundError: No module named 'serial'
exit status 1
Compilation error: exit status 1
I knew that a friend of mine had already played with the ESP32-WROOM boards in combination with the Arduino IDE, and he told me that the boards library he had installed for the ESP devices was version 3.1.0-RC3. Unfortunately that was not in my list of versions.
After a bit of looking through his setup it became clear that one has to add additional boards to the preferences.
He had the following two in his list:
https://dl.espressif.com/dl/package_esp32_index.json
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
Not sure which one does the trick, but after adding them I got the new versions in my list and selected the latest version. After this action the sketch (Examples->WiFi->WiFiScan) compiled just fine, but uploading failed.
Sketch uses 913680 bytes (69%) of program storage space. Maximum is 1310720 bytes.
Global variables use 45476 bytes (13%) of dynamic memory, leaving 282204 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.8.1
Serial port /dev/ttyUSB0
Connecting...........
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 8c:4f:00:36:95:90
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
A fatal error occurred: Unable to verify flash chip connection (Invalid head of packet (0xE0): Possible serial noise or corruption.).
Failed uploading: uploading error: exit status 2
Tried it via another USB port on the computer, but still the same problem. I have some other older ESP32 boards (USB-micro) in my collection, that I never tried loading code into before, and these worked just fine. Code uploaded and started without problems.
My friend suggested to try different boards and when I selected "AI Thinker ESP32-CAM" it also worked without problems.
Clearly the ESP32 world on Arduino is a bit mysterious and with boards from unknown origin it can be a bit of a hassle to get things running.
Hope this post can help others when they run into ESP32 problems.