News for hackers. Stuff that matters.
Re:Show HN: AnyLeaf – PH Sensor for Microcontrollers by xupybd on Friday September 04, 2020 @06:12PM (#24379416)
Can someone explain the calibration code. They enter calibration points. Wouldn't you then need to calibrate the sensor with solutions at those PH levels?

How would you do that with the example code?

Re:Show HN: AnyLeaf – PH Sensor for Microcontrollers by the__alchemist on Friday September 04, 2020 @07:03PM (#24379780)
Correct. You need solutions at those levels. As sovreign said, they're typically available at levels around 4, 7, and 10.

With the example code, you'd insert into the buffer solution, then run (for example, in Python) ``` # place in buffer of nominal ph of 10 V1, T1 = sensor.calibrate(CalSlot.ONE, 10, OnBoard()) # place in buffer of nominal ph of 7 V2, T2 = sensor.calibrate(CalSlot.TWO, 7, OnBoard())

Then save V1, T1, and the buffers you used to a file, your database etc. Or just write them to your `py file.` The MyCodo version, for example, handles that automatically.

Then next time you run, load sensor.calibrate_all( CalPt(0.,7., 23), CalPt(-0.17, 10., 23) ) If you just edited the file. Or those values would be loaded from a db.

Re:Show HN: AnyLeaf – PH Sensor for Microcontrollers by sovreign on Friday September 04, 2020 @06:53PM (#24379699)
Typically with ph sensors like this you also get three ph packets(4.01, 6.86, 9.18) which when mixed with distilled water get you a baseline ph for calibration.