Programming Gravity Analog TDS sensor using esp32 with firebase realtime database

hi everybody. I'm making my first real-time monitoring system using esp32 and the Gravity Analog TDS Sensor which will be connected to the firebase database.

can anyone help me in coding esp32 with Analog TDS Sensor to firebase database?
Thank you..

My definition of help you is that you write the code and put together the project. If you need help you post the code in code tags, and post images of your project. I ask questions, make a couple of guesses and finally someone figures out the issue. In that case I may be able to help.

On the other-hand if you want someone to write the code and put the project together for you. I'm out.

Forgive me. so, my project is monitoring water quality in hydroponics in real time, using a Gravity analog TDS sensor, which this sensor will indicate how many milligrams of soluble solids are dissolved in one liter of water.

the program for the sensor readings is working, but I'm having problems connecting the sensor data readings to the firebase realtime database. The following is the code for the sensor reading:

#include <EEPROM.h>
#include "GravityTDS.h"

#define TdsSensorPin 35
GravityTDS gravityTds;

float temperature = 25,tdsValue = 0;

void setup()
{
Serial.begin(115200);
gravityTds.setPin(TdsSensorPin);
gravityTds.setAref(3.3); //reference voltage on ADC, default 5.0V on Arduino UNO
gravityTds.setAdcRange(4096); //1024 for 10bit ADC;4096 for 12bit ADC
gravityTds.begin(); //initialization
}

void loop()
{
//temperature = readTemperature(); //add your temperature sensor and read it
gravityTds.setTemperature(temperature); // set the temperature and execute temperature compensation
gravityTds.update(); //sample and calculate
tdsValue = gravityTds.getTdsValue(); // then get the value
Serial.print(tdsValue,0);
Serial.println("ppm");
delay(1000);
}

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

[code]


#include <EEPROM.h>
#include "GravityTDS.h"

#define TdsSensorPin 35
GravityTDS gravityTds;

float temperature = 25, tdsValue = 0;

void setup()
{
  Serial.begin(115200);
  gravityTds.setPin(TdsSensorPin);
  gravityTds.setAref(3.3);  //reference voltage on ADC, default 5.0V on Arduino UNO
  gravityTds.setAdcRange(4096);  //1024 for 10bit ADC;4096 for 12bit ADC
  gravityTds.begin();  //initialization
}

void loop()
{
  //temperature = readTemperature();  //add your temperature sensor and read it
  gravityTds.setTemperature(temperature);  // set the temperature and execute temperature compensation
  gravityTds.update();  //sample and calculate
  tdsValue = gravityTds.getTdsValue();  // then get the value
  Serial.print(tdsValue, 0);
  Serial.println("ppm");
  delay(1000);
}
[/code]
1 Like

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project.

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