One thing I discovered fairly early on was now and then a BLE tracker would "disappear" for a brief period, usually a minute or two. I wasn't able to figure out the cause but put it down to interference or a collision, but the work around was to have multiple ESP32s receiving the beacons and aggregate the results. For my modest flat I'm currently using 3, although I could probably get away with 2.
A recent update to the ESPHome BLE Tracker has significantly reduced these disappearances but they still happen now and then. In a bid to eliminate them all together, I started to wonder if an external antenna would improve reliability. After looking around online it became apparent only a small number of ESP32 dev modules had an antenna connector, and they were hard to come by and fairly expensive.
But wait... what are these ESP32-CAM things? They're cheap, readily available and have an antenna connector which can be selected by switching the 0 ohm resistor to the second position. I bought one without doing much research (obviously) and it turned up last week.
ESP32-CAM Module |
So, back to the ESP32-CAM... It's a small module supplied with a small camera, an SD card slot and a bright "Flash" LED. Numerous firmwares are available that allow you to use it as a webcam or CCTV camera, but looking at various Youtube videos and reviews the results don't look mind blowing. Maybe I'll give it a try sometime but that's not what I've bought it.
It has less pins then a standard ESP32 dev module, 16 vs 32+, and doesn't have a USB connector for power or programming. It does have voltage regulator to drop 5V down to 3.3V, and most modules have a IPEX connector for an external WiFi / Bluetooth Antenna.
ESP32-CAM Pinout |
So the first step was to try and load ESPHome onto the module. I won't cover it here, but I hooked up a USB to UART converter and used esphomeflasher to upload the binary. It didn't work first time - I'd forgotten to pull GPIO0 to ground as it booted. The second time I got lucky and managed to flash the ESP32, but it was failing to boot properly. Turns out my USB to UART converter couldn't supply enough current (~150mA) so as soon as the WiFi initialised it rebooted. I hooked it up to an external power supply and success, the ESP32 booted and started playing ball.
At this point I'd established that the ESP32-CAM can indeed be used in place of a "standard" ESP32 Dev Module, and Wifi and Bluetooth works as expected. But what about adding additional peripherals? At this stage I didn't know if all the pins are already in use for the additional camera hardware, but after a little experimentation I've managed to get an i2c current sensor and a DS18B20 temperature sensor working with the module.
I've documented how I used the available pins below. It may be possible to use some of the others, but these are the ones I've tried and tested:
Pin | Usage |
---|---|
33 | Small on board LED |
4 | Larger "Flash" LED |
14 | SDA |
15 | SCL |
13 | Dallas 1-Wire |
12 | Failed to boot with anything connected! |
So, I now have a cheap ESP32 module with an external antenna, Bluetooth presence detection, as well as support for any i2c peripherals and a temperature sensor. Not bad.
So, Tl;Dr: Yes, you can use an ESP32-CAM as a standard ESP32, with some limitations.
Thanks for the write up. I have that setup as well, struggling why the camera wouldn't come up in homeassistant. The Onewire DS temp I had on GPIO16. This was causing the blank camera output. I moved to GPIO13 and finally it works! I've also moved the LED torch/flashlight to channel 2 to avoid conflict with the cam on pwm channel 1. Cheers.
ReplyDelete