pimoroni / explorer-hat

Python library for Explorer HAT
https://shop.pimoroni.com/products/explorer-hat
MIT License
161 stars 60 forks source link

Differential Measuring #41

Closed mindforger closed 4 years ago

mindforger commented 5 years ago

i did not check too deeply into the code, so don't behead me if i may have overseen it

the ADS1015 is capable of measuring differntially from the datasheet, is there a support to do so in the lib? If not this would be an awesome improvement, because i want to read two NTC 10k and using differential inputs would greatly improve resolution

mindforger commented 5 years ago

000 : AINP = AIN0 and AIN N = AIN1 (default) 001 : AIN P = AIN0 and AIN N = AIN3 010 : AIN P = AIN1 and AIN N = AIN3 011 : AIN P = AIN2 and AIN N = AIN3 100 : AIN P = AIN0 and AIN N = GND 101 : AIN P = AIN1 and AIN N = GND 110 : AIN P = AIN2 and AIN N = GND 111 : AIN P = AIN3 and AIN N = GND

and

channel_map = {0: 0x4000, 1: 0x5000, 2: 0x6000, 3: 0x7000}

if i read that right, i only need to add 0x0000, 0x1000, 0x2000 and 0x3000 to make it work but there would be some conciderations needed on the mathmatics to convert the volts

Gadgetoid commented 5 years ago

Checking in with Engineering suggests you're correct- although I don't believe you need to change the mathmatics for voltage conversion since you should still get a sane voltage measurement, it would just be a differential voltage rather than one referenced to ground.