How to get the right value from analog ph meter displayed in Blynk?

Hello guys,I’m a newbie to Blynk.I want to read right value from my analog ph meter(https://www.robotshop.com/en/gravity-analog-ph-meter-kit.html).Could you help me please?
P.S. I’m using ESP8266 connecting to Blynk.
Here is my code and my wrong ph value result.

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>

#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>

#define DHTPIN            2    
#define DHTTYPE           DHT22

DHT_Unified dht(DHTPIN, DHTTYPE);

char auth[] = "auth";

SimpleTimer timer;

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, "wifi", "password");

  dht.begin();
  
  // Setup a function to be called every second
  timer.setInterval(1000L, sendUptime);
}

void sendUptime()
{
  Blynk.virtualWrite(V5, millis() / 1000);
  sensors_event_t event;  
  dht.temperature().getEvent(&event);
  if (!isnan(event.temperature)) {
    Blynk.virtualWrite(V1, event.temperature);
  }
  dht.humidity().getEvent(&event);
  if (!isnan(event.relative_humidity)) {
    Blynk.virtualWrite(V2, event.relative_humidity);
  }
}

void loop()
{
  Blynk.run();
  timer.run();
}

As per the directions you deleted in order to post this… I fixed your posted code formatting :wink:

Your code does not appear to be sending any output to the display widget you refer to as PH… so how can we determine what you are doing wrong? :stuck_out_tongue_winking_eye:

Sending raw “data” (actually just a voltage level) to an Analog pin will get you RAW values… ranging from 0-1023, based on the 0-3.3v input… basically normal. Whatever sensor you are using probably needs code to translate the true value.

1 Like

Thank you so much for your attention.Your word made me understand what I should do. :sweat_smile:

https://www.robotshop.com/media/files/pdf2/rb-dfr-483.pdf

Look at the PDF for that sensor… there is some example code in there that should do the conversion… then set your Display Widget to a virtual pin and send your translated Analog data to it via a **Blynk.virtualWrite(vPin, value)** just like the others.

Have you completed the code? I,m using this exact sensor, do you mind sharing with me?

Just completed this. If you still have issues, tell me.

Hey, just came across this old thread. Can you share the code for this? I’m using esp8266 with Blynk and trying to add this ph sensor as well. Thanks!

Don’t forget to buy some ph calibration powder as well if you haven’t already…
Eg. (http://www.discountinstruments.com.au/ph-calibration-powder-3-pack.html?fee=1&fep=29&gclid=Cj0KCQjw1NzZBRCoARIsAIaMwuuu8WxYa7Yu27dfgnTRZZ2RNXpXMEfLUncpk8HPbIWYnfHwQOM8K6caApAhEALw_wcB)

can you share the right code? thanks so much.

Closing this old topic… over the last year, three different users asked for the apparently non-existent code, but the OP has not answered.