XStore
View Categories

NORVI ENET-AE06-R – USER GUIDE

3 min read

Programming  #

The NORVI ENET-AE06-R 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 this 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 the NORVI-ENET-AE06-R can be configured as both Sink and Source connections. The inverse of the Digital Input polarity should be supplied to the common terminal.

NORVI-ENET-AE06-R 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 21

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

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

Relay Output #

NORVI ENET-AE06-R Relay Output Wiring

Programming Relay Outputs #

Reading the relevant GPIO of the ESP32 gives the value of the relay or transistor output.  Refer to the GPIO allocation table in the Datasheet for the relay/transistor output GPIO.

#define OUTPUT1 02

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 supported by the Adafruit_SSD0306 Library.

Wire.begin (SDA, SCL) is required to initialize I2C on the 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 IOGPIO36
GPIO Connection of buttons
Built-in button Internal Schematic

Programming Buttons #

#define buttonPin 36
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);
}

Internal RTC #

RTC ChipDS3231
Backup Battery TypeCR2032
InterfaceI2C
I2C Address0x68
SCL PinGPIO17
SDA PinGPIO16
GPIO Connections of RTC

Programming RTC #

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "RTClib.h"
 
RTC_DS3231 rtc;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
 
#define SCREEN_WIDTH 128  // OLED display width, in pixels
#define SCREEN_HEIGHT 64  // OLED display height, in pixels
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
 
void setup()  {
  Serial.begin(9600);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C))  { 
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }
  rtc.adjust(DateTime(__DATE__, __TIME__));
  display.display();
  delay(2);
  display.clearDisplay();
  display.clearDisplay();
  display.setTextColor(WHITE);   //display.startscrollright(0x00, 0x0F);
  display.setTextSize(2);
  display.setCursor(0,5);
  display.print("  Clock ");
  display.display();
  delay(3000);
}

void loop() {
  DateTime now = rtc.now();
  display.clearDisplay();
  display.setTextSize(2);
  display.setCursor(75,0);
  display.println(now.second(), DEC);

  display.setTextSize(2);
  display.setCursor(25,0);
  display.println(":");

  display.setTextSize(2);
  display.setCursor(65,0);
  display.println(":");
  display.setTextSize(2);
  display.setCursor(40,0);
  display.println(now.minute(), DEC);

  display.setTextSize(2);	
  display.setCursor(0,0);
  display.println(now.hour(), DEC);

  display.setTextSize(2);
  display.setCursor(0,20);
  display.println(now.day(), DEC);
  
  display.setTextSize(2);
  display.setCursor(25,20);
  display.println("-");

  display.setTextSize(2);
  display.setCursor(40,20);
  display.println(now.month(), DEC);

  display.setTextSize(2);
  display.setCursor(55,20);
  display.println("-");

  display.setTextSize(2);
  display.setCursor(70,20);
  display.println(now.year(), DEC);

  display.setTextSize(2);
  display.setCursor(0,40);
  display.print(daysOfTheWeek[now.dayOfTheWeek()]);
  display.display(); 
}

Micro SD Card Support #

SD CARD CSGPIO5
MISOGPIO19
MOSIGPIO23
SCLKGPIO18
GPIO Connections of SD Card

Programming SD Card #

#include <SD.h>
#define PIN_SPI_CS 05 // The ESP32 pin GPIO5
File myFile;

void setup() {
  Serial.begin(9600);
  if (!SD.begin(PIN_SPI_CS)) {
    Serial.println(F("SD CARD FAILED, OR NOT PRESENT!"));
    while (1); // stop the program
  }
  Serial.println(F("SD CARD INITIALIZED."));
  if (!SD.exists("esp32.txt")) {
    Serial.println(F("esp32.txt doesn't exist. Creating esp32.txt file..."));
    // create a new file by opening a new file and immediately close it
    myFile = SD.open("esp32.txt", FILE_WRITE);
    myFile.close();
  }
  // recheck if file is created or not
  if (SD.exists("esp32.txt"))
    Serial.println(F("esp32.txt exists on SD Card."));
  else
    Serial.println(F("esp32.txt doesn't exist on SD Card."));
}

void loop() {
}

USB and RESET #