I'm connecting a pH sensor to an esp8266 (NodeMCUV3), however, I'm not getting any changes in results when putting the sensor in different liquids. My console just says "5.00" meaning it's getting 5Vs back. The sensor and board I purchased from Amazon HERE and I've wired up the following:
A0 => Po
VIN => V+
Both grounds connected
I checked around online and the VIN pin should provide enough power to the sensor (even if it isn't super consistent). To confirm that wasn't the issue, I connected a 9V battery temporarily to sensor and still didn't get any results.
I also tried turning both potentiometers, which should have yielded different results as this is how the sensor is calibrated, alas still nothing.
Attaching my code here, it's pretty simple. Any help is greatly appreciated!
I suspect you managed to fry your sensor by connecting 9V to it. If you managed to put 5V into the A/D input it may also be fried. I recommend you post an annotated schematic showing exactly how you plan on wiring this, We will check it and probably save you some $$$. Your choice of a 9V battery could be improved by putting it in the trash.
It's possible I may have fried it while testing with the 9V, however, the behavior was still the same prior to testing with the 9V, when it was connected to the VIN 5V pin. The behavior is still the same now after testing with the 9V. As for a schematic, it's pretty simple, including it here.
I plan on/have followed the instructions. Right now, the probe is still sealed in the distilled water. I will want to calibrate it to this pH (7.0) before I unseal it and use it elsewhere.
Vin on the NodeMCU board may be 5V, but the ESP8266 runs on 3.3V. 5V directly to the ESP8266 will kill the ESP8266.
The maximum input voltage to the ESP8266 ADC pin is 1.0V. The NodeMCU adds a resistive voltage divider to raise the maximum input voltage to 3.3V. Do not put more than 3.3V on the A0 pin.
The NodeMCU Vin pin is not a power supply output pin. Vin is the power input to an onboard voltage regulator that drops the voltage to 3.3V for the ESP8266.
Maybe I'm wrong, but I thought that the liquid inside of the sealed tube was distilled water at a pH of 7 (or close, which for the sake of getting the sensor to read something, should be fine?) . I cannot find the supporting documentation on this now, but earlier when I was performing research on this project I was able to find it.
I have been looking for a good schematic of the NodeMCU to verify how the Vin pin is connected, but am not having much luck. I have seen mentioned that Vin can be used as a 5V output if you are using USB power on some NodeMCU boards. But you should confirm that with your meter. Plug into USB and measure the voltage at Vin to ground.
So I apologize for saying that Vin can't be used as a power output. In some circumstances it seems that it may.
Alright, I'll purchase a buffer solution to get it calibrated. Even without calibration, should it still yield the exact same results all the time? (in this case, a consistent 5.00) I even tried disconnecting the probe to see if the value would drop, and it still says 5.00.
Because of that formula, any voltage 3.3V or more to the NodeMCU ADC will give you a value of 5. Since the ADC maximum input voltage on the NodeMCU is 3.3V the formula will need to change if you want more accurate voltage reading from the ADC. And if the sensor puts out 0 to 5V you will need to level shift that to 0 to 3.3V.
I don’t know how they manufacture pH probes, I only know that the glass on the end is thin having broken a few in the lab. FYI, I have a degree in chemistry even though I haven’t been employed as a chemist since the 60s.
What do you suggest I change it to? I totally "didn't" just copy that code from a tutorial and don't 100% understand how it works. Should I be decreasing the 5.0 value?
As others have pointed out, the pH probe won't work with 3.3V processors without circuit modifications. It was designed to work with a 5V Arduino.
To test the sensor, use your multimeter to measure the output voltage of the pH probe interface. If you don't have a multimeter, now would be a good time to get one. They are invaluable test instruments.
The PH for this sensor is not at 0v for a PH7 it's around 2.51v from the multi-meter and PH4 at 3.03. If you calculate the step, 2.51-3.03 =-0.52. The difference between ph4.01 and PH7 is 2.99.
Based on this, the output will be about 1.3V at pH=0 and about 3.7V at pH=14.
For accurate measurements, every pH meter needs to be individually and quite frequently calibrated.