Project tutorial
Automatic Monorail Control

Automatic Monorail Control © GPL3+

This tool can control the Autran Vanguard monorail from manual to automatic, and reduce wasted time.

  • 112 views
  • 0 comments
  • 2 respects

About this project

Previously, we had a robot carrier box. This robot serves to deliver the box to each station that has been specified based on the paper in the box. In order to deliver the box to the destination, the operator must press the button based on the data in the paper. But, in fact, operators often wrong push buttons and finally the box sent to the wrong destination. So, we modified this button using an Arduino Uno.

Now, the operator no longer needs to push the button to send the box, but simply scan the barcode that is in the paper. The program will automatically redirect the box to the right destination, so that operators can save time and reduce human error.

To make this real, we made an MCU and relay circuit using an Arduino Uno and created a program on the computer. This computer program serves to capture the results of barcode scans. Then the barcode data will be analyzed and searched its station address on the server database AS 400. From there, the data address will be sent a character to the serial port.

Data from this serial port will be taken by Arduino and will activate relay 1, 2, 3, 4, or 5.

I also use the wacthdog module, which has function for resetting the Arduino when the MCU crashes or hangs.

Code

arduino codeArduino
this code, is only for arduino
#include <Wire.h>  // Comes with Arduino IDE
#include <LiquidCrystal_I2C.h> //library for I2C LCD 16x2

/* A5 => SCL, A4 => SDA */
/* monorail control program
/* Modified 10/05/2018 by M. Ambar Farid
/*-----( Declare Constants )-----*/
#define R1 2
#define R2 3
#define R3 4
#define R4 5
#define R5 6
#define R6 7
#define R7 8
#define R8 9
#define WD 10

/*-----( Declare objects )-----*/
// set the LCD address to 0x27 for a 20 chars 4 line display
// Set the pins on the I2C chip used for LCD connections:
//                    addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x20, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

void setup() {
  // initialization only for one time
  
  //initialization serial
  //initialization pin output digital relay and watchdog
  pinMode(R1, OUTPUT);
  digitalWrite(R1,HIGH);
  
  pinMode(R2, OUTPUT);
  digitalWrite(R2,HIGH);
  
  pinMode(R3, OUTPUT);
  digitalWrite(R3,HIGH);
  
  pinMode(R4, OUTPUT);
  digitalWrite(R4,HIGH);
  
  pinMode(R5, OUTPUT);
  digitalWrite(R5,HIGH);
  
  pinMode(R6, OUTPUT);
  digitalWrite(R6,HIGH);
  
  pinMode(R7, OUTPUT);
  digitalWrite(R7,HIGH);
  
  pinMode(R8, OUTPUT);
  digitalWrite(R8,HIGH);
  
  pinMode(WD, OUTPUT);   //output for watchdog
  
  lcd.begin(16,2);   // initialization lcd 16x2
  Serial.begin(9600); //initialization serial
  
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("MONORAIL CONTROL");
  lcd.setCursor(3,1);
  lcd.print("Powered By:");
  delayActive(2000);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("M.A.Farid");
  lcd.setCursor(0,1);
  
}

void loop() {
 
  if(Serial.available()) {
    char inChar = (char)Serial.read();
    lcd.setCursor(2,1);
    lcd.print("STATION   ON");
    lcd.setCursor(10,1);
    switch(inChar) {
      case '1':
        lcd.write(inChar);
        digitalWrite(R1,LOW);
        delayActive(400);
        digitalWrite(R1,HIGH);
        delay(200);
        digitalWrite(R8,LOW);
        delayActive(400);
        digitalWrite(R8,HIGH);
        break;
        
      case '2':
        lcd.write(inChar);
        digitalWrite(R2,LOW);
        delayActive(400);
        digitalWrite(R2,HIGH);
        delay(200);
        digitalWrite(R8,LOW);
        delayActive(400);
        digitalWrite(R8,HIGH);
        break;
        
      case '3':
        lcd.write(inChar);
        digitalWrite(R3,LOW);
        delayActive(400);
        digitalWrite(R3,HIGH);
        delay(200);
        digitalWrite(R8,LOW);
        delayActive(400);
        digitalWrite(R8,HIGH);
        break;
        
      case '4':
        lcd.write(inChar);
        digitalWrite(R4,LOW);
        delayActive(400);
        digitalWrite(R4,HIGH);
        delay(200);
        digitalWrite(R8,LOW);
        delayActive(400);
        digitalWrite(R8,HIGH);
        break;
        
      case '5':
        lcd.clear();
        lcd.setCursor(2,0);
        lcd.write("NON STATION !");
        digitalWrite(R5,LOW);
        lcd.setCursor(2,1);
        lcd.write("GET OUT BOX");
        delayActive(1000);
        lcd.setCursor(2,1);
        lcd.write("FROM CONVEYOR");
        delayActive(2000);
        digitalWrite(R5,HIGH);
        break;
        
      case '6':
        lcd.write(inChar);
        digitalWrite(R6,LOW);
        delayActive(400);
        digitalWrite(R6,HIGH);
        delay(200);
        digitalWrite(R8,LOW);
        delayActive(400);
        digitalWrite(R8,HIGH);
        break;
        
      case '7':
        lcd.write(inChar);
        digitalWrite(R7,LOW);
        delayActive(400);
        digitalWrite(R7,HIGH);
        delay(200);
        digitalWrite(R8,LOW);
        delayActive(400);
        digitalWrite(R8,HIGH);
        break;
        
      case '8':
        lcd.write(inChar);
        digitalWrite(R8,LOW);
        delayActive(1000);
        digitalWrite(R8,HIGH);
        break;
        
      default:
        break;
      }
    lcd.setCursor(0,1);
    lcd.print("               ");
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("SYSTEM READY");
  }
  watchdogTrigger();
}

void delayActive(int millisecond) {
    
   if(millisecond<100){
      watchdogTrigger(); 
   } else {
      while (1) {
        watchdogTrigger();
        if (millisecond > 1000){
          delay(900);
          millisecond -= 1000;
        } else {
          delay(millisecond);
          break;
        }
      }
   }
}
void watchdogTrigger(){
  
  digitalWrite(WD,HIGH);
  delay(50);
  digitalWrite(WD,LOW); 
  delay(50); 
}

Schematics

automatic monorail control

No document.

schematich diagram
Hardware diagram rrm3odz04d

Comments

Submitted to Contest

Grove Starter Kit by Seeed Studio

Arduino / Distrelec: Automation & Robotics Contest

Author

Photo
Muhammad ambar farid
  • 0 projects
  • 0 followers

Published on

July 31, 2018

Members who respect this project

Photo

and 1 other

See similar projects
you might like

Similar projects you might like

Control Your Computer With A Remote Control

Project tutorial by Arduino_Scuola

  • 5,942 views
  • 1 comment
  • 8 respects

Automatic Temperature Based Fan Control (for Media Cabinets)

Project tutorial by Vess Bakalov

  • 4,368 views
  • 4 comments
  • 23 respects

Control an LED with the Remote Control

Project showcase by Nicholas_N

  • 3,192 views
  • 2 comments
  • 9 respects

Automatic Fan Control System

Project tutorial by Muhammad Sheraz

  • 2,943 views
  • 0 comments
  • 3 respects

Temperature Control

Project tutorial by reteprelleum

  • 4,689 views
  • 1 comment
  • 25 respects
Add projectSign up / Login