Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By dogmads
#91028 Hello, I hope this is the right place to ask this question. I have an ec analog sensor which I was able to configure and set up properly with my arduino uno. I'm able to get readings no problem but as soon as I change it to my esp8266 I don't get any reading. it shows 0 all the time.

I'm basically plugin my wires into the same pins.
Analog data to A0
Negative to Ground
Positive to 3.3v

I have my own piece of code with some other rules and all that, but when I saw it wasn't working I tried with a very simple one but still having the same issue.
Here you have the sketch I'm using to test it out.

Again, this worked fine on my arduino board but I get 0 when I connect it to my esp8266.
#include <EEPROM.h>
#include "GravityTDS.h"

#define TdsSensorPin A0
GravityTDS gravityTds;

float temperature = 21,tdsValue = 0,ec = 0, ppm700 = 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(1024); //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
ec = gravityTds.getTdsValue()/500; // ec value
ppm700= ec*700; //ppm700 value
Serial.print(tdsValue,0);
Serial.println(" ppm500");
Serial.print(ppm700,0);
Serial.println(" ppm700");
Serial.print(ec,2);
Serial.println(" EC");
Serial.print("\n");
delay(10);
}


Thanks in advance!
User avatar
By Bonzo
#91034 What board are you using as the ESP8266 is the chip?

What is the voltage coming out of your sensor, the Uno will take up to 5V and it is unlikely your platform will?