Recent
Users
Profile
Discord

Extraction

DIY

Tips and Tricks

Equip

Lounge

Gardening

Using Cheap Ebay pH...
 
Share:
Notifications
Clear all

Using Cheap Ebay pH Probes for Res Monitoring

1 Posts
1 Users
0 Likes
362 Views
LordeVolde
(@lordevolde)
Posts: 9
Active Member
Topic starter
 

So I had been wanting to build a reservoir ph monitor for awhile, somewhat because I wanted to monitor my res (duh) but also because I needed it to test key components of GroLInk. The issue is the combination of probe + circuit (BlueLabs Probe + Atlas I2C pH Probe Interface) I wished to use was a lot to add to my budget for upgrades right now with so many things Im working on. So I decided why not give one of these $20 ebay probes a try - worst case even if its off, I can use the data to do the module tests I need, win-win.

I ordered this one - It ships from within the US for only about $3 more then direct from China - https://www.ebay.com/itm/Liquid-PH0-14-Value-Detect-Sensor-PH-Electrode-Probe-BNC-for-Arduino/263242578254

The issue with these seems to be 2 fold - A) there is no documentation, and B) its an analog output (something I really wanted the Atlas I2C board to avoid). With an analog output (0-5vdc) were reliant on the Arduino/ESP ADC which in the case of the Uno is 10bit, giving 1024 possible values, which is a technical resolution limit of .015ph in the absolute best case scenario given the output range stated for this interface (states 5vdc swing for 0-14ph). That aside for some odd reason my probe came 0'd at 0vdc so 14ph was coming out as -2.5vdc - something the arduino's adc is incapble of handling. Luckily the pot nearest the BNC connector on the board adjusts this midpoint, with a dmm you can move the midpoint back to 2.5vdc by shorting the bnc connector. (Something I learned from a calibration video)

Once this is set you can start measuring from the arduino, what you quickly realize is that the readings are very noisy. With a direct 5vdc supply (arduinino powered from USB or high quality wall wort) provided the "best" results, seeing swings in the 1ph range - but still unuseable - powered via 12vdc on vin (so 5vdc is coming from the Arduino VRM) the signal is way less reliably, seeing up to 3-4 indicated ph swings. I started with adding a 2 power filter in software, you can see some example code below, but this was still unreliable, so I progressed to building a filter. What Ive ended up with is a 100hz low-pass using a .22uf cap and 7kohm res - this has resulted in a very stable signal even using the onboard vrm, this combined with averaging has produced an output with little variance and after a small "calibration" has maintained within .05 of my bluelabs pen for over a week.

Obviously Im sure one of the downsides of this cheap probe is that it may fail early, so I certainly wouldnt rely on one of these alone for automation, but 2? maybe so, and for a grand total of $40, thats still a lot cheaper than most options. At that price why not 3? Thats typically the magic number for hardware redundancy, and with some simple sanity checks for variance and averaging, youd have a very good res monitor/automation system. As well, in my case, if the probe fails, Ill likely just buy a BlueLabs or similar probe for $60-70USD and use this analog interface - as with the proper filtering its

proved to have a high enough resolution for our needs.

*A pic of the ph sensor in place with temp probe and pickup tube to the right*

One last thing to note, I dont believe these probes are fully waterproof, so I sealed above the cap kunckle into a piece of pvc with jb weld, that has seemed to work well! This is something that will be implemented in my software/hardware down the road, but as Ive said before, Im commited to the other DIY guys out there, so if this can help you build something useful now, have at it!

//Take 10 samplings avg of the ph meter voltage
numreadings = 0;
totalvolt = 0;
for (i = 0; i < 10; i++){
// Retrieve Data
phin = analogRead(phpin);
voltage = 5.0/1024*phin;
if (voltage > 0.50 && voltage < 4.50)
{
totalvolt = totalvolt + voltage;
numreadings++;
}
delay(2);
}

//Take this value and put it into a running 10 sample avg
totaloutput = totaloutput - avgvoltage[iteration];
if (totalvolt > 0)
{
avgvoltage[iteration] = totalvolt / numreadings;
}
else
{
avgvoltage[iteration] = 7;
}
totaloutput = totaloutput + avgvoltage[iteration];
iteration = iteration + 1;
if (firstcycle == 1) {
avgoutput = totaloutput / iteration;
}
else {
avgoutput = totaloutput / 10;
}
if (iteration >= 10) {
iteration = 0;
firstcycle = 0;
}

//Turn the avg voltage into pH
phval = (7 + ((2.46 - avgoutput) / 0.18))*1.00;

In the last function, where you see 2.46 - this value is determined by the ACTUAL midpoint voltage the microcontroller sees, what I did was put the probe in ph7 solution and read the voltage via serial. I wouldnt recommend a multimeter here, as the averaging and adc is different, so the voltage is likely to be very slightly different, which is enough to throw this off. Thats it, all the calibration I did. I planned on a linear interpolation based on 3 calibration values, but so far, its been accurate enough! Once I move this to integrate with the rest of my software it will retrieve calibration values from the db, this is just an example for someone else that might be looking to integrate one of these sensors.

 

Thats it for now, I plan to post more of my ramblings on things Im working on here in the future. Maybe even start up a youtube series or something. Cheers!

 
Posted : 21/10/2020 7:20 pm
Share: