Closed ranjib closed 5 years ago
Found an example, periph.io driver: https://github.com/MichaelS11/go-ads
For reference, here is my test Python for the Pico adapter. I don't set the gain register in this example (writes to register 1)
import smbus
import struct
import time
def signed(number):
return struct.unpack('h', struct.pack('>H', number))
bus = smbus.SMBus(1)
addr = 0x48
while True:
data = bus.read_word_data(addr, 0x0)
print signed(data)
time.sleep(1.0)
ph Conversion logic:
phValue= adcValue*5.0/1024/6; //convert the analog into millivolt
phValue=3.5*phValue+Offset; //convert the millivolt into pH value
Any value to millivolts instead of just calibrating on ADC counts directly? In the end it won't matter.
(The Pico board ADC uses a 2.5V reference, the reference is halved to drive the common signal)
@robertobuti @theatrus review please