Hello I am trying to read the ADC pin on the Enviro + board
Right now the all-in-one-no-pm-2.py is running fine with added modes for temp and press conversion.
I wanted to add a new mode to display data from the ADC pin , I read that it is a ADC1015 on 0x49 address.
I installed pimoroni git ADC1015 library GitHub - pimoroni/ads1015-python: Python library for the Pimoroni ADS1015 breakout since it the same chip.
But when I try to run the example read-all.py it gives me an error
pi@raspberrypize6:~/ads1015-python/examples $ ls
read-all.py
pi@raspberrypize6:~/ads1015-python/examples $ python read-all.py
read-all.py - read all three inputs of the ADC
Press Ctrl+C to exit!
Traceback (most recent call last):
File “read-all.py”, line 13, in
ads1015.set_mode(‘single’)
File “build/bdist.linux-armv6l/egg/ads1015/init.py”, line 166, in set_mode
File “build/bdist.linux-armv6l/egg/i2cdevice/init.py”, line 215, in set
File “build/bdist.linux-armv6l/egg/i2cdevice/init.py”, line 183, in read_register
File “build/bdist.linux-armv6l/egg/i2cdevice/init.py”, line 283, in _i2c_read
IOError: [Errno 121] Remote I/O error
pi@raspberrypize6:~/ads1015-python/examples $
Blockquote
this is the code I am running
#!/usr/bin/env python
import time
from ads1015 import ADS1015
CHANNELS = [‘in0/ref’, ‘in1/ref’, ‘in2/ref’]
print(“”"read-all.py - read all three inputs of the ADC
Press Ctrl+C to exit!
“”")
ads1015 = ADS1015()
ads1015.set_mode(‘single’)
ads1015.set_programmable_gain(2.048)
ads1015.set_sample_rate(1600)
reference = ads1015.get_reference_voltage()
print(“Reference voltage: {:6.3f}v \n”.format(reference))
try:
while True:
for channel in CHANNELS:
value = ads1015.get_compensated_voltage(channel=channel, reference_voltage=reference)
print(“{}: {:6.3f}v”.format(channel, value))
print("")
time.sleep(0.5)
except KeyboardInterrupt:
pass
Any ideas how to fix it . The signal I am inputing into the ADC pin is from .02volts to 2.0 volts from an adafruit/1733 anemometer power from an external 12volt powersupply blue wire to pin ADC brown wire to Positive powersupply Black to negative power supply.