I have an ESP32-CAM board which i'm trying to wake from an external source.
The source is the output of a PIR sensor.
I have both a Mini PIR sensor and a Standard PIR sensor.
A simple test sketch shows both sensors work as expected:
Connects to a java websocket server on my local network.
Captures an image and sends it to my websocket server.
In my sketch loop() i also check the value of the GPIO that my sensor is connected to and take action based on the sensor reading. I want my ESP32-CAM to wake if the PIR output goes high, remain awake while the sensor is high, then deep sleep 30 seconds after the sensor goes low.
The problem is that the sensor input remains high all the time once my real sketch is uploaded.
Giving the sensor 60 seconds or so to warm up does not help.
Available ESP32-CAM RTC GPIOs are: 0, 2, 4, 12, 13, 14 and 15.
I have tried 2, 12 and 14, the sensor output remains high all the time still.
I also tried adding a (10K) pull-down resistor to the GPIO pin, again this did not help.
What in my real sketch is causing the PIR sensor output to always appear to be high?
And it works perfectly.
However when i then copy the 'core' of this sketch to my sketch (MyEsp32Cam) it fails, again the sensor output is always detected as high.
I wondered if the problem is actually my ESP32 not getting enough power for camera, wifi and PIR sensor, so commented out the code that connects to my wireless network...
The code now works!
Were you ever able to get this to work with the esp32 cam and the other code for the camera? every time I use the code it causes interruptions with the SD Card or the Camera.
daveyman12345:
Were you ever able to get this to work with the esp32 cam and the other code for the camera? every time I use the code it causes interruptions with the SD Card or the Camera.
Yes i got the 'wake up' code to work with my ESP32-CAM.
I'm not sure what i actually did to fix the lack of power issue.
My question is did you ever get the wifi server to work in conjunction with the PIR wake pin?
I am trying to add a PIR sensor to the ESP32 cam. From what I understand the PIR sensor needs to share a common ground with the esp32 or the esp32 needs to share the ground with the PIR sensor battery. I am not positive.
I just want to be able to add an external wake to this project
However, no matter which pin I use I get errors stating that the sd card is unable to initialize. This is whenever I try to set a pin to a certain state. In other words, I think the pins are in use by the SD card reader and/or the camera.
Thanks for the prompt reply and good work getting yours to work.
daveyman12345:
My question is did you ever get the wifi server to work in conjunction with the PIR wake pin?
I connect to my wifi network and create a websocket client connection to a local server running a websocket server.
I did not get any type of server running on the ESP32-CAM.
daveyman12345:
However, no matter which pin I use I get errors stating that the sd card is unable to initialize. This is whenever I try to set a pin to a certain state. In other words, I think the pins are in use by the SD card reader and/or the camera.
That could well be a power supply issue - your components are not getting enough power.
If you disable the wifi and server parts of your sketch and try again does the SD card still fail to initialize?
If you can establish that you have sufficient power then a conflict in pin usage sounds most likely and you need to find a free pin...
Note you might want to start a new thread on this forum to get your question more attention.