KY-053 Analog Digital Converter
With the appropriate commands on the I2C bus, analog voltage values can be measured with up to 16-bit accuracy on up to 4 inputs.
- Arduino
- Raspberry Pi
- Raspberry Pi Pico
- Micro:Bit
The analog-to-digital converter (ADC) makes it possible to measure analog voltage values on up to 4 inputs with high precision. Corresponding commands can be sent via the I2C bus to carry out these measurements. The measured values are then coded and output to the I2C bus.
With a resolution of up to 16 bits, very precise measurements can be carried out. The ADC can program different sampling rates, which makes it flexible for different applications. It operates in a voltage range from 2 V to 5.5 V and can measure input voltages up to the operating voltage.
Easy integration via the I2C interface and the ability to use multiple ADC channels make this converter ideal for projects that require precise voltage measurements. Applications could include data acquisition, sensor monitoring or various electronics projects where accurate analog measurements are required. The low operating current of typically 150μA also makes it suitable for energy-efficient applications.
Technical Data | |
---|---|
Interface | I2C |
ADC channels | 4 |
Resolution per Channel | 16 Bit |
Programmable sampling rate | 8 to 860 SPS |
Operating Voltage | 2 V to 5.5 V |
Analog Input Voltage | 0 V to Operating Voltage |
I2C logic voltage | 0 V to 5.5 V |
I2C Address | 0x48 to 0x4B |
Typical Operating Current | 150 μA |
A corresponding library is required for this module - see code examples below.
Changing the I2C address
This analog to digital converter (or in short ADC) has not only one I2C address. This is an ADC which can have 4 different I2C addresses. These can be chosen freely but in the further course the standard address 0x48 is used.
In the following table you can see all possible addresses and how they can be reached. Here is mainly to note that the ADDR pin of the ADC is responsible for the change of the address.
From | To | Address |
---|---|---|
ADDR Pin | GND Pin | 0x48 |
ADDR Pin | VDD Pin | 0x49 |
ADDR Pin | SDA Pin | 0x4A |
ADDR Pin | SCL Pin | 0x4B |
Pin assignment
The pin assignment is printed on the module board
Arduino | Sensor |
---|---|
5V | + V |
GND | GND |
Pin A5 | SCL |
Pin A4 | SDA |
- | ADDR |
- | ALRT |
- | A0 |
- | A1 |
- | A2 |
- | A3 |
Code example
The Arduino boards already have an integrated 10 bit ADC with 6 channels. If more channels, or a higher accuracy, are needed, the Arduino can be extended by 4 ADC channels with 16-bit accuracy using the KY-053 Analog Digital Converter Module.
To load the following code example onto your Arduino, we recommend using the Arduino IDE. In the IDE, you can select the appropriate port and the correct board for your device.
The following libraries are also used for the code example:
Adafruit ADS1X15 from Adafruit | published under the BSD-License
You can easily add these libraries via the library manager of the Arduino IDE. Then copy the code below into your IDE. To upload the code to the Arduino, simply click on the upload button.
The analog-to-digital converter (ADC) makes it possible to measure analog voltage values on up to 4 inputs with high precision. Corresponding commands can be sent via the I2C bus to carry out these measurements. The measured values are then coded and output to the I2C bus.
With a resolution of up to 16 bits, very precise measurements can be carried out. The ADC can program different sampling rates, which makes it flexible for different applications. It operates in a voltage range from 2 V to 5.5 V and can measure input voltages up to the operating voltage.
Easy integration via the I2C interface and the ability to use multiple ADC channels make this converter ideal for projects that require precise voltage measurements. Applications could include data acquisition, sensor monitoring or various electronics projects where accurate analog measurements are required. The low operating current of typically 150μA also makes it suitable for energy-efficient applications.
Technical Data | |
---|---|
Interface | I2C |
ADC channels | 4 |
Resolution per Channel | 16 Bit |
Programmable sampling rate | 8 to 860 SPS |
Operating Voltage | 2 V to 5.5 V |
Analog Input Voltage | 0 V to Operating Voltage |
I2C logic voltage | 0 V to 5.5 V |
I2C Address | 0x48 to 0x4B |
Typical Operating Current | 150 μA |
A corresponding library is required for this module - see code examples below.
Changing the I2C address
This analog to digital converter (or in short ADC) has not only one I2C address. This is an ADC which can have 4 different I2C addresses. These can be chosen freely but in the further course the standard address 0x48 is used.
In the following table you can see all possible addresses and how they can be reached. Here is mainly to note that the ADDR pin of the ADC is responsible for the change of the address.
From | To | Address |
---|---|---|
ADDR Pin | GND Pin | 0x48 |
ADDR Pin | VDD Pin | 0x49 |
ADDR Pin | SDA Pin | 0x4A |
ADDR Pin | SCL Pin | 0x4B |
Pin assignment
The pin assignment is printed on the module board
Raspberry Pi | Sensor |
---|---|
3.3 V | + V |
GND | GND |
GPIO 2 [pin 3] | SCL |
GPIO 3 [pin 5] | SDA |
- | ADDR |
- | ALRT |
- | A0 |
- | A1 |
- | A2 |
- | A3 |
Code example
Unlike the Arduino, the Raspberry Pi has neither analog inputs nor an integrated analog-digital converter. This limits the Raspberry Pi when using analog sensors. To still use analog sensors on the Raspberry Pi, the Raspberry Pi can be extended by 4 ADC channels with 16-bit accuracy with our KY-053 Analog Digital Converter Module.
The program uses the corresponding ADS1x15 and I2C Python libraries from Adafruit to control the ADS1115 ADC. These were found under the following link https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15 under the MIT license released. The required libraries are ** not ** included in the download package below.
First you need to enable I2C on your Raspberry Pi. To open the configuration, enter the following command:
Select 3 Interface Options → I4 I2C and activate the I2C interface. You have now successfully activated I2C. The analog-to-digital converter can now be reached under the I2C address 0x48, which is set by default for this sensor. The I2C address will be different if you have already configured it before configuring your Raspberry Pi.
Now install pip3 with the following command:
The next step is to set up the virtual environment. To do this, enter the following commands:
Use the following commands to download and install the adafruit-circuitpython-ads1x15 library.
After you have downloaded the library, you only need to enter the following command...
... to create a new file on your Raspberry Pi and then copy the following code into the file you have just created.
You can then start this with the following command:
The analog-to-digital converter (ADC) makes it possible to measure analog voltage values on up to 4 inputs with high precision. Corresponding commands can be sent via the I2C bus to carry out these measurements. The measured values are then coded and output to the I2C bus.
With a resolution of up to 16 bits, very precise measurements can be carried out. The ADC can program different sampling rates, which makes it flexible for different applications. It operates in a voltage range from 2 V to 5.5 V and can measure input voltages up to the operating voltage.
Easy integration via the I2C interface and the ability to use multiple ADC channels make this converter ideal for projects that require precise voltage measurements. Applications could include data acquisition, sensor monitoring or various electronics projects where accurate analog measurements are required. The low operating current of typically 150μA also makes it suitable for energy-efficient applications.
Technical Data | |
---|---|
Interface | I2C |
ADC channels | 4 |
Resolution per Channel | 16 Bit |
Programmable sampling rate | 8 to 860 SPS |
Operating Voltage | 2 V to 5.5 V |
Analog Input Voltage | 0 V to Operating Voltage |
I2C logic voltage | 0 V to 5.5 V |
I2C Address | 0x48 to 0x4B |
Typical Operating Current | 150 μA |
A corresponding library is required for this module - see code examples below.
Changing the I2C address
This analog to digital converter (or in short ADC) has not only one I2C address. This is an ADC which can have 4 different I2C addresses. These can be chosen freely but in the further course the standard address 0x48 is used.
In the following table you can see all possible addresses and how they can be reached. Here is mainly to note that the ADDR pin of the ADC is responsible for the change of the address.
From | To | Address |
---|---|---|
ADDR Pin | GND Pin | 0x48 |
ADDR Pin | VDD Pin | 0x49 |
ADDR Pin | SDA Pin | 0x4A |
ADDR Pin | SCL Pin | 0x4B |
Pin assignment
The pin assignment is printed on the module board
Micro:Bit | Sensor |
---|---|
3,3 V | +V |
GND | GND |
Pin 19 | SCL |
Pin 20 | SDA |
- | ADDR |
- | ALRT |
- | A0 |
- | A1 |
- | A2 |
- | A3 |
Code example
The Micro:Bit already has an integrated 10-bit ADC. If more channels or higher accuracy are required, the Micro:Bit can be extended by 4 ADC channels with 16-bit accuracy using the KY-053 Analog Digital Converter Module.
For control we recommend the use of the pxt-ads1115 library, which was published by us under the MIT license.
You can add the library by going to the Makecode page, clicking on Extensions, and then typing ADS1115 in the search bar. After you do that, all you have to do is click on the extension to add it automatically to your current project.
ADS1115.setMode(mode.Multi)
ADS1115.setGain(gain.Two)
ADS1115.setRate(rate.Rate5)
ADS1115.initADS1115(userInI2C.Gnd)
basic.forever(function () {
serial.writeLine("" + (ADS1115.read(0)))
serial.writeString("" + (ADS1115.raw_to_v(ADS1115.read(0))))
serial.writeLine(" V")
serial.writeLine("---------")
basic.pause(500)
})
Sample program download
The analog-to-digital converter (ADC) makes it possible to measure analog voltage values on up to 4 inputs with high precision. Corresponding commands can be sent via the I2C bus to carry out these measurements. The measured values are then coded and output to the I2C bus.
With a resolution of up to 16 bits, very precise measurements can be carried out. The ADC can program different sampling rates, which makes it flexible for different applications. It operates in a voltage range from 2 V to 5.5 V and can measure input voltages up to the operating voltage.
Easy integration via the I2C interface and the ability to use multiple ADC channels make this converter ideal for projects that require precise voltage measurements. Applications could include data acquisition, sensor monitoring or various electronics projects where accurate analog measurements are required. The low operating current of typically 150μA also makes it suitable for energy-efficient applications.
Technical Data | |
---|---|
Interface | I2C |
ADC channels | 4 |
Resolution per Channel | 16 Bit |
Programmable sampling rate | 8 to 860 SPS |
Operating Voltage | 2 V to 5.5 V |
Analog Input Voltage | 0 V to Operating Voltage |
I2C logic voltage | 0 V to 5.5 V |
I2C Address | 0x48 to 0x4B |
Typical Operating Current | 150 μA |
A corresponding library is required for this module - see code examples below.
Changing the I2C address
This analog to digital converter (or in short ADC) has not only one I2C address. This is an ADC which can have 4 different I2C addresses. These can be chosen freely but in the further course the standard address 0x48 is used.
In the following table you can see all possible addresses and how they can be reached. Here is mainly to note that the ADDR pin of the ADC is responsible for the change of the address.
From | To | Address |
---|---|---|
ADDR Pin | GND Pin | 0x48 |
ADDR Pin | VDD Pin | 0x49 |
ADDR Pin | SDA Pin | 0x4A |
ADDR Pin | SCL Pin | 0x4B |
Pin assignment
The pin assignment is printed on the module board
Raspberry Pi Pico | Sensor |
---|---|
3,3 V | +V |
GND | GND |
GPIO1 | SCL |
GPIO0 | SDA |
- | ADDR |
- | ALRT |
- | A0 |
- | A1 |
- | A2 |
- | A3 |
Code example
The Raspberry Pi Pico already has an integrated 12-bit ADC. If more channels or a higher accuracy are needed, the Raspberry Pi Pico can be extended by 4 ADC channels with 16-bit accuracy using the KY-053 Analog Digital Converter Module.
This code example reads channel 0 and returns the read data as analog value and as calculated voltage.
To load the following code example onto your Pico, we recommend using the Thonny IDE. All you have to do first is go to Run > Configure interpreter ... > Interpreter > Which kind of interpreter should Thonny use for running your code? and select MicroPython (Raspberry Pi Pico).
The following library is used for the code example:
Driver for the ADS1015/ADS1115 Analogue-Digital Converter from Robert Hammelrath | published under the MIT-License
To use this library, you need to download the py-file linked above and load them onto the Pico in a folder named lib (you may need to create this folder). Afterwards you can copy the code below into your IDE and click on Run.