Step motor angle control with sequence controller for Smart Automation
- Digital input(VR) / output
- LED on/off control / step motor angle control
Sequence controller with iteration algorithm for Smart Automation
- Digital input(VR) / output
- LED on/off control with iteration algorithm
Sequence Controller for Smart Automation
- Digital input
- Digital output
- Step motor control
- LED control
HMI-based smartfarm control system
Human-machine interface (HMI)
Graph-based monitoring
Temperature sensor
Humidity sensor
#include <HX711.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define calibration_factor -425.0
double zero = 1.9 ;
double alpha = 0.3 ;
double mass_pre = 0 ;
#define DOUT 9
#define CLK 8
HX711 scale(DOUT, CLK);
int buzzer = 5 ;
int led_red = 4 ;
int led_yellow = 3 ;
int led_green = 2 ;
int mass_th_1 = 100 ;
int mass_th_2 = 200 ;
void setup() {
Serial.begin(115200);
scale.set_scale(calibration_factor);
scale.tare();
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("XEM-001B / Test!");
lcd.setCursor(0, 1);
lcd.print("Load data=");
pinMode(led_red, OUTPUT);
pinMode(led_yellow, OUTPUT);
pinMode(led_green, OUTPUT);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, LOW);
analogWrite(buzzer, 0);
}
void loop() {
double mass_cur = scale.get_units() - zero ;
double mass = (1 - alpha) * mass_pre + alpha * mass_cur ;
mass_pre = mass ;
String strMass = String(mass);
lcd.setCursor(10, 1);
lcd.print(strMass);
lcd.setCursor(15, 1);
lcd.print("g");
if (mass < 10) {
lcd.setCursor(14, 1);
lcd.print(" g");
}
if (mass < mass_th_1) {
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, HIGH);
analogWrite(buzzer, 0);
lcd.setCursor(0, 0);
lcd.print("XEM-001B / Green");
}
if (mass >= mass_th_1 && mass < mass_th_2) {
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, HIGH);
digitalWrite(led_green, LOW);
analogWrite(buzzer, 0);
lcd.setCursor(0, 0);
lcd.print("XEM-001B /Yellow");
}
if (mass >= mass_th_2) {
digitalWrite(led_red, HIGH);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, LOW);
analogWrite(buzzer, 5);
lcd.setCursor(0, 0);
lcd.print("XEM-001B / Red ");
}
}
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
int buzzer = 5 ;
int led_red = 4 ;
int led_yellow = 3 ;
int led_green = 2 ;
int ill_sensor = A2 ;
int th_upper = 800 ;
int th_lower = 700 ;
void setup() {
Serial.begin(9600) ;
Serial.print("LCD test with sensor and led~!") ;
pinMode(buzzer, OUTPUT);
pinMode(led_red, OUTPUT);
pinMode(led_yellow, OUTPUT);
pinMode(led_green, OUTPUT);
pinMode(ill_sensor, INPUT);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, LOW);
analogWrite(buzzer, 0);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("XEM-001B");
lcd.setCursor(9, 1);
lcd.print("CDS:");
}
void loop() {
int value = analogRead(ill_sensor);
lcd.setCursor(13, 1);
lcd.print(value);
if (value >= th_upper) {
lcd.setCursor(9, 0);
lcd.print("RED ");
lcd.setCursor(0, 1);
lcd.print("BUZZ-OFF");
analogWrite(buzzer, 0);
digitalWrite(led_red, HIGH);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, LOW);
} else if (value >= th_lower & value < th_upper) {
lcd.setCursor(9, 0);
lcd.print("YELLOW ");
lcd.setCursor(0, 1);
lcd.print("BUZZ-OFF");
analogWrite(buzzer, 0);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, HIGH);
digitalWrite(led_green, LOW);
} else if (value < th_lower) {
lcd.setCursor(9, 0);
lcd.print("GREEN ");
lcd.setCursor(0, 1);
lcd.print("BUZZ-ON ");
analogWrite(buzzer, 10);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, HIGH);
}
}
int led_red = 12 ;
int led_yellow = 13 ;
int time_delay = 500 ;
void setup() {
Serial.begin(9600) ;
Serial.print("LED blinking test~!") ;
pinMode(led_red, OUTPUT);
pinMode(led_yellow, OUTPUT);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, LOW);
}
void loop() {
digitalWrite(led_red, HIGH);
delay(time_delay);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, HIGH);
delay(time_delay);
digitalWrite(led_yellow, LOW);
}
int led_red = 12 ;
int led_yellow = 13 ;
int buzzer = 3 ;
int val_buz = 5 ;
int time_delay = 100 ;
int value = 0 ;
int sensor_port = A0 ;
int value_th = 250 ;
void setup() {
Serial.begin(9600) ;
Serial.print("LED blinking test~!") ;
pinMode(led_red, OUTPUT);
pinMode(led_yellow, OUTPUT);
pinMode(sensor_port, INPUT);
pinMode(buzzer, OUTPUT);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, LOW);
}
void loop() {
for (int i = 0; i <= 5; i++) {
digitalWrite(led_red, HIGH);
delay(time_delay);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, HIGH);
delay(time_delay);
digitalWrite(led_yellow, LOW);
}
while (1) {
value = analogRead(sensor_port) ;
Serial.print("Sensor value = ") ;
Serial.println(value) ;
if (value < value_th) {
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, HIGH);
} else {
digitalWrite(led_yellow, LOW);
digitalWrite(led_red, HIGH);
}
}
}
int led_red = 12 ;
int led_yellow = 13 ;
int buzzer = 3 ;
int val_buz = 5 ;
int time_delay = 100 ;
int value = 0 ;
int sensor_port = A0 ;
int value_th = 250 ;
void setup() {
Serial.begin(9600) ;
Serial.print("LED blinking test~!") ;
pinMode(led_red, OUTPUT);
pinMode(led_yellow, OUTPUT);
pinMode(sensor_port, INPUT);
pinMode(buzzer, OUTPUT);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, LOW);
}
void loop() {
for (int i = 0; i <= 5; i++) {
digitalWrite(led_red, HIGH);
delay(time_delay);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, HIGH);
delay(time_delay);
digitalWrite(led_yellow, LOW);
}
while (1) {
value = analogRead(sensor_port) ;
Serial.print("Sensor value = ") ;
Serial.println(value) ;
if (value < value_th) {
digitalWrite(led_red, LOW);
analogWrite(buzzer, 0);
digitalWrite(led_yellow, HIGH);
} else {
digitalWrite(led_yellow, LOW);
analogWrite(buzzer, val_buz);
digitalWrite(led_red, HIGH);
}
}
}
int led_red = 4 ;
int led_yellow = 3 ;
int led_green = 2 ;
int time_delay = 100 ;
void setup() {
Serial.begin(9600) ;
Serial.print("LED blinking test~!") ;
pinMode(led_red, OUTPUT);
pinMode(led_yellow, OUTPUT);
pinMode(led_green, OUTPUT);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, LOW);
}
void loop() {
digitalWrite(led_red, HIGH);
delay(time_delay);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, HIGH);
delay(time_delay);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, HIGH);
delay(time_delay);
digitalWrite(led_green, LOW);
}
int led_red = 4 ;
int led_yellow = 3 ;
int led_green = 2 ;
int relay_port = 7 ;
int time_delay_led = 100 ;
int time_delay_relay_on = 1000 ;
int time_delay_relay_off = 1500 ;
void setup() {
Serial.begin(9600) ;
Serial.print("Relay on/off test~!") ;
pinMode(led_red, OUTPUT);
pinMode(led_yellow, OUTPUT);
pinMode(led_green, OUTPUT);
pinMode(relay_port, OUTPUT);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, LOW);
digitalWrite(relay_port, LOW);
}
void loop() {
for (int h = 0; h <= 2; h++) {
for (int i = 4; i >= 2; i--) {
digitalWrite(i, HIGH);
delay(time_delay_led);
digitalWrite(i, LOW);
}
}
while (1) {
digitalWrite(relay_port, HIGH);
digitalWrite(led_green, HIGH);
delay(time_delay_relay_on);
digitalWrite(led_green, LOW);
digitalWrite(relay_port, LOW);
digitalWrite(led_red, HIGH);
delay(time_delay_relay_off);
digitalWrite(led_red, LOW);
}
}
int led_red = 4 ;
int led_yellow = 3 ;
int led_green = 2 ;
int relay_port = 7 ;
int time_delay_led = 100 ;
int time_delay_relay_on = 1000 ;
int time_delay_relay_off = 1500 ;
int value = 0 ;
int sensor_port = A0 ;
int value_th = 600 ;
void setup() {
Serial.begin(9600) ;
Serial.print("Relay on/off test~!") ;
pinMode(led_red, OUTPUT);
pinMode(led_yellow, OUTPUT);
pinMode(led_green, OUTPUT);
pinMode(relay_port, OUTPUT);
pinMode(sensor_port, INPUT);
digitalWrite(led_red, LOW);
digitalWrite(led_yellow, LOW);
digitalWrite(led_green, LOW);
digitalWrite(relay_port, LOW);
}
void loop() {
for (int h = 0; h <= 2; h++) {
for (int i = 4; i >= 2; i--) {
digitalWrite(i, HIGH);
delay(time_delay_led);
digitalWrite(i, LOW);
}
}
while (1) {
value = analogRead(sensor_port) ;
Serial.print("Sensor value = ") ;
Serial.println(value) ;
if (value < value_th) {
digitalWrite(led_red, LOW);
digitalWrite(relay_port, HIGH);
digitalWrite(led_green, HIGH);
} else {
digitalWrite(led_green, LOW);
digitalWrite(relay_port, LOW);
digitalWrite(led_red, HIGH);
}
}
}
Aluminium profile engineering
Milling process with CNC
Main computer
Input
Output
Motion controller for motor control
Left: step motor
Right: servo motor
Two step motors
For position control on X-Y plane
Main control unit
Integrated module
1) Basic
2) PLC
Data analysis
Image processing
Artificial intelligence
Simulation techniques (control)
Dynamic modeling and analysis
Real-time application
Obtain sensor information and analysis
- Temperature, motion detector, distance sensor, etc.
Digital control
- DC Motor, servo motor, step motor, light, etc
Internet of Things (IoT)
- Bluetooth / internet communication
Digital input signal by push button
- LED on/off control
Materials : Arduino, breadboard, LED, push button, electric wire, code
Code for LED-button control
void setup() {
Serial.begin(9600) ;
pinMode(2,INPUT);
pinMode(6,OUTPUT);
}
void loop() {
int value = digitalRead(2);
Serial.println(value) ;
if (value == HIGH){
digitalWrite(6,HIGH);
}
else {
digitalWrite(6,LOW);
}
}
Digital input signal by push button and CAN communication-based LED control
- LED on/off control
Materials : Arduino, CAN module(MCP 2515), breadboard, LED, push button, electric wire, code
Digital input signal by push button and CAN communication-based LED control
- LED on/off control
Materials : Arduino, CAN module(MCP 2515), breadboard, LED, push button, electric wire, code
Counting algorithm with open loop algorithm
- using segment
Materials : Arduino nano, segment, data cable and wires
- Single point lidar
- Variable resistor