Forum >Reading SEN0219 on a Raspberry Pi using ADS1115
Reading SEN0219 on a Raspberry Pi using ADS1115

Hi,
I am having inconsistent weird readings. I modified the code from the Wiki to *what I think* is correct… instead of "float voltage = sensorValue*(5000/1024.0);" I just took the reading from the ADC and divided by 10. The ADC is set to a gain of 1 and that seemed to make it *right* for lack of a better term. I can't seem to find any documentation for connecting this to a Raspberry Pi, so could someone let me know if I am doing this right or help me out please? My Code is below.
Thanks!
Tony
I am having inconsistent weird readings. I modified the code from the Wiki to *what I think* is correct… instead of "float voltage = sensorValue*(5000/1024.0);" I just took the reading from the ADC and divided by 10. The ADC is set to a gain of 1 and that seemed to make it *right* for lack of a better term. I can't seem to find any documentation for connecting this to a Raspberry Pi, so could someone let me know if I am doing this right or help me out please? My Code is below.
Code: Select all
import sys import Adafruit_DHT import time import Adafruit_ADS1x15 import RPi.GPIO as GPIO adc = Adafruit_ADS1x15.ADS1115() GAIN = 1 while True: values = [0]*4 for i in range(4): values[i] = adc.read_adc(i, gain=GAIN) m2_value=values[1] CO2_voltage = m2_value*(1/10) if(CO2_voltage == 0): CO2_value = "Fault" elif (CO2_voltage < 400): CO2_value = "PreHeating" else: voltage_dif = CO2_voltage-400 CO2_value = voltage_dif*50.0/16.0
Thanks!
Tony
2021-01-08 22:07:35 https://github.com/DFRobot/DFRobot_ADS1 ... yPi/Python
In order to download this library, you may need to download the entire ADS1115 Arduino library
347945801
In order to download this library, you may need to download the entire ADS1115 Arduino library

2021-01-08 08:33:59 Thanks for the response! I have searched around but am unable to find this library, do you have a link?
tony

2021-01-05 17:54:56 Hello, the library of this sensor contains the Python code for connecting to the Raspberry Pi. You can find it in the downloaded Arduino library, which may contain the information you want
347945801
