XStore
View Categories

NORVI IIOT-AE02-I – User Guide

4 min read

Programming #

The NORVI IIOT-AE02-I has a mini USB Port for serial connection with the SoC for programming. Any ESP32-supported programming IDE can be used to program the controller. Follow the Guide to Programming NORVI ESP32-Based Controllers with the Arduino IDE.

SoC: ESP32-WROOM32
Programming Port: USB UART

Digital Inputs #

Wiring Digital Inputs #

The digital inputs of NORVI-IIOT-AE02-I can be configured as both Sink and Source connections. The inverse of the Digital Input polarity should be supplied to the common terminal.

NORVI-IIOT-AE02-I Digital Input Wiring

Programming Digital Inputs #

Reading the relevant GPIO of the ESP32 gives the value of the Digital Input. When the inputs are in the OFF state, the GPIO goes HIGH, and when the input is in the ON state, the GPIO goes LOW.

Refer to the GPIO allocation table in the Datasheet for the digital input GPIO

#define INPUT1 18

void setup() {
  Serial.begin(115200);
  Serial.println("Device Starting");
  pinMode(INPUT1, INPUT);
}

void loop() {
  Serial.print(digitalRead(INPUT1));
  Serial.println(""); 
  delay(500);
}

Transistor Outputs #

Wiring Transistor Outputs #

NORVI-IIOT-AE02-I Transistor Output Wiring

4 – 20 mA Analog Input #

Wiring Analog Inputs #

NORVI IIOT-AE02-I Analog Input Wiring

Reading Analog Input #

Reading the relevant I2C address of the ADC gives the value of the Analog Input.

Programming Analog Inputs  #

#include <Adafruit_ADS1X15.h>
#include <Wire.h>
Adafruit_ADS1115 ads1;
Adafruit_ADS1115 ads2;

void setup() {
  Serial.begin(115200);
  Serial.println("Device Starting");
  Wire.begin(16,17);
  ads1.begin(0x48);
  ads2.begin(0x49);
  ads1.setGain(GAIN_ONE); 
  ads2.setGain(GAIN_ONE);  
}

void loop() {
  Serial.print("Analog 1  ");
  Serial.println(ads1.readADC_SingleEnded(0));
  delay(10);
  Serial.print("Analog 2  ");
  Serial.println(ads1.readADC_SingleEnded(1));
  delay(10);
  Serial.print("Analog 3  ");
  Serial.println(ads1.readADC_SingleEnded(2));
  delay(10);
  Serial.print("Analog 4  ");
  Serial.println(ads1.readADC_SingleEnded(3));
  delay(10);
  Serial.print("Analog 5  ");
  Serial.println(ads2.readADC_SingleEnded(0));
  delay(10);
  Serial.print("Analog 6  ");
  Serial.println(ads2.readADC_SingleEnded(1));
  delay(10);
  Serial.print("Analog 7  ");
  Serial.println(ads2.readADC_SingleEnded(2));
  delay(10);
  Serial.print("Analog 8  ");
  Serial.println(ads2.readADC_SingleEnded(3));
  delay(10);
  Serial.println(""); 
  delay(500);
}

RS-485 communication #

RS-485 Wiring #

DriverMAX485
UART RXGPIO3
UART TXGPIO1
Flow ControlGPIO4
GPIO Connections of RS-485

Programming RS-485 #

The UART Connections of RS-485 in the NORVI IIOT-AE02 series are shared with the UART connections of the USB Serial.

NORVI-IIOT-AE01 and NORVI-IIOT-AE02 product ranges utilize RS485 communication where the TX (Transmit) and RX (Receive) pins are shared with the USB RX and TX pins. This means that the same physical pins are used for both serial communication with a computer via USB and RS485 communication. 

As a result, direct use of serial print functions for communication is not possible when connected to such devices. An alternative solution would be to output the result to an OLED display, providing visual feedback on the data.

#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#define FC 4
#define RXD 3
#define TXD 1
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET    -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  Serial.begin(9600);
  pinMode(FC, OUTPUT); 
  digitalWrite(FC, LOW);  
  Wire.begin(16, 17);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.display();
}

void loop() { 
  Serial1.println(F("RS485 01 SUCCESS"));
  while (Serial.available()) {  // Check if data is available
    char c = Serial.read();     // Read data from RS485
    display.clearDisplay();
    display.setTextColor(WHITE);
    display.setTextSize(1);
    display.setCursor(0, 12);
    display.print(c);
    delay(100);
    display.display();
  }
}

Built-in OLED Display #

Display driverSSD1306
CommunicationI2C
Module Address0x3C
Resolution128 x 64
0.96 OLED Display Specification

Refer to the GPIO allocation table in the datasheet for I2C GPIO of the OLED Display.

Library supported by the Adafruit_SSD0306 Library.

Wire.begin (SDA, SCL); is required to initialize I2C on correct pins

Programming OLED Display #

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  Wire.begin(16,17); 
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x64
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }
  // Show initial display buffer contents on the screen --
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(2000); // Pause for 2 seconds
  }

void loop() {
}

Built-in Buttons #

Read modeADC (Analog to Digital Conversion)
Analog IOGPIO32
Built-in button Internal Schematic

Programming Buttons #

#define buttonPin 32
int  buttonState = 0;

void setup() { 
  Serial.begin(9600);                             
  pinMode(buttonPin,INPUT);
}

void loop() { 
  Serial.print("Button: ");
  buttonState = analogRead(buttonPin);
  delay(50);
  Serial.print(analogRead(buttonPin));
  Serial.print("\tAnalog: ");
  delay(1000);
}

RESET and USB #