Solving issues encountered during usage of NodeMCU/Firebase & ESP32-CAM

Daniel NyorereDaniel Nyorere
3 min read

Recently, I had to work on a project that involved the integration of Firebase with NodeMCU alongside using ESP32-CAM for facial detection and recognition. While trying to accomplish my aim, I encountered some challenges. This article describes those challenges and how I was able to solve them. This article doesn’t cover how to set up Firebase with NodeMCU nor details of coding ESP32-CAM. Below are the challenges and their solutions.

  1. Issues with receiving and sending data from NodeMCU to Firebase

First, to be able to connect the NodeMCU with Firebase, one needs to download the Library that enables one to perform the sending and receiving of data. When I googled, I came across two libraries of which I chose FirebaseArduino due to its simplicity and ease of use. On including the library and writing the code to send data to Firebase Realtime Database, I observed that the NodeMCU was unable to send and receive data as intended. After minutes of troubleshooting and google searching I found out that the issue was related to the Fingerprint found in the HttpClient of the library. To fix that all I had to do was generate and use a new fingerprint unique to my Realtime Database link by following this step:

• First, I had to copy the Realtime Database link as shown below.

Screenshot of RTDB

• Then visited this site grc:

• Pasted the link in the search box

Screenshot of the search box

• Copied the generated fingerprint

Screenshot of generated fingerprint

• Located the FirebaseArduino Library in my Arduino Library Folder, opened it, opened the src folder, then opened the FirebaseHttpClient folder.

Screenshot of FirebaseHttpClient folder

• Scrolled down and changed the “kFirebaseFingerPrint[]”, to the one newly gotten from the site.

Screenshot of kFirebaseFingerPrint

That solved the communication problem and should solve it for anyone reading provided every other step is implemented as expected.

  1. Fixing ESP32-CAM issues

    While working with the ESP32-CAM for facial detection and recognition, I encountered some problems. The problems include; the ESP32-CAM was unable to control the relay. Also, when enroll face is clicked, the camera freezes.

    • To solve the issue of the ESP32-CAM being unable to send signal to control the relay. I had to use a common power source for the CAM and the relay. While the camera got 5v (+) and ground (-) from a battery, the relay’s VCC was connected to the VCC of the camera and a common ground from the power source was connected to the relay. Also, a designated pin was connected to the relay’s input pin. With this connection, the ESP32-CAM was able to send signal which controlled the relay.

    • To solve the issue of the ESP32-CAM freezing when enroll face was clicked. I had to modify the “app_httpd.cpp” file. Particularly under the if(net_boxes) statement in the capture_handler and stream_handler functions. From

    Screenshot of old functions

to

Screenshot of the new functions

That solved the freezing issue of ESP32-CAM.

The code I wrote for the NodeMCU/Firebase and ESP32-CAM can be found on my github page in the link below:

For observations or questions, please leave a comment.

0
Subscribe to my newsletter

Read articles from Daniel Nyorere directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Daniel Nyorere
Daniel Nyorere

I am a developer from Nigeria. Currently learning and working on Mobile Application development with Flutter and Python development. I am interested in learning, creating new things and writing about most of them.