XStore
View Categories

NORVI AGENT 2-BA1 – USER GUIDE

1 min read

Programming  #

NORV AGENT 2-BA1 has a mini USB port for serial connection with the SoC for programming. Any ESP32 supported
A programming IDE can be used to program the controller. Follow this Guide to programming NORVI ESP32-based
Controllers with the Arduino IDE.
SoC: ESP32-WROOM32
Programming Port: USB UART

Wiring #

Wiring Digital Inputs and Analog Input #

The digital inputs of NORV AGENT 2-BA1 can be configured as both sink and source connections. The inverse of the
The polar digital input should be supplied to the common terminal.

NORV AGENT 2-BA1 Digital Input and Analog Input Wiring

Digital Input #

Programming Digital Inputs #

Reading the relevant GPIO of the ESP32 gives the value of the Digital Input. When the inputs are off, the GPIO
goes HIGH, and when the input is in the ON stage, GPIO goes LOW. Refer to the GPIO allocation table in the Datasheet
the digital input GPIO.

void setup() {
// put your setup code here, to run once:
pinMode(13, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int i1State = digitalRead(13);
Serial.print("I1: ");
Serial.println(i1State);
delay(1000); // Adjust the delay as needed
}

Relay Output #

Programming Relay Outputs #

Reading the relevant GPIO of the ESP32 gives the value of the relay output. Refer to the GPIO allocation table in the
Datasheet for the Relay Output GPIO

#define OUTPUT1 12
void setup() {
Serial.begin(115200);
Serial.println("Device Starting");
pinMode(OUTPUT1 , OUTPUT);
}
void loop() {
digitalWrite(OUTPUT1, HIGH);
delay(500);
digitalWrite(OUTPUT1, LOW);
delay(500);
Serial.println("");
delay(500);
}

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 the I2C GPIO of the OLED Display. Library
The supported Adafruit_SSD0306 Library is required to initialize I2C on correct pins

Programming OLED Display #

#include "SSD1306.h" // alias for `#include "SSD1306Wire.h"`
SSD1306 display(0x3C, 21, 22);
String adcString[8];
String buttonString;

void setup() {
  display.init();
  display.flipScreenVertically();
  display.setFont(ArialMT_Plain_10);
  display.drawString(0, 0, "Hello World");
  display.display();
  Serial.begin(115200);
}

void loop() { // Your OLED display-related code here
  display.clear();
  display.drawString(0, 0, "A0: "); 
  display.drawString(20, 0, adcString[0]);
  display.drawString(70, 0, "A1: "); 
  display.drawString(90, 0, adcString[1]);
  display.drawString(0, 10, "A2: "); 
  display.drawString(20, 10, adcString[2]);
  display.drawString(70, 10, "A3: "); 
  display.drawString(90, 10, adcString[3]);
  adcString[0] = String(digitalRead(13));
  adcString[1] = String(digitalRead(14));
  adcString[2] = String(digitalRead(27));
  adcString[3] = String(digitalRead(26));
  buttonString = String(digitalRead(4));
  display.drawString(0, 20, "D1: "); 
  display.drawString(20, 20, adcString[0]);
  display.drawString(70, 20, "D2: "); 
  display.drawString(90, 20, adcString[1]);
  display.drawString(0, 30, "D3: "); 
  display.drawString(20, 30, adcString[2]);
  display.drawString(70, 30, "D4: "); 
  display.drawString(90, 30, adcString[3]);
  display.drawString(0, 40, "Button: "); 
  display.drawString(40, 40, buttonString);
  display.display();
  delay(1000);
}

Built-in Buttons #

Read modeADC (Analog to Digital Conversion)
Analog IOGPIO4

Programming Buttons #

#include <Wire.h>
String buttonString;

void setup() {
  pinMode(4, INPUT); // Front panel push button switch
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  int buttonState = digitalRead(4);
  buttonString = String(buttonState);
  Serial.print("Button: ");
  Serial.println(buttonString);
  delay(1000); // Adjust the delay as needed
}

USB and Reset #

USB and Reset