Multiple analog sensor on ESP32-cam

Hello everyone.

Looking for some help with ESP32-cam module, how to use multiple analog sensor on ESP32-cam, for example if I want to know temperature, humidity (dht11) and noise level (KY-038), is that possible?

Its possible, but in general the ESP32CAM is a bad choice for anything but its intended purpose, taking pictures and saving them to SD.

However once a program is loaded, you can take over the two pins used for program upload to use I2C sensors for instance.

If you dont use the camera or SD, then there is the possibility of using the freed pins for sensors.

Dear srnet, thanks for your answer.
I’ve tried it and got problem like this. I use pin GPIO2 for dht11 and GPIO4 for KY-038 and get no problem with the output from dht11, but KY-038 only give me 4095 even in a quiet environment. Do you know why that happen? I’m pretty sure there is no problem with my wiring.

Btw, I’m using the camera to take picture and save them to firebase instead SD.

I would check the schematic to see if the pins you are using are connected to other devices.

It would also be a lot easier to test the software\hardware on a standard ESP32 module, there are some pins that dont work well with some sensors or hardware, easiest to test for that on a standard ESP32 module.

Here I attach my schematic.

I'm in a hurry that need wifi and camera, thats why I use ESP32-cam. I've tested all the sensor with arduino before and not facing any problem at all, so I think it's safe with ESP32-cam too.

I meant to say, you should check the ESP32CAM Schematic …


This is my understanding of the io pins available for use on the esp32cam:

Main io pins available for general use are 13 and 12 (12 must not be high at boot)

pin 16 is used for psram but you may get away with using it as input for a button etc.?

You can use 1 and 3 if you do not use Serial

14, 2 & 15 should be available if not using the SD Card

More info: ESP32-CAM AI-Thinker Pinout Guide: GPIOs Usage Explained | Random Nerd Tutorials

BTW-You can use an MCP23017 io expander chip on pins 12 and 13 to give you 16 general gpio pins

Note: If using an sd card you this will normally stop you using pins 12, 13 and the led on 4 but if you put it in to 1-bit mode it allows you to carry on using these pins
command to use 1-bit mode is: SD_MMC.begin("/sdcard", true)
see example of its use here: GitHub - alanesq/esp32cam-demo: esp32cam module demo / project starting point sketch using Arduino ide