askimer
1
hi everyone
I got a pH sensor from here https://www.tindie.com/products/CyberPlant/ph-to-i2c-sensor-for-arduino-with-grove-connector-2/
If I connect it to my GrovePi, I can get some data from the sensor with “grovepi.analogRead(ph_sensor)” line.
Can anyone give me a hint on how to translate this data into pH data in python?
karan
2
Hey,
The pH sensor that you are using is an I2C sensor and not an analog sensor. Right now we don;t have the éxample code for this sensor but it is possible to write the example code for it. You’ll have to port this example to python: https://github.com/cyberplantru/pH-to-I2C-sample-code/blob/master/pHtoI2C_serial_test.ino .
From the looks of it, the implementations should be similar to the adc_read() function here: https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_i2c_adc/grove_i2c_adc.py . You just have to request for 3 bytes, read them and parse them. You should directly call https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_i2c_adc/grove_i2c_adc.py#L64 with 3 bytes and parse the data.
-Karan