mobizt / Firebase-ESP32

[DEPRECATED]🔥 Firebase RTDB Arduino Library for ESP32. The complete, fast, secured and reliable Firebase Arduino client library that supports CRUD (create, read, update, delete) and Stream operations.
MIT License
415 stars 118 forks source link

HELP FSR402 doesn't work with Firebase-ESP32 #40

Closed sarkrui closed 4 years ago

sarkrui commented 4 years ago

Specs

const int sensorPin = 4; int pressureVal;

Issue

Hi @mobizt, my FSR402 works just fine without Firebase; But if I incorporate Firebase-ESP32 into the code, the reading of the sensor pin outputs a constant value 4095 for no reason.

What I have tried

Here it's one piece of my code.

Serial.println(pressureVal); setInt(firebaseData, path, pressureVal); //also try with //pushInt(firebaseData, path, pressureVal);

Do you have any idea where might go wrong? Thanks!

mobizt commented 4 years ago

Nothing related to Firebase library.

correction:

FSR402 is actually a strain guage or piezoresistive transducer. This transducer obtains resistance changes when force applied, then you can read it though analog pin through voltage divider circuit.

mobizt commented 4 years ago

You should share your code for better investigation also circuit diagram or picture. Because of WiFi connection required more inrush current, make sure you have large capacitor connected to board Vcc (+3.3V) and GND for better voltage stability.

sarkrui commented 4 years ago

I also thought it shouldn't be related to the Firebase library...but things just couldn't work as intended and here's the code. FSR402_Firebase_Send.zip

mobizt commented 4 years ago

You cannot use ADC2 (GPIO 2, 4, 12, 13, 14, 15, 25, 26, 2) with WiFi task, here is the issue.

sarkrui commented 4 years ago

Issue resolved by changing sensor pin to ADC1 pins.