0

ADS1015 or ADS1115
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: ADS1015 or ADS1115

by adafruit_support_bill on Wed Feb 24, 2016 10:16 am

See the i2c function definitions here:
http://www.raspberry-projects.com/pi/pr ... nterface-2

adafruit_support_bill
 
Posts: 72741
Joined: Sat Feb 07, 2009 10:11 am

Re: ADS1015 or ADS1115

by ginzer on Wed Feb 24, 2016 11:02 am

Hey Bill, Im sorry for all my questions but I am quite new to all that stuff and the ADS1015 documentation is quite hard to get I think.

So now I am able to read the 2 bytes of the conversion register with:

bus=smbus.SMBus(1)

and then:

bus.read_i2c_block_data(0x48, 0, 2)

So when I plug my Battery into Channel AO (with exactly 4.2V) and to GND I am getting back an array with [87, 112].

With the write command:

bus.write_word_data(add, 0x1, 0x03c0)

I am in the +- 6.144V gain Mode single ended and in continious mode (right??).

The ADS1015 is connected to GPIO2 (5V) and GND. So when I want to calculate my voltage out of the reading bytes its:

5V/6.144V * 4096/2 = 1666,66

so when I add the 2 readed bytes together 696 + 896 (in Bits) Im getting 1592 which makes 4.776 V? Am I calculating something wrong?

Im sorry for disturbing you so much but I dont really get it.

Thanks again

ginzer
 
Posts: 31
Joined: Tue Jan 05, 2016 7:57 am

Re: ADS1015 or ADS1115

by ginzer on Wed Mar 02, 2016 1:28 pm

Hey can you tell me the values of the ferrites FB3 and FB4 of the ADS1015 Layout? what are they for?
Thanks a lot

ginzer
 
Posts: 31
Joined: Tue Jan 05, 2016 7:57 am

Re: ADS1015 or ADS1115

by adafruit2 on Wed Mar 02, 2016 4:47 pm


adafruit2
Site Admin
 
Posts: 18321
Joined: Fri Mar 11, 2005 7:36 pm

Re: ADS1015 or ADS1115

by ginzer on Thu Mar 03, 2016 9:52 am

thanks.
Are they necesarry if i put the ADS1015 on my own PCB? because I cant find something similar in the Datashett of the device.

ginzer
 
Posts: 31
Joined: Tue Jan 05, 2016 7:57 am

Re: ADS1015 or ADS1115

by adafruit_support_bill on Thu Mar 03, 2016 10:00 am

Every circuit board is different. We often build and test several prototypes before arriving at a final design.

adafruit_support_bill
 
Posts: 72741
Joined: Sat Feb 07, 2009 10:11 am

Re: ADS1015 or ADS1115

by ginzer on Fri Mar 04, 2016 11:48 am

hey sorry to ask again.

I have seen in your Python Library for the ADS1015 that you read your values with

return self._conversion_value(result[1], result[0])

what do you get back and how do you convert it to a Voltage?

ginzer
 
Posts: 31
Joined: Tue Jan 05, 2016 7:57 am

Re: ADS1015 or ADS1115

by adafruit_support_bill on Fri Mar 04, 2016 12:05 pm

What comes back is the two bytes of the binary result. Converting to a voltage depends on the gain setting.

adafruit_support_bill
 
Posts: 72741
Joined: Sat Feb 07, 2009 10:11 am

Re: ADS1015 or ADS1115

by ginzer on Fri Mar 04, 2016 12:21 pm

so you converting the bytes to binary and then concatenate them together and use the first 12bits to convert it into the voltage?

ginzer
 
Posts: 31
Joined: Tue Jan 05, 2016 7:57 am

Re: ADS1015 or ADS1115

by adafruit_support_bill on Fri Mar 04, 2016 12:39 pm

Yes.

adafruit_support_bill
 
Posts: 72741
Joined: Sat Feb 07, 2009 10:11 am

Re: ADS1015 or ADS1115

by ginzer on Fri Mar 04, 2016 12:45 pm

ok. I have done that to and everything worked fine.
But now Im getting wrong values for the Voltage. Does the Register always deliver the same entries of the register array?

ginzer
 
Posts: 31
Joined: Tue Jan 05, 2016 7:57 am

Re: ADS1015 or ADS1115

by adafruit_support_bill on Fri Mar 04, 2016 12:59 pm

It delivers the results of the last conversion. But you need to wait for the conversion to complete.

adafruit_support_bill
 
Posts: 72741
Joined: Sat Feb 07, 2009 10:11 am

Re: ADS1015 or ADS1115

by ginzer on Mon Mar 07, 2016 7:07 am

what does that mean exactly?

ginzer
 
Posts: 31
Joined: Tue Jan 05, 2016 7:57 am

Re: ADS1015 or ADS1115

by adafruit_support_bill on Mon Mar 07, 2016 8:25 am

See the code:
Code: Select all | TOGGLE FULL SIZE
        self._device.writeList(ADS1x15_POINTER_CONFIG, [(config >> 8) & 0xFF, config & 0xFF])
        # Wait for the ADC sample to finish based on the sample rate plus a
        # small offset to be sure (0.1 millisecond).
        time.sleep(1.0/data_rate+0.0001)
        # Retrieve the result.
        result = self._device.readList(ADS1x15_POINTER_CONVERSION, 2)
        return self._conversion_value(result[1], result[0])


adafruit_support_bill
 
Posts: 72741
Joined: Sat Feb 07, 2009 10:11 am

Re: ADS1015 or ADS1115

by mavmlim on Wed Jan 30, 2019 7:03 am

Hi, I have a question regarding my ADS1015. Whenever i try to read from its inpus using the function "value = adc.read_adc()" followed by printing the read value using print, I have no problems whatsoever. But whenever i remove the printt funcion, i always end up with an I/O error. To be specific, here is wha the I/O error prints out:

Traceback (most recent call last):
File "/home/pi/Desktop/THESIS_CODES/Adafruit_Test.py", line 51, in <module>
values = adc.read_adc(0,gain=GAIN)
File "/usr/local/lib/python3.5/dist-packages/Adafruit_ADS1x15/ADS1x15.py", line 192, in read_adc
return self._read(channel + 0x04, gain, data_rate, ADS1x15_CONFIG_MODE_SINGLE)
File "/usr/local/lib/python3.5/dist-packages/Adafruit_ADS1x15/ADS1x15.py", line 128, in _read
self._device.writeList(ADS1x15_POINTER_CONFIG, [(config >> 8) & 0xFF, config & 0xFF])
File "/usr/local/lib/python3.5/dist-packages/Adafruit_GPIO/I2C.py", line 127, in writeList
self._bus.write_i2c_block_data(self._address, register, data)
File "/usr/local/lib/python3.5/dist-packages/Adafruit_PureIO/smbus.py", line 274, in write_i2c_block_data
self._device.write(data)
OSError: [Errno 121] Remote I/O error

i would gladly appreciate the help, here is what my code looks like:

working code:
values = adc.read_adc(0,gain = 1)
print(values)
..... 'to some other code'

Code generaing an error:
values = adc.read_adc(0, gain=1)
..... 'to some other code'

mavmlim
 
Posts: 9
Joined: Mon Oct 01, 2018 8:04 am

Please be positive and constructive with your questions and comments.