For this week's project, I decided to use an ESP32 cam and firebase to try to remotely upload pictures to a firebase database. I will base my work on This tutorial, but will change a lot of things.
The project didn't have a good start, as I did not have access to an FTDI programmer, which is necessary to upload code to the ESP32 cam, as it doesn't have an USB programming port.
As I didn't have one, I started looking for alternatives. I found some articles and videos that described how to use an arduino uno as a programmer, so I followed the guide. The setup didn't seem too hard at first:
After setting all that up, I opened up the example project for the ESP32 cam (which is basicaly a web server where you can see live video from the camera), and tried uploading it. I got an error, so looked for a solution online. The problem was that I had not set up the uploading parameters correctly. The parameters I found are the following:
I then tried again, and of course got a brand new error. This time, it was written in the output that no core memory was allocated. After trying to solve the issue for many hours, I found a solution that involved changing the partition file that is used to upload the code, and add memory for the partition that was missing. After waiting for the code to upload, the error had now changed, and the board was resetting constantly, in a loop. I googled the error, and turns out that this happens when there is a memory related issue. My best guess was that it happened because I allocated to much memory, which the board did not have, so when writing something it would overwrite it's base memory containing base instructions and therefore be forced to restart. So I then rechanged the partitions, decreasing the amount of memory allocated for each partition to hopefully have enough for everything. Somewhow that worked, but I then got a new error. "brownout detector was triggered", which according to the internet means that the board doesn't have enough current to work. Some posts suggested to add a 10 uF capacitor between the power and the ground of the power supply, which I did, but didn't seem to have any effect on the error.
The next day, when I was about to give up, I found a post saying there was a way to diable that brownout detector, so I tried it, and it miraculously worked. The lines I had to add are the following:
#include "soc/soc.h" #include "soc/rtc_cntl_reg.h"
And then at the beggining of the setup function:
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector
After uploading the code, the ESP32 cam sent an output to the serial monitor, saying that it was connected to the wifi, and that it was now a web server. I then opened the IP address in my browser, and it partially worked. I was able to take still images, but as soon I tried to start a live stream from the camera, the ESP32 cam would crash and stop working. It's honestly impossible to know why that is happening, due to the really big amount of workarounds I used to get it this far. I am honestly really impressed that it even works.
Screenshot of the web interface I saw the first time I got it working (I took a screenshot in a matter of miliseconds, knowing it could stop working at any time)
Got an image! I named it "face of someone who has worked on something that should be very simple for more than 6 hours"
Working with this setup and limitations was literally impossible. Uploading through the Arduino takes around 2 minutes, and waiting that long EACH time I need to make a small change is extremely annoying, so I decided this was a good point to stop for this project. I want to continue this, but only once I can get my hands on a FTDI programmer, which I'm sure will make my life a lot easier.