Customer:
The library does not seem to work with ESP32 - I get compilation errors. Also, every time I connect the analog output directly into ESP32 it stops responding. Do I need a voltage regulator between the module and ESP32?
Originally submitted via the contact form on soldered.com on 4 April 2025. Migrated to the forum for community visibility.
Soldered Support:
Can you provide more information on the compilation errors? Also, are you using a Dasduino CONNECTPLUS for ESP32 or a different ESP32 module?
Customer:
I am using an ESP32-S3-DevKitN1-N16R8 devboard. Does the MQ-138 output 3.3V or 5V from the analog output? I don’t think ESP32 would be OK with 5V.
Soldered Support:
You’re correct. The MQ-138 sensor board operates at 5V as indicated on the product page.
To fix this, use a simple voltage divider with resistors to convert the 5V signal to 3.3V. You still supply the MQ-138 board with 5V, but the analog output will be at the correct level for your ESP32.
When testing, allow the sensor to warm up for a couple of days before taking measurements.