Beginner here. Very new to this.
I need to connect a sensor to an ADS1115 which will communicate with an RPi 4. The sensor has two modes. Here is the 4-20mA mode: https://postimg.cc/mh1MJf7k. It can also be operated with a voltage 40-200 mV output: https://postimg.cc/4Ys9YYqH.
I'm looking at using the 4-20mA mode, however the sensor output signal will be 1-5V. The problem is, according to the datasheet, it states "In no event should more than VDD + 0.3V be applied to this device". Does this mean the input voltage on A0 - A3 pins cannot exceed 0.3V? I'm a bit confused.
How do I go about wiring the sensor to the ADS? This is how I intended to wire it: https://postimg.cc/jLz7Bj2R.
But that would mean putting 1-5V onto the analog input pins.
Would I be better off just using the 40 - 200 mV mode instead?
Thank you very much.
ADS1115 Analog input pins connection
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: ADS1115 Analog input pins connection
If connecting to a Pi, VDD will be 3.3v, so VDD + 0.3V will be 3.6v. For safety, you should not let your input voltages exceed 3.3v.it states "In no event should more than VDD + 0.3V be applied to this device". Does this mean the input voltage on A0 - A3 pins cannot exceed 0.3V?
in 4-20mA mode, the output is a current. The voltage across the load resistor will follow Ohm's Law: V=IR.How do I go about wiring the sensor to the ADS?
20mA * 250 Ohms = 5000mV = 5v. To get a lower voltage, you need to use a smaller value load resistor.
Using some algebra, we can re-arrange the equation to calculate the desired resistance as follows. V=IR -> R=V/I
With a max value of I = 20mA and a max desired voltage of V = 3.3V, we get R = 3.3V / 20mA = 165 Ohms.
- Tanjiro
- Posts: 8
- Joined: Wed Dec 07, 2022 7:58 am
Re: ADS1115 Analog input pins connection
Thanks so much. Is my intended wiring diagram correct? Also, why does the PI determine Vdd?
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: ADS1115 Analog input pins connection
The diagram is correct - with the exception of the resistor value.
The Pi is a 3.3v device. And like almost all 3.3v devices, it is subject to the same limitations on input voltages. Exposing the GPIO pins on the Pi to much more than 3.3v can cause permanent damage.
For this reason, any circuitry connected to the Pi must be constrained to that 3.3v limit. Since the ADS1115 signal voltages are determined by its supply voltage, the supply voltage (VDD) should be 3.3v.
The Pi is a 3.3v device. And like almost all 3.3v devices, it is subject to the same limitations on input voltages. Exposing the GPIO pins on the Pi to much more than 3.3v can cause permanent damage.
For this reason, any circuitry connected to the Pi must be constrained to that 3.3v limit. Since the ADS1115 signal voltages are determined by its supply voltage, the supply voltage (VDD) should be 3.3v.
- Tanjiro
- Posts: 8
- Joined: Wed Dec 07, 2022 7:58 am
Re: ADS1115 Analog input pins connection
Ah, I see. I just assumed it was a 5V device because of the 5V supply voltage. The ADS is also supplied with 5V from the Pi (will change that to the 3.3 V now).
So let me make sure I am understanding this correctly. Because the Pi's GPIO pins can't be exposed to more than max 3.3V, the analog input pins on the ADS also can't exceed 3.3V?
The ADS will be communicating with the pi over I2C.
So let me make sure I am understanding this correctly. Because the Pi's GPIO pins can't be exposed to more than max 3.3V, the analog input pins on the ADS also can't exceed 3.3V?
The ADS will be communicating with the pi over I2C.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: ADS1115 Analog input pins connection
Yes - indirectly. The i2c pins on the ADS1115 have pullup resistors to VDD. So the signal voltage on the i2c bus will be the same as the supply voltage. If you connect those pins directly to the Pi, then they should not exceed 3.3v.So let me make sure I am understanding this correctly. Because the Pi's GPIO pins can't be exposed to more than max 3.3V, the analog input pins on the ADS also can't exceed 3.3V?
If you really want to run the ADS1115 at 5v, you could use an i2c level shifter between that and the Pi. That will protect the Pi from the higher signal voltages: https://www.adafruit.com/product/757
- Tanjiro
- Posts: 8
- Joined: Wed Dec 07, 2022 7:58 am
Re: ADS1115 Analog input pins connection
Thanks a bunch. This was incredibly helpful.
- Tanjiro
- Posts: 8
- Joined: Wed Dec 07, 2022 7:58 am
Re: ADS1115 Analog input pins connection
I suppose I would have to keep my gain at a default of 1? Where the Full-Scale voltage is 4.096V?
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: ADS1115 Analog input pins connection
If you want to run it at 5v (with a level shifter) and measure voltages up to 5v, you could use a gain of 2/3 (+/- 6.144V).
Although the 'full scale range' at 2/3 gain is +/- 6.144V, you can't actually measure all the way to full-scale at that gain setting. The input voltage should never exceed the supply voltage. So all inputs must be constrained to 0v-5v.
Although the 'full scale range' at 2/3 gain is +/- 6.144V, you can't actually measure all the way to full-scale at that gain setting. The input voltage should never exceed the supply voltage. So all inputs must be constrained to 0v-5v.
- Tanjiro
- Posts: 8
- Joined: Wed Dec 07, 2022 7:58 am
Re: ADS1115 Analog input pins connection
I don't think I'll use the level shifter. I'm a newbie and so I wouldn't want to unnecessarily complicate things.
I was thinking i could even use a 100 ohm resistor which will give me a range of 400mV to 2V, and use a gain of 2.048V.
How does that sound?
I was thinking i could even use a 100 ohm resistor which will give me a range of 400mV to 2V, and use a gain of 2.048V.
How does that sound?
- Tanjiro
- Posts: 8
- Joined: Wed Dec 07, 2022 7:58 am
Re: ADS1115 Analog input pins connection
I've been looking at this guide: https://learn.adafruit.com/adafruit-4-c ... cuitpython
But there's a lot going on there. Not too sure where to start, what I need, or how to go about it. It's a bit overwhelming.
But there's a lot going on there. Not too sure where to start, what I need, or how to go about it. It's a bit overwhelming.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: ADS1115 Analog input pins connection
That should work fine.I was thinking i could even use a 100 ohm resistor which will give me a range of 400mV to 2V, and use a gain of 2.048V.
Wiring for the Pi is covered here:Not too sure where to start
https://learn.adafruit.com/adafruit-4-c ... ng-2997257
And the sections that follow walk you through the library installation.
https://learn.adafruit.com/adafruit-4-c ... ry-2997260
For your application, you want to use 'single ended' mode:
https://learn.adafruit.com/adafruit-4-c ... de-2974185
And the gain setting details are here:
https://learn.adafruit.com/adafruit-4-c ... in-3018524
There is some example code for single ended readings here:
https://docs.circuitpython.org/projects ... ngle-ended
- Tanjiro
- Posts: 8
- Joined: Wed Dec 07, 2022 7:58 am
Re: ADS1115 Analog input pins connection
This section has so many links which have even more links when you click on them. It would be easier if there were simply just a walkthrough with the terminal instructions in order to download all the necessary libraries.adafruit_support_bill wrote: ↑Thu Dec 08, 2022 7:10 am
And the sections that follow walk you through the library installation.
https://learn.adafruit.com/adafruit-4-c ... ry-2997260
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: ADS1115 Analog input pins connection
Unfortunately, there are lots of different processor boards it can run on, and the installation details vary somewhat depending on the processor you are using. There is a page for the Pi here: https://learn.adafruit.com/circuitpytho ... spberry-pi
Please be positive and constructive with your questions and comments.