ESP32
ESP32 is a
ESP32 is a
[2] ESP32 vs Arduino Mega 2560 microcontrollers comparison [2] Following our discussion in class, here are the things I've noticed while using the ESP32 board for my robot, which may be worthwhile to consider for the implementation of ESP32 in future semesters.
Please note that there are many variants of ESP32 out there, and what I note are only applicable to the one I'm using. That said, I am using the regular ESP32 Dev Module variant, which is the most common.
1. No USB Power Switching Circuitry
Unlike the Arduino, when USB is connected and Vin pin is used, the ESP32 does NOT cut off the power lines to/from the USB and WILL send reverse voltage back into the computer. As such, when my ESP32 was powered by the 8V battery pack and when I tried to connect it to my laptop, it sent 8V back into my laptop which caused it to restart (luckily, I disconnected it quickly enough so nothing was damaged).
As such, when using the ESP32 to test the motors, one must remember to disconnect the Vin to the ESP32 so that the board is solely powered by the USB, but leave the battery pack on to power the motors. While powered by the USB, the ESP32's Ground should nonetheless still be connected to the Ground of the battery pack, or else the PWM sent to the motor controller may be seen as undefined voltage by the controller chip.
Students risk damaging their laptop should they forget to unplug Vin.
2. Irregular Pin Feature Distribution
Unlike the Arduino, the ESP32 does not have clear distinctions between Analog and Digital pins. Rather, as GPIO's, they are supposed to work in both modes, and most pins are equipped with PWM functionalities. That said, there are a few pitfalls that one cannot easily identify at a glance. Below are some issues I've encountered while choosing pins for my robot :
GPIO 34, 35, 36 & 39: These pins are input-only.
GPIO 2: This pin is pulled high whenever there is serial communication.
GPIO 19 & 21: These pins do not have ADC's and thus cannot be used to read analog signals.
These details are not directly marked on the board but must be looked up on the internet, which can pose additional problems to students who are not too familiar with microcontroller programming at all.
3. Incompatibility with Breadboards
The width of the ESP32 is not compatible with breadboards, and if forced onto one, would leave one side with only one exposed hole and the other side with no exposed holes at all. A breakout board is a must.
4. Development Environment Configuration
Although the ESP32 can be programmed through the Arduino IDE, its setup is a little more complicated, involving installing the Arduino IDE, the official IDE extension from Espressif, and installing the UART Serial device driver just for the board to be recognized. This is what worked for my environment (Windows 10) and might be different for others.
In conclusion, the ESP32 is not exactly a beginner-friendly board that is meant for first timers to learn the ABC's of microcontrollers. While it does contain more features (Wi-Fi, Bluetooth, Neopixel Tri-color LED, etc.) and is more versatile (higher ADC resolution, variable PWM carrier frequency, etc.), its "openness" also means that its user must be more aware of what they're doing the entire time.
That said, I think the ESP32 is an awesome board, and had a lot of fun using it for the first time in this class. I've had a lot of prior experience with Arduino's in personal projects in the past, which is what permitted me to adapt to ESP32 in a timely manner. If we want to do a full-on switch to ESP32 in future semesters, it is probably a good idea to start introducing ESP32 from Level 2 "Introduction to Programming" to give students a headstart.
[1] Wikipedia
[2] David Xu