• Sajiv Shah

ESP32 Setup and Encoder Issues

The first thing I needed to do when I got the ESP32 was to set it up with my laptop by downloading the appropriate libraries and connecting it to the Arduino IDE using a serial port connection. This proved to be easier said than done. When connecting the ESP32 to my laptop, I was using a standard USB cable that comes with many products, anything from a cheap pair of Bluetooth headphones from amazon to a smartphone. The difference with these cables is not all of them are actually data cables. It turns out that for 2 whole hours I was attempting to connect the ESP32 to my laptop using a cable that was either faulty or only used for charging and not data transfer. After changing out the cable, the board connected just fine.

Once connected, I wanted to connect the MA3 encoder and get it to read values. I thought this process would be fairly simple as well. Connect the MA3 to the USB voltage pin, ground pin, and digital PWM GPIO pin. However, when I ran a standard pulseIn() script on the ESP32 which prints values based on PWM readings, the serial monitor was printing "0", meaning it was not reading values.

This issue was huge, as the encoder is essential to the functionality of the project. I posted questions on forums, asked mentors, and finally came across the problem: logic voltage. The logic voltage of the encoder and board didn't match, meaning that the two would likely not work together (although they should be able to in most cases). With that, it is important to first understand Analog and PWM signals, something that we will do in our next post. After that, we can fix our issue using a specific component or a new board instead of the ESP

This site was designed with the
website builder. Create your website today.
Start Now