• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

esp32 firebase sensor communication

Q&A Forum › Category: ESP32 › esp32 firebase sensor communication
0 Vote Up Vote Down
Magnus Emenuga asked 2 years ago

I purchased the firebase course for esp32 and esp8266. i have followed through to set up my database as well as have my esp32 board communicate with the real time database. while I hooked up the sensor for my project and edited the required parts, I wasn’t able to send my sensor reading to the database. this is the results from my serial monitor. 192.168.137.82

Token info: type = id token, status = on request
Token info: type = id token, status = ready
Getting User UID
User UID: 7TkcdnyxvAXlwSgogn0xyWVg2O33.FAILED
REASON: Permission denied
FAILED
REASON: Permission denied
FAILED
REASON: Permission denied
FAILED
REASON: Permission denied
FAILED
please I will need your urgent response as soon as possible, so I can easily complete the course. Thank.

Question Tags: firebase esp32
17 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.

In which section of the eBook are you at the moment?
Double-check the user ID, login credentials, database URL, and database rules. A permission error means there’s something wrong with one of those parameters.

How did you copy your database URL? Can you show me the database URL in your code?

Regards,
Sara

0 Vote Up Vote Down
Magnus Emenuga answered 2 years ago

Thanks so much for the quick feedback.
Am at chapter 3 page 64.
Though I had to go back and change the database Rule. I pasted the rule with the line of code that allows anyone to make and receive data on the database.
With that I was able to send my data from my esp board to my database.
The rule I used wasn’t the default settings,and at this stage I wish to send data coming from I alone.
 
Am not used to this platform,and I don’t receive notification,and hence why I had to make the publication on the Facebook group.
 
I will expect your kind feedback as per this,while I continue reading.

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
 
You probably had some issues creating the JSON structure of your database.
 
Can you take a look at page 34 and try to follow again?
Send me a printscreen of your database (like the one on page 37). To share a printscreen, upload an image to google drive, imgur or dropbox, and then share a link to the file.
 
Double-check that the user ID matches the one you’re using on your code (7TkcdnyxvAXlwSgogn0xyWVg2O33)
 
Regards,
Sara
 
 
 
 
 

0 Vote Up Vote Down
Magnus Emenuga answered 2 years ago

here is the json file which i did adjusted to suit my sensors. link here, https://drive.google.com/file/d/1h8GMvETC8HG0BiuujYI_WVeKRCpkkjmH/view?usp=drive_link

0 Vote Up Vote Down
Magnus Emenuga answered 2 years ago

i also made the adjustment suit the sensors that I have 
 

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
Can you double-check your user UID? Does it have a “.” at the end?
Can you show me a printscreen of the User UID in the Firebase console under the Users tab?
Regards,
Sara

0 Vote Up Vote Down
Magnus Emenuga answered 2 years ago

Thanks for the response.
My user UID doesn’t end with “.” from all indications I have checked.
Here in this new folder which I created, I have attached all the relevant data and images of the results that I have so far. https://drive.google.com/drive/folders/1xf7R5z4DjOMagPcQy1vWRyVQj4xBFk7C?usp=drive_link
I also attached my database json file so you can check of its accuracy. 
Thanks once again,as I will be awaiting your kind response anytime soon.

0 Vote Up Vote Down
Magnus Emenuga answered 2 years ago

This is my current database rule which I inputed,of which I was able to have my sensor reading PASSED and upload to the database succesfully.
{
“rules”: {
“.read”: true,
“.write”: true
}
}
 
from initial setup, the rule I had was this,
// These rules grant access to a node matching the authenticated
// user’s ID from the Firebase auth token
{
“rules”: {
“UsersData”: {
“$uid”: {
“.read”: “$uid === auth.uid”,
“.write”: “$uid === auth.uid”
}
}
}
}
 
and with this, I got this response,
Token info: type = id token, status = on request
Token info: type = id token, status = ready
Getting User UID
User UID: 7TkcdnyxvAXlwSgogn0xyWVg2O33.FAILED
REASON: Permission denied
FAILED
REASON: Permission denied
FAILED
 

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Hi.
You’re writing data to paths that you don’t have permission.
For those database rules, all paths that you can have access should be under the user UID.
See the picture below:

 
I hope this is clear.
 
Regards,
Sara
 

0 Vote Up Vote Down
Magnus Emenuga answered 2 years ago

Thanks for this.
I followed the steps according the information on the PDF. Am not so sure where I should make further changes in order to have my data write to the right path.
 
If you can point our few other steps or things to do,that would be great.
I can send some material for your to review if need be.
 
Thanks once again for your continued assistance.

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Send me your Arduino sketch ant I’ll tell you what you’re doing wrong.
Regards,
Sara

0 Vote Up Vote Down
Magnus Emenuga answered 2 years ago

i have added the arduino code to the folder,and you can find it here,https://drive.google.com/file/d/1PDnHScTLNQXDvAbPol0Cj_Ad3_52x5wi/view?usp=drive_link   thanks so much

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

The issue is in this section of your code:

sendFloat(temperatureString, temperature);
sendFloat(bpmString, beatAvg);
sendFloat(bpString, bp);
sendFloat(stepString, steps);

 
The sendFloat function accepts as arguments the database path and the value you want to insert. The first argument you’re passing to the function is not the path because you change it during the code to a different thing that is not the path:
You define the path

temperatureString = databasePath + "/sensor/temperature";

Then you change to something that is not the path

temperatureString = String (temperature) + "C";

You should send the path:databasePath + “/sensor/temperature”; as argument to the sendFloat function.
 
The same thing for the bmpstring, bpString, and stepString.
 
This can be easily fixed, if you give different names to your variables.
 
I hope this is clear.
Regards,
Sara
 
 
 

0 Vote Up Vote Down
Magnus Emenuga answered 2 years ago

Yes it is clear, thanks so much,let me implement it immediately 

0 Vote Up Vote Down
Magnus Emenuga answered 2 years ago

i have completed adjustment and the board is sending these data perfectly just asrequired.
here is the linkL https://drive.google.com/file/d/15Hy2WZy4aQX6Seph9UJbcVHJ5degjHm_/view?usp=drive_link
I have another image attached to the folder,to show it working. thanks once again,as I will now continue to with the material for the next chapter

0 Vote Up Vote Down
Sara Santos Staff answered 2 years ago

Great.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

0 Vote Up Vote Down
Magnus Emenuga answered 2 years ago

sure you can.
Thanks once again for your speedy response and assistance.
 

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.