Driver for ADS1115/ADS1015 reloaded

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Driver for ADS1115/ADS1015 reloaded

Post by Roberthh » Sat Mar 04, 2017 7:56 pm

Taking the well written driver of @deshipu, I added some functionality to effectively sample in a periodic manner. It may not look so elegant any more, but does not allocate memory in the acquiring functions, making it suitable for ISR use. The code & documentation is here https://github.com/robert-hh/ads1x15.git
or here:
ADS1x15.zip
(4.78 KiB) Downloaded 3961 times
Thanks a lot, @deshipu

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Driver for ADS1115/ADS1015 reloaded

Post by deshipu » Sat Mar 04, 2017 10:26 pm

This is great! I'm sure it will be useful for the more advanced use cases!

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Driver for ADS1115/ADS1015 reloaded

Post by Roberthh » Sun Mar 05, 2017 4:02 pm

B.T.W.: Do you mind if I add the MIT copyright note & you as copyright holder?

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: Driver for ADS1115/ADS1015 reloaded

Post by deshipu » Sun Mar 05, 2017 6:37 pm

Well, the original driver has been released with a MIT license, so it's quite natural to use the same license here too. I think you should add yourself to the copyright line, though -- I'm not a lawyer, though.

User avatar
jcf
Posts: 60
Joined: Wed Mar 03, 2021 11:14 am

Re: Driver for ADS1115/ADS1015 reloaded

Post by jcf » Tue Oct 26, 2021 8:56 am

Hi,
Has anyone used more than one ADS1115 on a single I2C-bus?
I am building a 12 channel voltmeter to check the state of a 12 cell LiIon battery.
It is known that you can have 4 addresses: 72, 73, 74, 75 by connecting the ADR pin to GND, VDD, SDA or SCL.
All these work fine for me, except SDA -> 74.
The datasheet already says that you should prefer SCL instead of SDA.
Any experience with this?

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: Driver for ADS1115/ADS1015 reloaded

Post by mcauser » Sun Nov 14, 2021 11:42 pm

Hi @jcf,
If you can't get the address selection to work reliably, an TCA9548A module can give you more I2C channels.
Useful for when you have 2 devices with fixed addresses that you want on the same bus, without using more pins.
eg. https://github.com/mcauser/micropython-tca9548a
The TCA chip is on the same I2C bus as the ADS1xxx's, and you tell it which of the sub-busses should be connected. Can be any combination of sub-busses.

User avatar
jcf
Posts: 60
Joined: Wed Mar 03, 2021 11:14 am

Re: Driver for ADS1115/ADS1015 reloaded

Post by jcf » Mon Feb 14, 2022 6:23 pm

Can the ADS115 measure negative voltages?
Yes and no!
I tested and found it to work in the range 0...-200mV with acceptable error, which is fine for my application measuring a shunt voltage that anyway should not be too high.
Why only up to 200mV? Looking at the datasheet I see 2 protection diodes, and the bottom one begins to conduct when the input voltage is negative beyond the forward voltage.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Driver for ADS1115/ADS1015 reloaded

Post by Roberthh » Mon Feb 14, 2022 7:29 pm

That's what is stated in the data sheet:
When measuring single-ended inputs, the device does not output negative codes. These negative codes indicate
negative differential signals; that is, (V (AINP) – V (AINN) ) < 0. Electrostatic discharge (ESD) diodes to VDD and GND
protect the ADS111x inputs. To prevent the ESD diodes from turning on, keep the absolute voltage on any input
within the range given in Equation 3.
GND – 0.3 V < V (AINX) < VDD + 0.3 V

User avatar
jcf
Posts: 60
Joined: Wed Mar 03, 2021 11:14 am

Re: Driver for ADS1115/ADS1015 reloaded

Post by jcf » Wed Feb 16, 2022 5:05 pm

That's what is stated in the data sheet:...
And it is true. Even at more than 0.2V below GND there is a loss of accuracy.

Nevertheless I succeeded in realising an Ampèremeter with the ADS that measures currents -20A ... +20A by measuring the differential voltage on a 10mOhm shunt (so the voltage on the input pins is below 200mV).
First I used only one ADC input, as anyway I have the bottom of the Shunt connected to ground. But as the connection resistances play a role in this low ohm configuration, I decided to use a real differential ADC on the shunt.
This seems to work well.

One more issue I encountered was that when suddenly switching on the current I had stray pulses coupling into the system and disturbing the I2C bus, making the program halt with an error. So I put 10k // 100nF from input to GND for both ADC inputs, and now everything seems to work fine.

By the way, the default I2C frequency of 1MHz is rather critical, I use 100kHz to get a more stable operation.
I also tried 10kHz but this is a bit slow for my OLED to display (though it works!)
Though the connected ADC and OLED modules have pullup resistances, it is better to use additional 1k or less. The scope shows the result. (And: yes, sometimes I am so occupied with coding that I am reluctant to switch on the scope and have a look at the signals. But in the end I do it and it always helps!)

Post Reply