💾File: dev_ads1015.h
📦Library: dev_ads1x15
The ADS1015 is a 12-bit analog to digital converter with four inputs.
The conversion time is 1ms/channel.
A0 .. A3 are analog inputs.
Depends on configuration, input is Single-End to GND oder Differential.
Single-End to GND inputs allows always positive input voltage.
More than 3.3V on input can damage the adc input (on VDD 3.3V).
Default input range is +2.048V and Single-End to GND.
For measure up to 3.3V set input range to +4.096V.
If the input range is more than +2.048V, the chip interpolate the value.
For more input voltage than 3.3V use voltage divider resistor.
I2C address is selectable with ADDR pin.
ADS1015 Address:
🔢Enum: ADS1015_ADDR0 Address 0 (0x48) ADDR - GND or open
🔢Enum: ADS1015_ADDR1 Address 1 (0x49) ADDR - VDD
🔢Enum: ADS1015_ADDR2 Address 2 (0x4A) ADDR - SDA
🔢Enum: ADS1015_ADDR3 Address 3 (0x4B) ADDR - SCL
ADS1015 Channel:
🔢Enum: ADS1015_CH0 Channel 0
🔢Enum: ADS1015_CH1 Channel 1
🔢Enum: ADS1015_CH2 Channel 2
🔢Enum: ADS1015_CH3 Channel 3
ADS1015 Input Range:
🔢Enum: ADS1015_GAIN_6114 Max. input voltage 6.114V (interpolated)
🔢Enum: ADS1015_GAIN_4096 Max. input voltage 4.096V (interpolated)
🔢Enum: ADS1015_GAIN_2048 Max. input voltage 2.048V (default)
🔢Enum: ADS1015_GAIN_1024 Max. input voltage 1.024V
🔢Enum: ADS1015_GAIN_0512 Max. input voltage 0.512V
🔢Enum: ADS1015_GAIN_0256 Max. input voltage 0.256V
ADS1015 Input-0 Settings:
🔢Enum: ADS1015_AI0_AI1 Differential input
🔢Enum: ADS1015_AI3_AI0 Differential input
🔢Enum: ADS1015_AI1_AI3 Differential input
🔢Enum: ADS1015_AI2_AI3 Differential input
🔢Enum: ADS1015_AI0_GND Single end Input
🔢Enum: ADS1015_AI1_GND Single end Input
🔢Enum: ADS1015_AI2_GND Single end Input
🔢Enum: ADS1015_AI3_GND Single end Input
bool dev_ads1015_read_ex(i2c_inst_t* i2c, uint8_t addr, uint8_t channel, uint8_t mux, uint8_t gain, double *value)
▶️ Param: i2c I2C channel i2c0 or i2c1▶️ Param: addr I2C address ADS1015_ADDRn▶️ Param: channel Channel number ADS1015_CHn▶️ Param: mux Input mode ADS1015_AIx_xx▶️ Param: gain Input range ADS1015_GAIN_xxxx▶️ Param: value Channel adc value- ✅Return: true
- ❌Error Return: false
static inline bool dev_ads1015_read(i2c_inst_t* i2c, uint8_t addr, uint8_t channel, uint8_t gain, double *value)
▶️ Param: i2c I2C channel i2c0 or i2c1▶️ Param: addr I2C address ADS1015_ADDRn▶️ Param: channel Channel number ADS1015_CHn▶️ Param: gain Input range ADS1015_GAIN_xxxx▶️ Param: value Channel adc value- ✅Return: true
- ❌Error Return: false