ADS1115 16 bit ADC on ESP8266?
ADS1115 16 bit ADC on ESP8266?
I was wondering if anyone has this working yet? Tips on how to get up and running would be appreciated. Adafruit appears to be hosting a driver under development.
http://micropython-ads1015.readthedocs.io/
http://micropython-ads1015.readthedocs.io/
Re: ADS1115 16 bit ADC on ESP8266?
Since I wrote that driver, I can tell you that I tested it and confirm that it works.
Re: ADS1115 16 bit ADC on ESP8266?
deshipu wrote:Since I wrote that driver, I can tell you that I tested it and confirm that it works.
Great, I loaded ads1x15.py to the ESP8266. I have an OLED and the ADC connected. Tried a few lines of Code as follows:
>>> import machine
>>> i2c = machine.I2C(machine.Pin(5), machine.Pin(4))
>>> i2c.scan()
[60, 72]
>>> import ads1x15
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ads1x15.py", line 5
Where do I go from here?
Re: ADS1115 16 bit ADC on ESP8266?
How did you load it?
Re: ADS1115 16 bit ADC on ESP8266?
I copied the file ads1x15.py using WebRepl to the ESP8266.deshipu wrote:How did you load it?
Re: ADS1115 16 bit ADC on ESP8266?
Can you verify it copied correctly by reading it out?
Code: Select all
with open("ads1x15.py") as f:
print(f.read())
Re: ADS1115 16 bit ADC on ESP8266?
Thanks, here is the result.deshipu wrote:Can you verify it copied correctly by reading it out?
Code: Select all
with open("ads1x15.py") as f: print(f.read())
WebREPL connected
>>> with open("ads1x15.py") as f:
... print(f.read())
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "<stdin>", line 2, in <module>
MemoryError: memory allocation failed, allocating 15616 bytes
>>>
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: ADS1115 16 bit ADC on ESP8266?
Try reading line by line:
Code: Select all
with open('ads1x15.py') as f:
for line in f:
print(line, end='')
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: ADS1115 16 bit ADC on ESP8266?
Oops!pythoncoder wrote:Try reading line by line:Code: Select all
with open('ads1x15.py') as f: for line in f: print(line, end='')
The file is in HTML. Copied the micropython file over and it seems to be working fine. I put a solar cell on channel 0 and it reads 13541. Actual voltage is 2.561 Volts. Hooked up channel 2 to VDD (3.3V) and it reads 17571
The gain does not appear to correspond to any of the settings from the ADS1X15 docs.
Thanks to all for the help.
Re: ADS1115 16 bit ADC on ESP8266?
deshipu - Nice driver! I have a few questions:
1. After trying various gains it appears the max value when reading a channel is 32767 not 65535?
2. Does the driver support use of more than one ADS 1115 module? I have a single module on address 0x49. I could add up to three more using addresses 0x48 (1001000), 0x4A (1001010), and 0x4B (1001011).
3. Is it possible to set a separate gain for each channel.
1. After trying various gains it appears the max value when reading a channel is 32767 not 65535?
2. Does the driver support use of more than one ADS 1115 module? I have a single module on address 0x49. I could add up to three more using addresses 0x48 (1001000), 0x4A (1001010), and 0x4B (1001011).
3. Is it possible to set a separate gain for each channel.