Connecting an ads1115 to an esp32
Moderators: grovkillen, Stuntteam, TD-er
Connecting an ads1115 to an esp32
Hello, I have not many experience to use espeasy on an esp32, so I hope I could get here some information. I want to to measure a signal 0-5V and want to send it to my mqtt adapter in the ioBroker.
So I bought an ads1115 to connect it with my esp32. But what is the right way and what do I have to set up in the espeasy userinterface?
Thanks and best regards!
So I bought an ads1115 to connect it with my esp32. But what is the right way and what do I have to set up in the espeasy userinterface?
Thanks and best regards!
Re: Connecting an ads1115 to an esp32
It is an I2C sensor, so you must connect it to the pins assigned to the I2C bus.
On the Hardware tab you can see which pins to use for SDA and SCL (or change it if needed).
See the datasheet of the sensor for more information of the sensor.
Most I2C sensor boards already have pull-up resistors present, so that should be very easy to connect. (page 31 of the datasheet for more information on pull-up resistors)
On the Tools tab, you have an I2C Scan button, which will show you a list of all connected I2C devices, so you can check your sensor is connected to the right pins and working.
This also shows you the I2C address you need to know for setting up the task for this.
You will be powering the ADS1115 with 3.3V, meaning you must use resistors to reduce the voltage you want to measure.
As the datasheet shows, the max analog input voltage (page 6) is related to the Vdd (voltage to power the chip).
So if you want to measure 0...5V you may need to add 2 resistors of the same value to divide the voltage in half. (thus making the measurement range 0 ... 6.6V)
By doing so, you must later double the output reading in ESPEasy.

The value of these resistors doesn't really matter, as long as they are not too low (or else you will draw a high current) or too high (causing noise)
I think 10k - 100k would work just fine, as long as you use the same value for both.
Make sure the GND of your ESP (and ADS1115) is the same as the GND you want to measure.
On the Hardware tab you can see which pins to use for SDA and SCL (or change it if needed).
See the datasheet of the sensor for more information of the sensor.
Most I2C sensor boards already have pull-up resistors present, so that should be very easy to connect. (page 31 of the datasheet for more information on pull-up resistors)
On the Tools tab, you have an I2C Scan button, which will show you a list of all connected I2C devices, so you can check your sensor is connected to the right pins and working.
This also shows you the I2C address you need to know for setting up the task for this.
You will be powering the ADS1115 with 3.3V, meaning you must use resistors to reduce the voltage you want to measure.
As the datasheet shows, the max analog input voltage (page 6) is related to the Vdd (voltage to power the chip).
So if you want to measure 0...5V you may need to add 2 resistors of the same value to divide the voltage in half. (thus making the measurement range 0 ... 6.6V)
By doing so, you must later double the output reading in ESPEasy.

The value of these resistors doesn't really matter, as long as they are not too low (or else you will draw a high current) or too high (causing noise)
I think 10k - 100k would work just fine, as long as you use the same value for both.
Make sure the GND of your ESP (and ADS1115) is the same as the GND you want to measure.
Re: Connecting an ads1115 to an esp32
Thank you very much for your information.
I thought I could connect max 5V to the analog pin
, so without your note I think I destroyed the ads.
I connected the ads1115 to the 3,3V pin and ground of the esp32. The I2C signal I connect to pin 21 and pin 22. What for me is not clear how to manage this in the interface of espeasy.
I thought I could connect max 5V to the analog pin
I connected the ads1115 to the 3,3V pin and ground of the esp32. The I2C signal I connect to pin 21 and pin 22. What for me is not clear how to manage this in the interface of espeasy.
Re: Connecting an ads1115 to an esp32
Do I understand it right, in the data sheet VDD is up 7V. So couldn't I connect the ads on the 5V pin of the esp32?
Re: Connecting an ads1115 to an esp32
Basic steps for setting up an ADS1115 is in the 'old' documentation on the Wiki: https://www.letscontrolit.com/wiki/inde ... le=ADS1115
This documentation really needs an update, as the current ReadTheDocs page is quite empty
(I'll see what I can do, though I don't have such sensor available yet)

This documentation really needs an update, as the current ReadTheDocs page is quite empty

Well, then you would have to reduce/convert the voltage on the I2C lines, as that will also go to 5V and would burn out those GPIO's on the ESP

/Ton (PayPal.me)
Re: Connecting an ads1115 to an esp32
Yep, what Ton said...
The max analog input voltage is related to the supplied power to the sensor.
You should not go above that Vdd of the sensor.
You could power it from 5V, but then you also must take care of the I2C signals coming from the sensor to make sure they are not at 5V too as that may cause issues to either the ESP or other sensors connected to the same I2C bus (if any)
Also what if you supplied not 5V to the sensor but just 4.5 (e.g. powering it from an USB charger with bad regulator and/or thin USB cable) and you try to measure 5.0V from an external source. Then you would still destroy the ADS sensor.
So it is best to leave some margin and divide the voltage you want to measure by 2.
The max analog input voltage is related to the supplied power to the sensor.
You should not go above that Vdd of the sensor.
You could power it from 5V, but then you also must take care of the I2C signals coming from the sensor to make sure they are not at 5V too as that may cause issues to either the ESP or other sensors connected to the same I2C bus (if any)
Also what if you supplied not 5V to the sensor but just 4.5 (e.g. powering it from an USB charger with bad regulator and/or thin USB cable) and you try to measure 5.0V from an external source. Then you would still destroy the ADS sensor.
So it is best to leave some margin and divide the voltage you want to measure by 2.
Re: Connecting an ads1115 to an esp32
Ok, so I have to set down my 0-5V analog signal, that is no problem.
No to the circuit. I go in the scan menu of ESPEasy, and let it scan. Result: No I2C devices found
In the setting of I2C is SDA - GPIO 4 and SCL - GPIO 5
I connect like this:
ads1115 VDD 3,3V esp32
GND GND
SCL 22
SDA 21
Is there something wrong?
How could I check the I2C bus?
No to the circuit. I go in the scan menu of ESPEasy, and let it scan. Result: No I2C devices found
In the setting of I2C is SDA - GPIO 4 and SCL - GPIO 5
I connect like this:
ads1115 VDD 3,3V esp32
GND GND
SCL 22
SDA 21
Is there something wrong?
How could I check the I2C bus?
Last edited by bastler11 on 12 Apr 2021, 13:41, edited 1 time in total.
Re: Connecting an ads1115 to an esp32
Are you sure those are the pins defined on the ESP32 in your setup? (Hardware tab)
If you can't find anything via the scan, you may need to add 2 pull-up resistors of roughly 4k7 - 10k between the I2C pins and the 3v3
Do not swap SCL and SDA, as you may be used to with serial connections (serial RX/TX need to be crossed RX -> TX and TX -> RX)
If you can't find anything via the scan, you may need to add 2 pull-up resistors of roughly 4k7 - 10k between the I2C pins and the 3v3
Do not swap SCL and SDA, as you may be used to with serial connections (serial RX/TX need to be crossed RX -> TX and TX -> RX)
Re: Connecting an ads1115 to an esp32
I changed in the hardware tab also the setting of I2C : SDA - GPIO 21 and SCL - GPIO 22 but it does not work.
Now I took a DS18B20 temperature sensor. I had a resistance (4,7k) between + and data. I changed the SDA to GIPO 4. Nothing after scanning
. Do I have to change any thing in the setup, if I try to use the DS18B20?
Now I took a DS18B20 temperature sensor. I had a resistance (4,7k) between + and data. I changed the SDA to GIPO 4. Nothing after scanning

Re: Connecting an ads1115 to an esp32
Would there be any possibility to show my screen via team viewer to find out the problem?
Re: Connecting an ads1115 to an esp32
DS18b20 does not use I2C interface, but Dallas 1-wire protocol, that's why it won't show up in the I2C scan
For testing that sensor you will need to add a Task (Device) for it, and select what GPIO the DS18b20 sensor is connected to. And it can't be shared with I2C interface.

/Ton (PayPal.me)
Re: Connecting an ads1115 to an esp32
OK, thanks I made it and it works with the DS18b20.
Now I will try again to use the ads1115.
But when I try to connect, which GPIO I should take?
Now I will try again to use the ads1115.
But when I try to connect, which GPIO I should take?
Re: Connecting an ads1115 to an esp32
Now it works! I set GPIO 21 and 22 in the hardware menu. Then I set in the menu devices the gain to 1x. Now I took a poti at +3,3V and GND. The middle I connect to A0. The Value I got is between 0 (0V) to 26443 (3,3V).
I have 2 more questions:
To get in the Value the information 3,3, how could I realise that?
What means the gain factor and how could I calibrate the system?
I have 2 more questions:
To get in the Value the information 3,3, how could I realise that?
What means the gain factor and how could I calibrate the system?
Re: Connecting an ads1115 to an esp32
The gain is described in the datasheet I linked before.
On the bottom half of the task configuration for the ADS you use there is a number of fields.
One for the value name, formula and nr of decimals.
The formula can be something like this:
On the bottom half of the task configuration for the ADS you use there is a number of fields.
One for the value name, formula and nr of decimals.
The formula can be something like this:
Code: Select all
%value%*2
Re: Connecting an ads1115 to an esp32
Thanks all for support!
Who is online
Users browsing this forum: Ahrefs [Bot] and 15 guests