0% found this document useful (0 votes)
73 views15 pages

Servo Motor 1 Servo Motor 2

The document describes a circuit diagram for an Arduino Uno board connected to two servo motors and an LCD display. The Arduino board is shown with its microcontroller, power sources, and pin connections. Servo motor 1 and servo motor 2 are connected to specific pins on the Arduino to control their movement. The LCD display is also connected to pins on the Arduino to control the display output.

Uploaded by

Aniket Chouhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views15 pages

Servo Motor 1 Servo Motor 2

The document describes a circuit diagram for an Arduino Uno board connected to two servo motors and an LCD display. The Arduino board is shown with its microcontroller, power sources, and pin connections. Servo motor 1 and servo motor 2 are connected to specific pins on the Arduino to control their movement. The LCD display is also connected to pins on the Arduino to control the display output.

Uploaded by

Aniket Chouhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

+88.

+88.8
SERVO MOTOR 1 SERVO MOTOR 2

LCD1
LM016L

ARD1

ON

VDD
VSS

VEE
Reset BTN

RW
RS

D0
D1
D2
D3
D4
D5
D6
D7
E
www.TheEngineeringProjects.com

1
2
3

4
5
6

7
8
9
10
11
12
13
14
AREF

13
PB5/SCK
12
PB4/MISO
RESET 11
B1 ~ PB3/MOSI/OC2A
10
~ PB2/OC1B
05 9
~ PB1/OC1A
8
PB0/ICP1/CLKO
ATMEGA328P-PU
1121

7
ANALOG IN

PD7/AIN1
6
A0 ~ PD7/AIN1
5
PC0/ADC0
A1 ~ PD5/T1/OC0B
4
PC1/ADC1
A2 PD4/T0/XCK
3
PC2/ADC2
A3 ~ PD3/INT1/OC2B
2
PC3/ADC3 PD2/INT0
A4 1
PC4/ADC4/SDA PD1/TXD
A5 0
PC5/ADC5/SCL PD0/RXD

ARDUINO UNO

GSM MODULE
RXD

TXD

RTS

BUZ1 CTS
D2 D1
LED-RED LED-GREEN
SUB? R1
BUZZER
1k
CCT001
CODE

#include<LiquidCrystal.h>

#include <Servo.h>

LiquidCrystal lcd(2,3,4,5,6,7);

int temp=0,i;

int stop1=0;

char str[15];

Servo myservo1;

Servo myservo2;

# define RED 9 // motor on led

# define GREEN 8 // push switch left side

# define BUZZER 10// from pump off led

# define led 13

void setup()

pinMode(RED, OUTPUT);

pinMode(GREEN,OUTPUT);

pinMode(BUZZER, OUTPUT);

pinMode(led, OUTPUT);

myservo1.attach(11);

myservo2.attach(12);
lcd.clear();

lcd.print("AUTOMATIC GSM");

lcd.setCursor(5,1);

lcd.print("BASED");

delay(3000);

lcd.clear();

lcd.print("RAILWAY GATE");

lcd.setCursor(2,1);

lcd.print(" CONTROLLER ");

delay(3000);

gsm_init();

digitalWrite(RED,HIGH);

digitalWrite(GREEN,HIGH);

digitalWrite(BUZZER,HIGH);

lcd.clear();

lcd.setCursor(0,1);

lcd.print(" SYSTEM READY");

delay(200);

digitalWrite(RED,HIGH);

digitalWrite(GREEN,LOW);

digitalWrite(BUZZER,LOW);

myservo1.write(0);

myservo2.write(0);
Serial.println("AT+CNMI=2,2,2,0,0");

delay(500);

Serial.println("AT+CMGF=1");

delay(1000);

lcd.clear();

lcd.print("PLEASE STOP");

lcd.setCursor(0,1);

lcd.print(" GATE CLOSED ");

delay(1000);

void loop()

if(temp==1)

check();

temp=0;

i=0;

delay(1000);

void serialEvent()

while(Serial.available())
{

if(Serial.find("#A."))

digitalWrite(led, HIGH);

delay(1000);

digitalWrite(led, LOW);

while (Serial.available())

char inChar=Serial.read();

str[i++]=inChar;

if(inChar=='*')

temp=1;

return;

void check()

if(!(strncmp(str,"gate open",9))) /// #A.gate open* OK #A.gate close* +CPIN: READY

{
lcd.clear();

lcd.print("PLEASE WAIT");

lcd.setCursor(0,1);

lcd.print("GATE TRY TO OPEN");

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);
delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

myservo1.write(65);

myservo2.write(65);

delay(200);

digitalWrite(BUZZER, LOW);

digitalWrite(RED,LOW);

digitalWrite(GREEN,HIGH);

GATEOPEN();

lcd.clear();

lcd.print("YOU CAN GO");

lcd.setCursor(0,1);

lcd.print(" GATE OPEN ");


}

else if(!(strncmp(str,"gate close",10)))

digitalWrite(RED,HIGH);

digitalWrite(GREEN,LOW);

lcd.clear();

lcd.print("PLEASE WAIT");

lcd.setCursor(0,1);

lcd.print("GATE TRY TO CLS");

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);
digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

delay(200);

digitalWrite(BUZZER, LOW);

delay(200);

digitalWrite(BUZZER, HIGH);

myservo1.write(0);

myservo2.write(0);

delay(200);

digitalWrite(BUZZER, LOW);
GATECLOSE();

lcd.clear();

lcd.print("PLEASE STOP");

lcd.setCursor(0,1);

lcd.print(" GATE CLOSED ");

void gsm_init()

lcd.clear();

lcd.print("Finding Module..");

boolean at_flag=1;

while(at_flag)

Serial.println("AT");

while(Serial.available()>0)

if(Serial.find("OK"))

at_flag=0;

delay(1000);

lcd.clear();

lcd.print("Module Connected..");

delay(1000);
lcd.clear();

lcd.print("Disabling ECHO");

boolean echo_flag=1;

while(echo_flag)

Serial.println("ATE0");

while(Serial.available()>0)

if(Serial.find("OK"))

echo_flag=0;

delay(1000);

lcd.clear();

lcd.print("Echo OFF");

delay(1000);

lcd.clear();

lcd.print("Finding Network..");

boolean net_flag=1;

while(net_flag)

Serial.println("AT+CPIN?");

while(Serial.available()>0)

if(Serial.find("+CPIN: READY"))

net_flag=0;

delay(1000);

lcd.clear();
lcd.print("Network Found..");

delay(1000);

lcd.clear();

void init_sms()

Serial.println("AT+CMGF=1");

delay(400);

Serial.println("AT+CMGS=\"+917089058281\""); // use your 10 digit c

delay(400);

void send_data(String message)

Serial.println(message);

delay(200);

void send_sms()

Serial.write(26);

void lcd_status()

{ lcd.clear();

lcd.print("Message Sending");

delay(2000);

lcd.clear();

lcd.print("Message Sent");

delay(2000);

lcd.clear();
// lcd.print("System Ready");

return;

void GATEOPEN()

init_sms();

send_data("RAIWAY CROSSING GATE ALERT:-");

send_data("GATE IS SUCCESFULLY OPEN");

send_data(" THANKU ");

send_sms();

delay(3000);

lcd_status();

void GATECLOSE()

init_sms();

send_data("RAIWAY CROSSING GATE ALERT:-");

send_data("GATE IS SUCCESFULLY CLOSED");

send_data(" THANKU ");

send_sms();

delay(3000);

lcd_status();

}
/*void PUMPON()

init_sms();

send_data("AUTOMATIC PUMP STARTER ALERT-");

send_data("YOUR PUMP IS SUCCESFULLY ON");

send_data(" THANKU ");

send_sms();

delay(3000);

init_smsa();

send_data("AUTOMATIC PUMP STARTER ALERT-");

send_data("YOUR PUMP IS SUCCESFULLY ON");

send_data(" THANKU ");

send_sms();

delay(3000);

lcd_status();

void PUMPOFF()

init_sms();

send_data("AUTOMATIC PUMP STARTER ALERT-");

send_data("YOUR PUMP IS OFF DUE TO TANK FULL");

send_data("THANKU ");

send_sms();

delay(3000);
init_smsa();

send_data("AUTOMATIC PUMP STARTER ALERT");

send_data("YOUR PUMP IS OFF DUE TO TANK FULL");

send_data("THANKU ");

send_sms();

delay(3000);

lcd_status();

void VOLTAGE()

{ init_sms();

send_data("AUTOMATIC PUMP STARTER ALERT-");

send_data("YOUR PUMP IS OFF DUE TO VOLTAGE PROBLME");

send_data("PLEASE TAKE SOME ACTION, THANKU ");

send_sms();

delay(3000);

init_smsa();

send_data("AUTOMATIC PUMP STARTER ALERT");

send_data("YOUR PUMP IS OFF DUE TO VOLTAGE PROBLME");

send_data("PLEASE TAKE SOME ACTION, THANKU ");

send_sms();

delay(3000);

lcd_status();

}*/

You might also like