While waiting for the Rev. B PCB (should be in next week) I've been looking into setting up the ESP32-CAM module to monitor and log system events and record videos when the PIR is triggered. However, I've bumped into some limitations.
- There are only 2 GPIO available unless I free up a couple more by using slower protocols for the SD-card, making saving video to it less reliable. SPI I/O port expander might work.
- The module can't readily stream to YouTube as it only supports MJPEG - apparently I need to stream using an mp4 codec for that to work. I don't want it to require you to have an always-on desktop or SBC to receive the video. Ideally it could save and stream at the same time all by itself.
I will eventually find solutions to these issues, but for now I will go back to using a Raspberry Pi Zero W. It is significantly less powerful than a Pi Zero 2 W, but can still do the job. Plus they are much easier to find these days and are still somewhat reasonably priced (~17 EUR, wide angle OV5647 is another ~15 EUR).
Pi Zeros can't be put to sleep, but there are a few ways to trim power consumption to ~120mA (disabling HDMI and LEDs, relying on the PIR/GPIO instead of motion detection so you don't have to overclock it). This should let it last ~3 days on a 10,000 mAh power bank. Not great, but acceptable for now.
I would have plenty of GPIO to monitor and log all vending machine events, though it still needs a 3.3V level shifter (not 5V tolerant). It can also stream directly to YouTube and save video files to a larger SD-card than the ESP32-CAM.
If I find another solution that is a good combination of affordable/accessible I will give it a try. In the meantime I will try to get the RPi Zero W to work like I want it to.
Update 19-JUL
The RPi Zero W uses about 120mA, and the power LED is still lit (another 5mA to be saved there). When the 160° wide-angle camera is in use it uses ~250mA (camera uses more current than the RPi!). I'll probably have to keep the camera off when it's not recording. You would still be able to enable it manually to stream when not recording.
Update 24-JUL
Motioneyeos has some limitations as well - I don't have a way to disable the camera programatically, so it looks like I need to budget for ~250mA being used by the camera at all times. This brings run time for 10,000 mAh to about a day-and-a-half.
The good is that I can start and stop recording with GPIO. Also can add GPIO monitoring and even trigger events right from the Motioneyeos UI.
I might try out the standard camera module to see how it looks since I think it uses a bit less current than the 160° wide-angle.
Update 27-JUL
Motioneyeos also has some limitations for this project, you can't disable the camera via api and the only way to start and stop recording requires motion detection to be on. Again, these are things that can be done with some work, but after looking into it I think implementing the changes in the ESP32-CAM or Motioneye software would qualify as a separate project. For now I will continue with using the RPi Zweo W and Motioneyeos as I was before. I still want to monitor activity, but will likely just use a 14-pin PIC16 for this and send to the RPi via I2C or something for logging and remote access to the log.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.