Hello,
I am working on a project using the AI Thinker ESP32 Cam and I need 3 outputs to drive relays and one input to monitor battery voltage. I believe the available GPIO on the board are 12, 13, 14 & 15. Would also like to add a temperature input also and I do not plan on using the SD card reader on this project. Would it be possible to use one of those pins for that input? If so which one? Also is there some example code tor something similar to this project using an ESP32?
Thanks in advance, Steve
Hi Stephen.
If you’re not using the microSD card, you can use those pins to connect peripherals.
I suggest that you try adding a peripheral one at a time and see if the chosen pins work well for what you want to do.
You may also find useful taking a look at the ESP32-CAM pinout: https://randomnerdtutorials.com/esp32-cam-ai-thinker-pinout/
I hope this helps.
Let me know if you need further help as you proceed in your project.
Regards,
Sara
Thank You Sara,
From the information I see on the “AI-Thinker” pinout it appears that if I use the following 5 pins for my Chicken Coop Door project I should be fine if I do not use the SD Card.
GPIO 12 => Relay output
GPIO 13=> Relay output
GPIO 14=> Relay output
GPIO 15=> Battery Voltage input
GPIO 16=> Temperature input
Do you see any issues with using these particular pins for these functions?
Best regards, Steve
Sara, I only ask because it looks like GPIO 16 is used as chip select by the PSRAM on the schematic and I do not want to impact the camera but I would really like to monitor the temperature (I am using a DS18B20 for temp sensor).
Thanks Again, Steve
Hi.
You can also experiment using GPIO 2 for the sensor instead of GPIO16.
Regards,
Sara
Thanks Sara,
I was working on using GPIO 15 to monitor battery voltage and I cannot get it to read anything except 65520 even when I vary the input voltage. Is it OK to use GPIO 15 for an analog input on the AI Thinker ESP32-Cam?
I will try GPIO 2 for my temperature input instead of GPIO 16
Thanks, Steve
sorry for the rookie questions
Hi.
I haven’t experimented GPIO 15 for analog input. In fact, I don’t think I have experimented analog readings with the ESP32-CAM. I think you’ll have to try different GPIOs (from the available ones) and see which one gives you best results.
Then, let me know about that.
Regards,
Sara
Hello Sara,
I have run more experiments and found out that GPIO 2 , 15 & 16 all work as analog inputs until I add the line of code: WiFi.begin(WIFI_SSID, WIFI_PASS);
At that time the reading on those pins goes to a constant 4095.
I really would like to monitor the battery voltage of this ESP32 CAM system. Can you make a suggestion on exactly how I could do that?
Thanks in advance, Steve
Hi again.
Are you sure GPIO 16 works well? It is not an ADC pin.
The reason why the pins stop working is because ADC2 pins don’t work when wi-fi is used.
All these GPIOs are ADC2:
- ADC2_CH0 (GPIO 4)
- ADC2_CH1 (GPIO 0)
- ADC2_CH2 (GPIO 2)
- ADC2_CH3 (GPIO 15)
- ADC2_CH4 (GPIO 13)
- ADC2_CH5 (GPIO 12)
- ADC2_CH6 (GPIO 14)
- ADC2_CH7 (GPIO 27)
- ADC2_CH8 (GPIO 25)
- ADC2_CH9 (GPIO 26)
See the ESP32 pinout guide: https://randomnerdtutorials.com/esp32-pinout-reference-gpios/ (analog to digital converter (ADC) section).
Unfortunately, ADC2 pins are not available on the ESP32-CAM.
Regards,
Sara
Thanks again Sara,
That does explain the issue with analog inputs on the AI-Thinker ESP32-Cam, there are none.
Is there an esp-32 available what can have WiFi, Camera, 3 digital outputs and 2 analog inputs?
Please recommend one, my alternative is to use 2 ESP-32’s:
- AI-Thinker ESP32-Cam for Images over wifi
- WVroom for all inputs and outputs over wifi
Seems messy but doable.
Best regards, Steve
If you don’t have enough pins available you should look at getting what you need externally. I2C is available so you can use I2C relay boards as well as I2C ADC’s. If necessary you could even use an I2C multiplexer.
Hi Stephen.
You can do as Steve suggested or you can use two different boards.
See which method is better for you.
There are other ESP32 models, but I don’t think there is any that suits all your needs: https://makeradvisor.com/esp32-camera-cam-boards-review-comparison/
Let me know if you need further help.
Regards,
Sara
There is a board that I have that has way more pins than most others, the Arducam IOTAI.
Hi Steve.
Thanks for sharing that. I was not familiar with that board.
Do you know if you can use the ADC pins and the camera at the same time?
Regards,
Sara