NORVI ARITA INDUSTRIAL APPLICATIONS #
Programming #
NORVI-ARITA-STM32-M6 has a mini USB Port for serial connection with the SoC for programming. Any Arduino-supported programming IDE can be used to program the controller. Follow this Guide to programming NORVI Arduino-Based Controllers with Arduino IDE.
SoC: Arduino Maple – STM32
Programming Port: USB UART
Digital Inputs #
Wiring Digital Inputs #
The digital inputs of NORVI-ARITA-STM32-M6 can be configured as both a Sink and Source connection. The inverse of the Digital Input polar should be supplied to the common terminal.
Programming Digital Inputs #
Reading the relevant GPIO of AT-STM32 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 stage GPIO goes LOW. Refer to the GPIO allocation table in the Datasheet for the digital input GPIO.
#define in1 PD0
#define in2 PA8
#define in3 PE4
#define in4 PE3
#define in5 PE2
#define in6 PE1
#define in7 PE0
#define in8 PB9
#define in9 PB8
#define in10 PB5
#define in11 PD7
#define in12 PD6
#define in13 PD5
#define in14 PD4
void setup() {
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
pinMode(in5, OUTPUT);
pinMode(in6, OUTPUT);
pinMode(in7, OUTPUT);
pinMode(in8, OUTPUT);
pinMode(in9, OUTPUT);
pinMode(in10, OUTPUT);
pinMode(in11, OUTPUT);
pinMode(in12, OUTPUT);
pinMode(in13, OUTPUT);
pinMode(in14, OUTPUT);
}
void loop() {
digitalWrite(in1, LOW);
digitalWrite(in2, LOW);
digitalWrite(in3, LOW);
digitalWrite(in4, LOW);
digitalWrite(in5, LOW);
digitalWrite(in6, LOW);
digitalWrite(in7, LOW);
digitalWrite(in8, LOW);
digitalWrite(in9, LOW);
digitalWrite(in10, LOW);
digitalWrite(in11, LOW);
digitalWrite(in12, LOW);
digitalWrite(in13, LOW);
digitalWrite(in14, LOW);
}
RELAY AND TRANSISTOR OUTPUTS #
Wiring Relay and Transistor Outputs #
Programming Relay/ Transistor Outputs #
Reading the relevant GPIO of AT-STM32 gives the value of the Relay/ Transistor Output. Refer to the GPIO allocation table in the Datasheet for the Relay/ Transistor Output GPIO.
#define RO1 PC5
#define RO2 PB0
#define RO3 PB1
#define RO4 PE7
#define RO5 PE8
#define RO6 PE9
#define RO7 PE10
#define RO8 PE11
#define RO9 PA0
#define RO10 PA1
#define TR1 PA4
#define TR2 PC4
void setup() {
pinMode(RO1, OUTPUT);
pinMode(RO2, OUTPUT);
pinMode(RO3, OUTPUT);
pinMode(RO4, OUTPUT);
pinMode(RO5, OUTPUT);
pinMode(RO6, OUTPUT);
pinMode(RO7, OUTPUT);
pinMode(RO8, OUTPUT);
pinMode(RO9, OUTPUT);
pinMode(RO10, OUTPUT);
pinMode(TR1, OUTPUT);
pinMode(TR2, OUTPUT);
}
void loop() {
digitalWrite(RO1, HIGH);
digitalWrite(RO2, HIGH);
digitalWrite(RO3, HIGH);
digitalWrite(RO4, HIGH);
digitalWrite(RO5, HIGH);
digitalWrite(RO6, HIGH);
digitalWrite(RO7, HIGH);
digitalWrite(RO8, HIGH);
digitalWrite(RO9, HIGH);
digitalWrite(RO10, HIGH);
digitalWrite(TR1, HIGH);
digitalWrite(TR2, HIGH);
delay(500);
digitalWrite(RO1, LOW);
digitalWrite(RO2, LOW);
digitalWrite(RO3, LOW);
digitalWrite(RO4, LOW);
digitalWrite(RO5, LOW);
digitalWrite(RO6, LOW);
digitalWrite(RO7, LOW);
digitalWrite(RO8, LOW);
digitalWrite(RO9, LOW);
digitalWrite(RO10, LOW);
digitalWrite(TR1, LOW);
digitalWrite(TR2, LOW);
}
RS-485 COMMUNICATION #
RS-485 Wiring #
Driver | MAX485CSA |
TX | PA9 |
RX | PA10 |
Flow Control | PC9 |
Programming RS-485 #
NORVI ARITA-STM32 series RS-485 connection uses a half-duplex mode of MAX485 transmitter with UART Communication.
#define RXD PA10
#define TXD PA9
#define FC PC9
void setup() {
Serial.begin(9600);
pinMode(FC, OUTPUT);
Serial1.begin(9600, SERIAL_8N1,RXD,TXD);
}
void loop() {
digitalWrite(FC, HIGH); // Make FLOW CONTROL pin HIGH
Serial1.println("RS485 01 SUCCESS"); // Send RS485 SUCCESS serially
delay(500); // Wait for transmission of data
digitalWrite(FC, LOW); // Receiving mode ON
while (Serial1.available()) { // Check if data is available
char c = Serial1.read(); // Read data from RS485
Serial.write(c); // Print data on serial monitor
}
delay(1000);
}
Built-in OLED Display #
Display driver | SSD1306 |
Communication | I2C |
Module Address | 0x3C |
Resolution | 128 x 64 |
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 <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
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 1);
display.print("ICONIC");
display.setCursor(0, 25);
display.setTextSize(1);
display.println("NORVI CONTROLLER");
display.println("K8");
display.println("12 DI|1 PWM|4 AI|7 RL");
display.println("ETHERNET | SD CARD");
display.display();
delay(5000);
display.clearDisplay();
display.setTextSize(0);
Serial.print("Initializing SD card...");
display.clearDisplay();
display.setCursor(0, 0);
display.print("Initializing SD card.");
display.display();
delay(2000);
}
void loop() {
display1();
delay(5000);
}
void display1() {
display.clearDisplay();
display.setCursor(0, 0);
display.println("Test Analog Inp");
display.println("");
display.display();
}
Built-in Buttons #
Button 1 Pin | PC1 |
Button 2 Pin | PC0 |
Button 3 Pin | PE6 |
Button 4 Pin | PE5 |
Programming Buttons #
#define sw1 PC2
#define sw2 PC3
#define sw3 PC4
#define sw4 PC5
void check() {
digitalWrite(RO1, !digitalRead(in1));
digitalWrite(RO2, !digitalRead(in2));
digitalWrite(RO3, !digitalRead(in3));
digitalWrite(RO4, digitalRead(sw1));
digitalWrite(RO5, digitalRead(sw2));
digitalWrite(RO6, digitalRead(sw3));
digitalWrite(RO7, digitalRead(sw4));
}
void setup() {
pinMode(sw1, INPUT);
pinMode(sw2, INPUT);
pinMode(sw3, INPUT);
pinMode(sw4, INPUT);
}
void loop() {
delay(200);
}
Internal RTC #
RTC Chip | DS1307ZN+ |
Backup Battery Type | CR2450N-IB |
Interface | I2C |
I2C Address | 0x68 |
SCL Pin | PB6 |
SDA Pin | PB7 |
Programming RTC #
#include "RTClib.h"
RTC_DS1307 rtc;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
void setup () {
Serial.begin(9600);
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
while (1);
}
if (! rtc.isrunning()) {
Serial.println("RTC is NOT running!");
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
}
void loop () {
DateTime now = rtc.now();
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(" (");
Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
Serial.print(") ");
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
Serial.print(" since midnight 1/1/1970 = ");
Serial.print(now.unixtime());
Serial.print("s = ");
Serial.print(now.unixtime() / 86400L);
Serial.println("d");
DateTime future (now + TimeSpan(7,12,30,6));
Serial.print(" now + 7d + 12h + 30m + 6s: ");
Serial.print(future.year(), DEC);
Serial.print('/');
Serial.print(future.month(), DEC);
Serial.print('/');
Serial.print(future.day(), DEC);
Serial.print(' ');
Serial.print(future.hour(), DEC);
Serial.print(':');
Serial.print(future.minute(), DEC);
Serial.print(':');
Serial.print(future.second(), DEC);
Serial.println();
Serial.println();
delay(3000);
}