Programming #
NORVI-EX-ANV16 uses LTC2497CUHF over I2C communication. On devices with address configuration support. The I2C addresses of the devices can be configured with the DIP switches at the bottom of the controller. It can Daisy chain up to 8 expansion modules.
Expansion Port #
The expansion port of the NORVI IIOT Controllers can be utilized for external sensor connections where raw GPIO connections are required or they can be used to plug NORVI Expansion Modules. Browse NORVI Expansion Product range. How to Connect NORVI Expansion Modules.
I2C Address Setting #
In the basic units of NORVI Analog Input Expansion, the Address of the unit is fixed to 0x48 at the factory. On modules with Address configuration options, the I2C Address of the expansion module can be configured by switching DIP Switches at the bottom of the expansion module. The device can be configured in 4, I2C addresses using the 4, switches.
Analog Inputs #
Wiring Analog Inputs #
The Analog input of the NORVI Analog input Expansion should be connected concerning the ground input of the controller. Reading the relevant channel of LTC2497 gives the value of the analog input.
Refer to the I2C Address setting to set the I2C address of the Expansion.
Programming Analog Inputs #
The below example code reads the analog inputs on the NORVI Analog input expansion and prints them on the serial monitor.
#include <Wire.h>
const int LTC2497_ADDRESS = 0x45;
uint32_t adc_value = 0;
long readLTC2497(byte channel) {
uint32_t data = 0;
Wire.beginTransmission(LTC2497_ADDRESS);
Wire.write(0xA0 | channel);
Wire.endTransmission();
delay(200);
Wire.requestFrom(LTC2497_ADDRESS, 4);
if (Wire.available() == 4) {
data = Wire.read();
data = (data << 8) | Wire.read();
data = (data << 8) | Wire.read();
}
return data;
}
void setup() {
Wire.begin(16,17);
Serial.begin(115200);
uint32_t data = readLTC2497(0);
}
void loop() {
float voltage;
unsigned int reading_channel=0;
for (int i = 0; i <= 7; i++) {
uint32_t data = readLTC2497(i);
delay(100);
data = readLTC2497(i);
adc_value = data<<8;
adc_value = adc_value>>2;
adc_value = adc_value & 0x3FFFFFFF;
adc_value -= 0x20000000;
voltage=(float) adc_value;
voltage = voltage / 536870912.0;
voltage = voltage * 5.0;
Serial.print(" A");
Serial.print(i);
Serial.print(" : ");
Serial.print(voltage);
delay(300);
}
Serial.println("");
delay(1000);
}