Multiple Analog Inputs to send on Firebase using arduino Uno and ESP8266

Its just now that I realized I cant include all my inputs from ADXL335 (3 Analog inputs) to firebase since the wifi module I used in arduino is ESP8266. They said that this wifi module only supports one Analog input, is there a way or possibility where the wifi module will just interpret the readings of the sensors connected in Arduino uno? So that I can use the A0-A5?

You can use a multiplexer (see picture)

Firebase accepts numeric streams in this fashion:

Reference

void loop() { 
 // set value 
 Firebase.setFloat("number", 42.0); 
 // handle error 
 if (Firebase.failed()) { 
     Serial.print("setting /number failed:"); 
     Serial.println(Firebase.error());   
     return; 
 } 
 delay(1000); 
 // update value 
 Firebase.setFloat("number", 43.0); 
 // handle error 

So, if you wish to use an Uno all you need to do is to work the "Firebase.setFloat()" magic on the Uno and then move those character stream over to the ESP8266 for the wireless stuff. You can use Serial Tx on the Uno and Serial Rx on the ESP. If your serial is already being used on the Espressif, simply use SoftwareSerial on the '8266.

Another approach a bit more complex to code is to put all the Uno analog values into an array and move the array via binary as a structure to the ESP and decode and send there. A good example of binary transfer can be found:
struct_ examples

Ray

Will try this thankyou so much

Hi sir, i have no background so im a bit confused sorry, for example that i have my inputs at

const int xValue = A0;
const int yValue = A1;
const int zValue = A2:

How can i input in on the Firebase.setFloat?

You need to drop const...
You are just going to read the analog value which range from 0-1023, so declare your variable as int, which is 16-bit in Arduino, int16_t. Remember that an int in ESP-land is int32_t but once in string format on the Arduino, you will just send that via Tx and the ESP will have it on Rx as a string of digits.

Refer to the Firebase docs:
https://firebase.google.com/docs/reference/cpp

1 Like

sir thankyou so much! this is what i need

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.