Preparations
This Raspberry Pi interface HAT is using several GPIO pins and an I²C device with a fixed address.
To ensure that this device will work for your system, make sure that these do not clash with GPIO and I²C devices that are already in use.
Used GPIO pins
Purpose | Direction | GPIO header pin no. | BCM GPIO no. | WiringPi no. |
Digital outputs | OUTPUT | 7,29,31,36,11,12 | 4-6, 16-18 | 7,21,22,27,0,1 |
Digital inputs | INPUT | 15,16,18,22,37,13 | 22-27 | 3,4,5,6,25,2 |
Analog convert alert | INPUT | 26 | 7 | 11 |
Used I²C addresses
Purpose | Address | Device |
4x Analog input | 0x48 | ADS1115 |
Installation
The Raspberry Pi 12-24V interface HAT is equipped with a 40p header, which means that you can place this on top of your Raspberry Pi.
After having added the interface HAT you can enable the ADS1115 analog inputs in the config file (/boot/config.txt) by adding the following under the [all] section
dtoverlay=ads1115
dtparam=cha_enable
dtparam=chb_enable
dtparam=chc_enable
dtparam=chd_enable
For more information refer to https://github.com/raspberrypi/linux/blob/rpi-4.9.y/arch/arm/boot/dts/overlays/README#L210
Make sure you have enabled the I2C interface on your Raspberry using raspi-config (see https://www.raspberrypi.org/documentation/configuration/raspi-config.md for more information).
After a reboot, you will find the device file entries in the folder /sys/bus/i2c/devices under a newly created folder for the ADS1115 device. For example, a folder named 1-0048 in which you will find a file called ‘name’. Check the contents of this file (using cat name) to make sure it is related to the ADS1115.
Drivers
No specific drivers are required for this HAT as uses the standard GPIO pins.
When not using the ADS1115 as described above, please use either standard python libraries to read the analog inputs or standard I²C drivers.