Government of Karnataka
Department of Collegiate and Technical Education
(20EC53I)
Developed by
Naveen Kumar S , M.Tech
Lecturer in Govt. Polytechnic Mulabagal
Kolar , Karnataka-563127
Guidelines to the reader
1. All the PLC programs and Arduino sketches are personally executed on the
hardware and then the Manual is prepared.
2. I have tried to link some of the experiment with Automation and Robotics
theory Concepts so that it may be helpful for the students to prepare for the
theory exam as well.
3. The video links are added to some of the Experiments such as VFD ,
SCADA and HMI to showcase their working.
4. The IR sensor module and 5V relay used in arduino experiments are active
LOW.
5. Other sensor like Vibration Sensor, Sound sensor , Metal sensors are Active
HIGH sensors.
6. We have used delta PLC DVP14SS2 which has 8 digital inputs and 6 digital
outputs.
7. VFD used here is Delta VFD which can operate the 3-Phase induction Motor
in four different speeds in both the directions.
8. The software used
PLC – WPLsoft
SCADA – DIAView Development
HMI - DOPsoft
9. At the end I have shown how to develop PLC trainer kit of our Own.
Acknowledgment:
The students of our college Darshan C , Pavan Kumar R (2023 passed -
out) and Pavan K L (2024 Pass-out ) have built some of the
circuits/diagrams used in the manual. I felt it would be appropriate to
mention their names here and thanking them.
Contents
EXP. Page
Content
No. No.
1 Build a circuit for sensing any object using proximity sensor and indicating 1
with LED
2 Build a circuit on proximity sensor and verify its working. 2
3 Build a circuit using Arduino and different sensors for each given application
and verify its working.
3A Develop Parked car accident alarm system using vibration sensor. 3
3B Develop home automation system to automatically turn the lamp ON and 5
OFF by detecting whistle/clap instead of using mechanical switch.
3C Develop an automation system that is used to count the number of metals 7
passed through the conveyor belt.
3D Develop an automated obstacle detector using IR sensor. 8
3E1 Develop an object detecting System using ultrasonic sensor and Arduino. 10
3E2 To develop automated Car reverse parking assistance system using 12
Ultrasonic sensor.
4 Build a circuit to Control manually operated motor using contactor and Relay 14
5 Conduct the DOL Starter , Staircase Application and Water Level Controller
using any one of Textual language and Graphical Form of PLC
5.1.A DOL starter and recording its output using Graphical Form(Ladder) of PLC 15
5.1.B. DOL starter and record its output using Arduino sketch. (Textual language). 17
5.2.A. Stair case light application using Graphical Form(Ladder) of PLC 18
5.2..B Stair case light application using Arduino textual Language 20
5.3.A Water level controller application using Graphical Form(Ladder) of PLC 22
5.3.B Water level controller application using Arduino sketch. (Textual language). 23
6 VFD programming using PLC
Specifications of DELTA VFD (Model- VFD004EL21W-1) 25
6A Switch the Motor ON and OFF through VFD. 26
6B Speed control of induction Motor using VFD 27
6C Controlling the direction of induction motor using VFD. 29
7 Perform networking experiment to provide wired and wireless (IP address
and configuration) LAN connection.
7A wired LAN connection 32
7B wireless LAN connection 33
8 Crimping practice of CAT5 cables 35
9 Counter to count the object detected on the conveyor at the packaging 37
department
10 Interface SCADA, HMI integration in any automation industry using any
simulation software.
10A Automation of Water level controller using PLC and SCADA 39
Simluation of SCADA for water level controller. 41
10B HMI integration in packaging automation industry to count the Metal parts 44
on the conveyor
11 A parking plot has a certain capacity of cars/two wheelers. Number of
empty spots should be displayed on the display outside the Parking Plot and
the spots available is to be indicated by LEDs.
11A Using Serial Monitor to display the Empty Slots on the Monitor. 47
11B Using LCD display to display the Empty slots available. 49
12 Display the number of students in a classroom at any time of the day 51
13 Develop an Arduino based system such that the lights and fans should 53
switch OFF if no one is present in the room.
14 Switch ON the street light during dark and automatically switch OFF during 55
the Day time using Arduino.
15 Automated Guided Vehicles
15A Obstacle Avoiding Robot 56
15B Human Following Robot 59
15C Line Follower Robot 61
Programming a Robot to trace different paths.
Procedure for Programming the Robot using Program pendent. 63
16 Program a Robot to trace Rectangular Path. 64
17 Program a Robot to trace Square Path. 65
18 Program a Robot to trace Triangular Path 65
19 Program a Robot to trace Circular Path. 66
20 Program a Robot to trace Conical Path. 66
21 Build a MAZE solving ROBOT in Real environment 67
22 How to develop PLC Trainer kit yourself1!!!!!!!! 73
Automation and Robotics-20EC53I 2023
Experiment 1:
Build a circuit for sensing any object using proximity sensor and indicating with LED
Aim: Practise Build a circuit for sensing any object using Proximity sensor and indicating
with LED
Components Required :
• Comparator IC : LM358 • IR LED • Photo Diode • Resistors 330 Ohms -2No.s, 10K
ohm,10K POT • LED
Circuit Diagram:
Procedure:
1. Vary the 10 K pot to keep the voltage at Pin 2 (of comparator) below 2 Volts.
2. When IR rays falls on the photo diode (after reflection from the obstacle) the photo
diode conducts. And this keeps the voltage at Pin 3 of comparator above 3 V.
Since voltage at Pin3 is greater than the voltage at pin 2, the comparator output is
equal to 5 V, letting LED ON.
3. When there is no obstacle, no current flows through the photo diode. And the voltage
across Pin 2 is greater than the voltage at pin No.3. The comparator output is 0V
keeping the LED OFF.
Conclusion: When the obstacle is placed above the IR LED and Photo diode, the LED will
be ON.
Naveen Kumar S , GPT Mulabagal - 156 Page 1
Automation and Robotics-20EC53I 2023
Experiment 2:
Build a circuit on proximity sensor/color sensor/sound sensor/temperature sensor(rtd
type, capacitive type ,resistive type) and verify its working.
Aim: To test the working of temperature sensor 10KΩ NTC.
Components Required: RPS, 10KΩ NTC, 1KΩ resistor, BC107 (NPN transistor), LED.
Theory:A temperature sensor is a device used to measure temperature. It senses variation in
temperature and produces corresponding electrical signal (voltage/resistance). An NTC is a
thermistor whose resistance decreases with increase in temperature and hence the name
Negative Temperature coefficient.
Graph of resistance verses temperature.
Symbol of NTC
Circuit diagram
Naveen Kumar S , GPT Mulabagal - 156 Page 2
Automation and Robotics-20EC53I 2023
Working of Circuit Diagram.
Here the transistor is working as a Switch. When the transistor is off, the circuit is simply a
series resistance circuit as shown below.
When the temperature is low, the NTC will have higher resistance. Now the larger amount of
supply voltage comes across the NTC. Only least amount (<0.6) comes across 1K resistor
(and also across Base-Emitter of the transistor). Hence the transistor is OFF.
As the temperature increases, NTC resistance decreases. It lets more voltage drops across the
Base-Emitter. When the voltage across the Base-Emitter becomes greater than 0.6V, the
transistor turns ON. Thus allowing the supply voltage to come across the LED which turns on
the LED.
Procedure
1. Make connections as per the circuit diagram.
2. At room temperature the NTC resistance is high. Transistor Turns ON. The LED is
OFF.
3. Bring the heated Solder gun near the NTC thermistor. NTC resistance reduces.
Transistor Turns ON and Hence the LED.
Result:
The working of thermistor is tested.
Naveen Kumar S , GPT Mulabagal - 156 Page 3
Automation and Robotics-20EC53I 2023
Experiment 3:
Build a circuit using Arduino and different sensors for each given
application and verify its working.
Procedure for downloading sketch to Arduino (Atmega 328 microcontroller):
1. Make the connection as per circuit diagram.
2. Type the sketch in IDE.
3. Compile. If on errors download the sketch to Arduino.
3.A. Develop Parked car accident alarm system using vibration sensor.
Introduction to vibration sensor:
A Vibration sensor is device that measures the amount and frequency of vibration in
given system.
Those measurements can be used to detect imbalance or another issues in the assent
and predict future breakdowns.
A Vibration sensor designed for monitoring applications used to fans, gearboxes and
compressors in the oil and gas industry.
The sensitivity of these sensors normally ranges from 10 mV/g to 100 mV/g, and
there are lower and higher sensitivities are also accessible.
AIM:To develop Parked car accident alarm system using vibration sensor.
Circuit diagram:
Note: Arduino program is called a sketch.
Testing:Our car may be hit in the parked place. The automated system will alert us in such
cases if we are nearby. The system can be upgraded by adding GPRS module to alert us
through the mobile when our car is hit. To test its working
Shake the part of the board where the vibration sensor is placed. The Buzzer sounds
for 10 seconds.
If there is no vibration, the buzzer will be always OFF.
Result:The Parked car accident alarm system using vibrator sensor is developed.
Naveen Kumar S , GPT Mulabagal - 156 Page 4
Automation and Robotics-20EC53I 2023
Arduino sketch for Parked vehicle accident alarm system.
int VIB_CHECK=8;
int BUZZER=9;
int HIT;
voidsetup(){ // keep the statement that should be executed only once in the setup function
pinMode(VIB_CHECK,INPUT);
pinMode(BUZZER,OUTPUT);
}
voidloop(){ // keep the statement that should be executed forever in the loop function
HIT=digitalRead(VIB_CHECK);
if(HIT==1) /* IF THE CAR IS HIT, MAKE SIREN FOR 10 SEC*/
{
digitalWrite(BUZZER,HIGH);
delay(10000);
}
else
digitalWrite(BUZZER,LOW);
}
3.B.Develop home automation system to automatically turn the lamp ON and OFF by
detecting whistle/clap instead of using mechanical switch.
INTRODUCTION TO SOUND SENSOR:
1. The sound sensor is one type of module used to notice the sound. Generally, this
module is used to detect the intensity of sound.
2. The applications of this module mainly include switch, security, as well
as monitoring.
3. The accuracy of this sensor can be changed for the ease of usage.
4. This sensor employs a microphone to provide input to buffer, peak detector and an
amplifier.
5. This sensor notices a sound, & processes an o/p voltage signal to a microcontroller.
After that, it executes required processing.
Working Principle:
The working principle of this sensor is related to human ears. Because human eye includes a
diaphragm which changes the vibrations into signals. Whereas this sensor uses a microphone
to convert vibrations into current or voltage.
The working video of developed Home automated system:
https://youtu.be/Cy46rUkDL94?si=ZOE70LoOYuevzyW-
Naveen Kumar S , GPT Mulabagal - 156 Page 5
Automation and Robotics-20EC53I 2023
AIM:Develop the home automation system using sound sensor and Arudui Uno.
Components required: Arduino board, Sound sensor module, Led.
Circuit Diagram:
Testing: The Sound sensor based automated system can be used to turn ON and OFF
the lights lying on one’s bed. To test its working
Make the sound(using whistle/clap) near the sound sensor module, the Lamp(Light) changes
its state. That is if it was ON, it turns OFF and vice versa.
Result:The home automation system is developed using sound sensor.
Arduino sketch for home automation system:
int LAMP=13;
intsoundpin=A2;
int threshold=50;
int TEMP=0;
intsoundsens=0;
voidsetup(){
Serial.begin(9600);
pinMode(LAMP,OUTPUT);
pinMode(soundpin,INPUT);
}
voidloop(){
soundsens=analogRead(soundpin);
Serial.println(soundsens);
if(soundsens>threshold)/* Change the state of LAMP upon sound detection*/
{
TEMP=~TEMP;
digitalWrite(LAMP,TEMP);
}
delay(500);
}
Naveen Kumar S , GPT Mulabagal - 156 Page 6
Automation and Robotics-20EC53I 2023
3.C.Develop an automation system that is used to count the number of metals passed
through the conveyor belt.
INTRODUTION OF METAL SENSOR:
A metal touch sensor is a type of switch that only operates when it's touched by a
charged body.
It has a high-frequency transistor which can conduct electricity when receiving
electromagnetic signals.
There are two common types of touch sensors:
* capacitive
* resistive.
Examples in which the touch sensor is used are mobile phones, monitor screens,
control panels.
AIM:To Count the number of metals passed through the conveyor belt using metal
sensor and Arduino Uno.
COMPONENTS REQUIRED:ArduinoUNO, Metal sensor module ,Led.
CIRCUIT DIAGRAM:
Testing
Keep any metal close to metallic sensor, the automated system increments the counter. The
automated also indicates metal detection by LED. The metal count is displayed on the Serial
monitor on the PC.
RESULT:
Arduino sketch for metal detecting sensor:
int TEMP=0;
int count=0;
void setup(){
pinMode(8,INPUT);
pinMode(2,OUTPUT);
Serial.begin(9600);
}
Naveen Kumar S , GPT Mulabagal - 156 Page 7
Automation and Robotics-20EC53I 2023
void loop()
{
TEMP=digitalRead(8);
if(TEMP==1) /* if metal is detected , increase the count */
{
digitalWrite(2,HIGH); /* if metal is detected ,also indicate using LED*/
count=count+1;
}
else digitalWrite(2,LOW);
Serial.print("Total metals detected:");
Serial.println(count);
delay(1000);
}
3.D. Develop an automated obstacle detector using IR sensor.
Interfacing IR sensor
The IR Sensor Module or infrared (IR) sensor is a basic and most popular sensor in
electronics.
It is used in wireless technology like remote controlling functions and detection of
surrounding objects/ obstacles.
IR sensors mainly consist of an Infrared(IR) LED and a Photodiode, this pair is
generally called IR pair.
IR sensor is an electronic device, that emits the light in order to sense some object of
the surroundings.
Aim:ToDevelop an obstacle detector using IR sensor.
CIRCUIT DIAGRAM:
Testing: This system can be used to detect a work piece on the conveyor in an automated
syste.
Bring any object in front of the IR sensor module, the LED gets ON. Otherwise the LED
remains OFF.
RESULT: Developed obstacle detector is verified using IR sensor.
Naveen Kumar S , GPT Mulabagal - 156 Page 8
Automation and Robotics-20EC53I 2023
Arduino sketch for Obstacle detection system using IR sensor.
intIRstate=0;
void setup()
{
Serial.begin(9600);
pinMode(3,INPUT);
pinMode(11,OUTPUT);
intIRstate=0;
}
void loop(){
IRstate=digitalRead(7);
if (IRstate==0)
{
digitalWrite (6,HIGH);
Serial.println("object is detected");
}
else
{
digitalWrite (6,LOW);
Serial.println("object is not detected");
}
delay(1000);
}
Naveen Kumar S , GPT Mulabagal - 156 Page 9
Automation and Robotics-20EC53I 2023
3.E. Develop an automated Obstacle detector using Ultrasonic sensor.
Introduction to ultrasonic Sensor:
An ultrasonic sensor is used to measure the distance to an object by using ultrasonic waves.
It has ultrasonic transmitter and receiver. The transmitter sends the pulse of shorter duration.
The receiver detects if any obstacle is present. The ultrasonic module gives the time duration
for which the pulse travels between transmitter and receiver after reflecting from the object.
Working of Ultrasonic sensor module:
A short duration pulse about 11 microseconds has to be sent to trig pin. When the object is
within its coverage range (about 4 meters) the pulse signal is developed on echo pin. This
pulse ON time (in micro seconds) is proportional to the 2-way distance between the obstacle
and the sensor.
So time for travelling two way =t micro seconds.
We know that S = (d/t). As it is two way distance S=(2d/t) 2d=(S*t)
And speed of sound in air is about 343 metres per second.
Thus
𝑆𝑋𝑡
d= micro meter
2
340𝑋𝑡
d= micro meter
2
0.034𝑋𝑡
d= centi meter
2
3.E.1 .Develop an object detecting System using ultrasonic sensor and Arduino.
Aim: Detect the object using ultrasonic sensor and Arduino.
Components required: Arduino Uno , Ultrasonic sensor module , Buzzer.
Circuit Diagram:
Naveen Kumar S , GPT Mulabagal - 156 Page 10
Automation and Robotics-20EC53I 2023
Testing
Bring any object within 100 cm from the ultrasonic sensor module, the buzzer beeps as long
as the object is within that distance.
The ultrasonic sensor cab be used to detect the presence of work piece on the conveyor in
automated industry.
Result:
The obstacle detector is developed using ultrasonic sensor.
Arduino sketch for obstacle detection using ultrasonic sensor:
inttrigpin=2;
intechopin=3;
long duration;
int distance;
int BUZZER=10;
voidsetup(){
pinMode(trigpin,OUTPUT);
pinMode(echopin,INPUT);
pinMode(BUZZER,OUTPUT);
Serial.begin(9600);
}
voidloop(){
digitalWrite(trigpin,LOW); /*generate a pulse on Trigger pin of ultrasonic sensor module*/
delayMicroseconds(3);
digitalWrite(trigpin,HIGH);
delayMicroseconds(11);
digitalWrite(trigpin,LOW);
duration=pulseIn(echopin,HIGH);
distance=duration*0.034/2;
Serial.print("Distance in Cm:");
Serial.println(distance);
if((distance<=100))
{
digitalWrite(BUZZER,HIGH);
Serial.println("OBJECT IS DETECTED");
}
else
{
digitalWrite(BUZZER,LOW);
Serial.println("OBJECT IS NOT DETECTED");
}
}
Naveen Kumar S , GPT Mulabagal - 156 Page 11
Automation and Robotics-20EC53I 2023
3.E.2. To develop automated Car reverse parking assistance system using Ultrasonic sensor.
Aim:To develop Car reverse parking assistance system using Ultrasonic sensor
Components required: Arduino Uno, Ultrasonic sensor module , Buzzer.
Circuit Diagram:
Testing
1. Bring any object within 50 cm and 200 cm, the buzzer beeps with time gap.
2. Bring the object between 10 and 50 cm, the buzzer beeps with less time gap.
3. Now, bring the object within 10cm , the buzzer beeps continuously .
Result:
The obstacle detector is developed using ultrasonic sensor.
Arduino sketch for car reverse Parking Sensor system:
inttrigpin=2;
intechopin=3;
long duration;
int distance;
int BUZZER=10;
voidsetup(){
pinMode(trigpin,OUTPUT);
pinMode(echopin,INPUT);
pinMode(BUZZER,OUTPUT);
Serial.begin(9600);
}
Naveen Kumar S , GPT Mulabagal - 156 Page 12
Automation and Robotics-20EC53I 2023
voidloop(){
digitalWrite(trigpin,LOW); /*generate a pulse on Trigger pin of ultrasonic sensor module*/
delayMicroseconds(3);
digitalWrite(trigpin,HIGH);
delayMicroseconds(11);
digitalWrite(trigpin,LOW);
duration=pulseIn(echopin,HIGH);
Serial.println(echopin);
Serial.println(duration);
distance=duration*0.034/2;
Serial.print("DISTANCE IN CM");
Serial.println(distance);
if((distance<=10)) /* if the distance is less than 10CM , beep continuouly*/
digitalWrite(BUZZER,HIGH);
elseif((distance>10)&&(distance<=50)) /* if the distance is greater than 10CM and less than 50CM,
beep with little time gap*/
{
digitalWrite(BUZZER,HIGH);
delay(100);
digitalWrite(BUZZER,LOW);
delay(100);
}
elseif((distance>50)&&(distance<=200)) /* if the distance is greater than 50 CM and less
than 200 CM,beep with more time gap*/
{
digitalWrite(BUZZER,HIGH);
delay(500);
digitalWrite(BUZZER,LOW);
delay(500);
}
else
digitalWrite(BUZZER,LOW); /* If the distance is greater than 200CM , donot beep*/
}
Naveen Kumar S , GPT Mulabagal - 156 Page 13
Automation and Robotics-20EC53I 2023
Experiment 4: Build a circuit to Control manually operated motor using contactor and
Relay
Aim: Conduct an experiment to build a circuit to control manually operated motor using
contactor and Relay using software.
Components Required:Proteus software, PC.
Theory :
A contactor is an electromagnetic switch which is designed to make or break the
connection between the electric power supply and the load. A contactor is commonly
used to establish and interrupt electric circuits in high-power applications with amperage
loads of more than 10A. Contactor offer heavy-duty contacts so as to provide safe
switching of power circuits.
Circuit Diagram :
Working:
1. Turn the switch ON. It energises the Relay. This further energises the contactor.
2. Contactor passes the supply to the lamp/pump.
Result :
Naveen Kumar S , GPT Mulabagal - 156 Page 14
Automation and Robotics-20EC53I 2023
Experiment 5: Conduct the following using any one of Textual language and Graphical
Form of PLC
1. DOL starter and record its output
2. Stair case light application
3. Water level controller application
Procedure to download the ladder diagram program to PLC using WPLsoft software.
a. Compile the ladder diagram.
b. Options Communication settings Type – RS232 OK
c. Click on Write to PLC icon.
d. Click on Online Mode to see the status of PLC I/O
5.1.A.DOL starter and recording its output using Graphical Form(Ladder) of PLC
Aim: Develop a PLC based application to turn ON and OFF the motor connected to conveyor
belt in packaging industry using DOL starter.
Theory:
A DOL starter (also known as a direct on line starter or across the line starter) is
a method of starting a 3 phase induction motor.
The DOL starter comprises an MCCB or circuit breaker, contactor and an overload
relay for protection.
Contactor contains three NO (normally open) contacts that connect the motor to
supply lines, and the fourth contact is “hold on contact” (auxiliary contact) which
energizes the contactor coil after the start button is released.
Figure 1: Typical DOL starter
Naveen Kumar S , GPT Mulabagal - 156 Page 15
Automation and Robotics-20EC53I 2023
Circuit Diagram
Working videos
https://youtu.be/Zdd_0bvs3XQ (Introduction to VFD)
https://youtu.be/vp-_EkpNDCo (DOL starter Working )
Circuit Explanation:
The main purpose of DOL is used to start and stop the induction motor.
Here we are implementing the function of DOL starter using PLC.
Since in automation industry, Induction motor is connected through VFD. Hence we
have connected the motor to VFD.
Two push buttons START and STOP are connected to X0 and X1 Input pins of PLC.
The output Y0 from PLC is connected to microcontroller side of a relay. The
switching side of the relay is connected to VFD.
The control panel of VFD is shown in the figure.
Sending HIGH(24V) to MI1 of VFD makes the VFD ON and hence the motor.
Sending LOW (0V) to MI1 of VFD makes VFD OFF and hence the motor.
This is achieved using a Relay.
Naveen Kumar S , GPT Mulabagal - 156 Page 16
Automation and Robotics-20EC53I 2023
Ladder Diagram:
Working:
1. Press the start button. Energised relay turns the Motor ON.
2. As the motor turn ON, the status of the motor is held in holding switch. Thus, even if
the START switch is OFF, the MOTOR remains ON.
3. At any time, pressing the STOP button will turn OFF the MOTOR.
Result:
5.1.B. DOL starter and record its output using Arduino sketch. (Textual language).
Aim: To test working of DOL starter using Arduino board.
Components Required: Arduino Uno, push button switches, LED , resistors .
Circuit Diagram:
Testing:
I. Press STARTbutton, the LED glows.
II. Observe that LED glows even after the START Button is released. This is called
direct online starter(DOL).
III. Press the STOPbutton, LED goes OFF.
Naveen Kumar S , GPT Mulabagal - 156 Page 17
Automation and Robotics-20EC53I 2023
Sketch for DOL starter:
int START=4; /*Start switch*/
int STOP=5; /*Stop switch*/
int MOTOR=6; /*Motor or Lamp*/
int LATCH=0; /* Start/Stop switch Latch*/
int TEMP1=0; /*TEMP1 & TEMP2: variable to hold the status of the switches*/
int TEMP2=10;
voidsetup(){
pinMode(START,INPUT);
pinMode(STOP,INPUT);
pinMode(MOTOR,OUTPUT);
}
voidloop()
{
TEMP1=digitalRead(START);
TEMP2=digitalRead(STOP);
if(TEMP1==1) /* CHECK IF THE START SWITCH IS PRESSED*/
LATCH =1;
if(TEMP2==1) /* CHECK IF THE START SWITCH IS PRESSED*/
LATCH =0;
digitalWrite(MOTOR,LATCH);
}
Result:
5.2. Stair case light application
5.2.A Stair case light application using Graphical Form(Ladder) of PLC.
Working and Procedure:
The staircase light should come ON if any one of the two switches is operated.
If anyone switch is operated again the light should go OFF.
Switch SW1 is on the lower floor of the staircase and switch SW2 is installed at the
upper floor of the staircase to control a light.
Consider the ladder diagram, initially assume the both SW1 and SW2 are open
therefore both the paths are open and the light is OFF. If the SW1 is ON & SW2 is in
OFF state then the upper circuit will switch ON the light. If SW2 is ON & SW1 is in
OFF state then the lower circuit will switch ON the light. However, if both SW1
Naveen Kumar S , GPT Mulabagal - 156 Page 18
Automation and Robotics-20EC53I 2023
&SW2 are ON, both the paths are open and the light is OFF. These four conditions
are shown in tabular column.
Circuit Diagram:
Two sliding switches are connected to the X3 and X4 input of PLC.
Y0 of PLC is connected to input V+ of a relay.
The Phase from the AC supply is connected to COM of relay.
The normally OPEN of the relay is connected to the bulb.
Neutral is connected directly to the bulb.
Ladder Diagram:
Ladder diagram working.
If any switch is operated, it will inverse the output Y0 and hence the bulb state (ON and OFF).
Result:
Naveen Kumar S , GPT Mulabagal - 156 Page 19
Automation and Robotics-20EC53I 2023
5.2.B.Stair case light application using Arduino textual Language:
Testing:
1. Initially the Lamp is OFF.
2. Press hold the SWITCH 1 , the lamp turns ON. ( While going upstairs).
3. Now hold the SWITCH 2 , the Lamp turns OFF.
4. Release the SWITCH 1 , the Lamp turns ON. (while coming downstairs)
5. Release the SWITCH 2, the Lamp turns OFF .
Sketch for staircase application:
int SWITCH1=4; /* Lower floor switch */
int SWITCH2=5; /* Upper floor switch */
int LAMP=6; /* Stair case Lamp*/
int TEMP1=0;
int TEMP2=0;
int TEMP3=0;
voidsetup()
{
pinMode(SWITCH1,INPUT);
pinMode(SWITCH2,INPUT);
pinMode(LAMP,OUTPUT);
}
voidloop()
{
TEMP1=digitalRead(SWITCH1);
TEMP2=digitalRead(SWITCH2);
TEMP3= (TEMP1 ^ TEMP2);
digitalWrite(LAMP,TEMP3);
}
Naveen Kumar S , GPT Mulabagal - 156 Page 20
Automation and Robotics-20EC53I 2023
5.3. Water level controller
Aim: With the help of sensors and actuators, build water level controller.
General set-up
Working/Algorithm.
1. Donot turn of the motor is there is no water in the sump.
2. If there is water in the sump,
i. Check if the water is below the Lower_sensor.
ii. If yes , turn on the MOTOR until it reaches the Upper_sensor.
iii. If No, donot turn on the motor.
3. Go to step 1
Naveen Kumar S , GPT Mulabagal - 156 Page 21
Automation and Robotics-20EC53I 2023
6.2.A. Water level controller application using Graphical Form(Ladder) of PLC
Circuit Diagram:
Circuit Explanation:
1. Push buttons START and STOP are connected to the X0 and X1 of the PLC. These buttons gives
manual control over the automated system.
2. Two sensors are placed in the tank: Tank Low Level sensor (TLLS) , Tank High Level Sensor
(THLS). These are connected to X2 and X3 of PLC respectively.
3. A level sensor (LS ) is placed in the sump : Sump Level sensor. This is connected to X4 of PLC.
4. The output Y0 from the PLC is connected to the 24 V relay (Actuators).
Ladder Diagram:
Naveen Kumar S , GPT Mulabagal - 156 Page 22
Automation and Robotics-20EC53I 2023
Procedure:
1. X0 and X1 Push buttons are used for Manual control. Pressing X0 will enable the
automated water level controller to work. When the X1 is pressed, the automated
system goes OFF.
2. When the automated system is ON, the PLC start reading the sensors and
accordingly Turns ON/OFF the Motor.
3. If Sump Level sensor is OFF (no water in the sump), MOTOR donot turn ON.
4. If Sump Level sensor is ON, it checks lower and upper Level Sensor
If both the sensors are OFF (No water in the tank), MOTOR turns ON until both the
Sensor turns ON (tank is full).
5.3.B. Water level controller application using Arduino sketch. (Textual language).
Procedure:
1. Here the working of sensors is indicated using Switches.
2. Sump sensor is always connected to VCC indicating sump always has water.
3. Initially Motor turns ON as both Upper and Lower sensor are OFF (tank has no
water).
4. Press the Lower switch indicating the water filled just above the Lower sensor. Still
Motor is ON.
5. Press both Lower and Upper Switches indicating that the water has reached above
the Upper sensor. Now the Motor turns OFF. Motor will be in OFF state until both
switches are OFF again.
Result:
Naveen Kumar S , GPT Mulabagal - 156 Page 23
Automation and Robotics-20EC53I 2023
Arduino Sketch for water level controller:
intSumpsensor=3; /* sump water level sensor */
int Lower_sensor1=4; /* Tank water Low level sensor */
int Upper_sensor2=5; /*Tank water upper level sensor 8*/
intMotor_relay=6;
intSump_status=0;
intLS_status=1;
intHS_status=1;
intmotorstatus=0;
voidsetup(){
pinMode(Sumpsensor,INPUT);
pinMode(Lower_sensor1,INPUT);
pinMode(Upper_sensor2,INPUT);
pinMode(Motor_relay,OUTPUT);
Serial.begin(9600);
voidloop(){
Sump_status=digitalRead(Sumpsensor);
LS_status =digitalRead(Lower_sensor1);
HS_status =digitalRead(Upper_sensor2);
if(Sump_status ==1) /* if the sump has water , check the tank sensors*/
if((LS_status ==0)&&(HS_status ==0)) /* Turn ON motor when tank fills*/
{
digitalWrite(Motor_relay,HIGH);
motorstatus=1;
Serial.println("MOTOR IS ON");
}
if(motorstatus==1)
if((LS_status ==1)&&(HS_status ==1)) /* Turn OFF motor when tank fills*/
{
digitalWrite(Motor_relay,LOW);
motorstatus=0;
Serial.println("Motor is off");
}
delay(1000);
}
Naveen Kumar S , GPT Mulabagal - 156 Page 24
Automation and Robotics-20EC53I 2023
Experiment 6: VFD programming using PLC for switching ON/OFF and speed control of
Induction motor.
Specifications of DELTA VFD (Model- VFD004EL21W-1)that is used in our Experiments
1. Control System: SPWM (Sinusoidal Pulse Width Modulation) control (V/F control)
2. Frequency Setting Resolution:0.01 Hz
3. Output Frequency Resolution:0.01 Hz
4. Interface: RS-485 serial interface (Modbus).
5. Input Voltage: 230 V (1 phase)
6. Applicable Moto capacity: 0.25 HP to 0.5 HP
7. Input Frequency – 50 Hz/ 60 Hz
8. Temperature:(14–122°F)
The VFD control panel has Multi-function input signals (MI). By setting these inputs and applying
logic High signal, the VFD can rotate the Motor in different directions and speeds.
The combinations for speed and direction control are given in the table.
MI1(FWD) MI2(RVRS) MI3 MI4 Direction and Speed
1 0 0 0 Forward , Default speed 30 Hz.
1 0 1 0 Forward , Speed 2
1 0 0 1 Forward , Speed 3
1 0 1 1 Forward , Speed 4
0 1 0 0 Reverse , , Default speed 30 Hz.
0 1 1 0 Reverse , Speed 2
0 1 0 1 Reverse , Speed 3
0 1 1 1 Reverse , Speed 4
How VFD works? Go through the videos.
https://youtu.be/Zdd_0bvs3XQIntroduction to VFD and turning it ON and
OFF.
https://youtu.be/T1M84woCjyEHow to control speed of the induction Motor
using VFD.
Naveen Kumar S , GPT Mulabagal - 156 Page 25
Automation and Robotics-20EC53I 2023
a) Switch the Motor ON and OFF through VFD.
Aim: To control turning ON and OFF of the Motor though VFD in pharmaceutical
manufacturing industry.
Apparatus required: Personal computer with using the plc software, VFD, Induction
Motor, 24V relay
CircuitDiagram:
PROCEDURE:
i. Draw the ladder diagram corresponding to control the three phase motor with PLC &
VFD.
ii. Enter the ladder diagram.
iii. Download the program and test.
Ladder diagram:
Naveen Kumar S , GPT Mulabagal - 156 Page 26
Automation and Robotics-20EC53I 2023
Testing:
a. Press the Start Push Button. It turns ON the motor.
b. Press the Stop push button. It turns of OFF the motor.
The video shows the connections and working
https://youtu.be/vp-_EkpNDCo- How to Switch MOTOR ON and OFF through
VFD
Result:
b) Speed control of induction Motor using VFD.
Aim : How would you choose to change the filling of kissan Jam from Glass containers to
sachet on the same production lines. Explain the role of VFD in the production line.
Explaination:
Consider a production line where we produce 1litre kissan glass container and 100 ml
sachets. We know that the conveyor carrying these containers or sachets has to move in two
different speeds:
When it carries sachet it has to move faster as filling of sachets takes less time. On the other
hand, conveyor belt has to move slower when it carries containers as it takes more time to fill
the containers.
The two different speeds on the same production line can be achieved using VFD. The
induction motor of the conveyor is connected through the VFD.
We know that VFD can be programmed to operate the motor connected to it in different
speeds.
Just by sending controls to it multi-purpose inputs, we can control the speeds. The table
shows the combination of multi-purpose inputs for different speedsin a Delta-makeVFD.
MI1(FWD) MI2(RVRS) MI3 MI4 Direction and Speed
1 0 0 0 Forward , Default speed 30 Hz.
1 0 1 0 Forward , Speed 2
1 0 0 1 Forward , Speed 3
1 0 1 1 Forward , Speed 4
0 1 0 0 Reverse , , Default speed 30 Hz.
0 1 1 0 Reverse , Speed 2
0 1 0 1 Reverse , Speed 3
0 1 1 1 Reverse , Speed 4
Naveen Kumar S , GPT Mulabagal - 156 Page 27
Automation and Robotics-20EC53I 2023
Circuit Diagram
Testing:
a) Pressing PB Start, turns ON the VFD.
Multi-purpose input combinations will become MI1-ON, MI3-ON.
Hence the VFD rotates the motor at speed 1.
b) Now press X2, MI1-ON, MI4-ON. Thus the VFD rotates the motor at speed 2.
c) Now press X3, MI1-ON, MI3-ON. Thus the VFD rotates the motor at speed 1.
d) Thus speeds can be controlled by pressing X2 and X3 anytime.
e) Thus flexible automation (for producing product varieties) can be made possible using
VFD.
f) PressingPB Stop X1 anytime turns OFF the VFD and hence the Motor.
The working video:
https://youtu.be/-n0fkDrUyh0?si=4DAsXzC1Y9kW24QT
Naveen Kumar S , GPT Mulabagal - 156 Page 28
Automation and Robotics-20EC53I 2023
Ladder Diagram:
Result:
c) To change the direction of induction motor using VFD.
Aim: To control the direction of Induction motor through VFD connected to a conveyor belt
in component production industry.
Circuit Diagram
Naveen Kumar S , GPT Mulabagal - 156 Page 29
Automation and Robotics-20EC53I 2023
Ladder diagram:
Testing:
a. Press the Forward Push Button. Now Multi-Purpose Input MI1 =1,it turns motor in
Anti-clock direction.
b. Press the Reverse push button. Now Multi-Purpose Input MI2 =1,it turns the motor in
Clock direction.
Video demonstrates its working.
https://youtu.be/cmXU5GmYkUU- PLC programming to control the
Direction of Induction motor using VFD.
Result:
Naveen Kumar S , GPT Mulabagal - 156 Page 30
Automation and Robotics-20EC53I 2023
Experiment 7: Perform networking experiment to provide wired and wireless (IP address and
configuration) LAN connection.
7.A. wired LAN connection
I. Aim: To set-up wired LAN connection.
Components Required:
PC, Router, LAN cable.
Procedure
1. Connect Modem/Router to the computer through the LAN cable.
2. The Router automatically assigns an LAN IP address to the computer. We can see the assigned
LAN IP address:
i. Go to control panelNetwork and Internet Network and sharing center.
ii. Click on the Change Adapter settings.
iii. Right click on Ethernet and click on status.
iv. Click on Details. The window appears as below.
The IP inside the Orange color box is the LAN IP assigned by the Router to the Computer.
The IP inside the Green color is the Router IP used for configuring it.
3. However, if LAN IP is not assigned , the user need to give it manually:
i. Go to control panelNetwork and Internet Network and sharing center.
ii. Click on the Change Adapter settings.
iii. Right click on Ethernet and click on Properties.
iv. Double click on Internet Protocol version 4 (TCP/IPV4). The window is shown below.
Naveen Kumar S , GPT Mulabagal - 156 Page 31
Automation and Robotics-20EC53I 2023
v. Select Use the following IP address. Enter the given fields:
Every Modem/router will have a default gateway IP address. It is usually printed on the
backside of the Router.
This IP has to be entered in the fields: Default gateway, Preferred DNS server. For the
router shown here, the default gateway IP is 192.168.1.1.
vi. We can connect upto 254 devices to the same router. So the LAN IP addresses are from
192.168.1.2 to 192.168.1.255. So we can assign any address within this range.
I have assigned a static IP 192.168.1.2 to my Computer here:
Naveen Kumar S , GPT Mulabagal - 156 Page 32
Automation and Robotics-20EC53I 2023
vii. After entering the fields , click OK.
Result:
7.B. wireless LAN connection.
Aim: To set-up wireless LAN connection.
Components required:
Wi-fi router, wi-fi adapter, LAN cable , PC.
Theory:Wi-fi stands for wireless fidility. It allows computers, smartphones, or other devices
to connect to the internet wirelessly within a particular area. Its range is approximately 30
meters.
Procedure to setup wifi Router:
1. Connect the Wi-fi router to the computer using LAN cable.
2. Open the any internet browser and type the router IP address 192.168.1.1.
Naveen Kumar S , GPT Mulabagal - 156 Page 33
Automation and Robotics-20EC53I 2023
3. Enter username and Passwords. These credentials are provided along with the Router. These are
found at the backside of the Router.
For the TP-link Router I have used: The username: admin, password: admin.
Now router configuration page opens.
4. Go to Interface setupWireless:
5. Give SSID name.
6. Select security type and enter security code.
Naveen Kumar S , GPT Mulabagal - 156 Page 34
Automation and Robotics-20EC53I 2023
Procedure to install wi-fi adapter:
1. Plug-in the wifi adapter to the PC.
2. Install the software driver for the adapter.
3. Search for available wireless Networks.
4. Select your SSID and enter password. Now we should be able to access the internet
through the router.
Result:
Experiment 8:Crimping practice of CAT5 cables
Aim: To crimp CAT5 cable and test with LAN cable tester.
1. Cut the Cat5e patch cable to the required length.
2. Use the stripper tool to strip about 2.5cm of the jacket at the two ends of Rj45 Cat5e
cable.
3. Separate four twisted pairs of wires.
4. Arrange 8 wires in the sequence given below.
5. Keep the wires aligned and cut them off so that they can line up evenly with the top of
the RJ45 connector.
6. Plug the wires into the RJ45 connector and crimp using Crimping tool.
7. Repeat step one to step six on the other end of the Cat5e patch cable: The other end
decides whether it is straight through or Cross-over cable .
There are two kinds of Ethernet cables that can be made:
a. straight through and
b. crossover.
Naveen Kumar S , GPT Mulabagal - 156 Page 35
Automation and Robotics-20EC53I 2023
For the straight through type, just use the same wiring standards on both ends of the cable.
It’s often called “patch cable”, designed for almost all purposes like connecting the
computers to routers. For a crossover type, use T568A on one end and T568B on the other
end.
The purpose of this cable type is to connect one computer to another without using a router,
switch or hub.
The wiring sequence for two sides of Straight through and cross over cable:
8. Use a cable tester to test the crimped Cat5e cable for its working.
Result:
Reference: RJ45 Cat5e cable, How to Crimp It? (fiberopticshare.com)
RJ45 Color Coding: Types of Ethernet Cable | Its IT Experience
Naveen Kumar S , GPT Mulabagal - 156 Page 36
Automation and Robotics-20EC53I 2023
Experiment 9:Implement/Simulate a Counter to count the object detected on the
conveyor at the packaging department with Metal Detector Sensor and PLC.
Aim: Develop an automated metal counting system to count metals passing through the
conveyor.
Components required: Delta PLC DVP-14SS2, Metal detector,Conveyor, Motor Driver.
Circuit Diagram:
A. Start Push Button is connected to X0.
B. Stop Push Button is connected to X1.
C. Metal detector is connected to X3.
D. The output Y0 is connected to DC motor of conveyor belt through DC motor driver.
E. The metals counted can be seen in the PLC software in counter C0.
Naveen Kumar S , GPT Mulabagal - 156 Page 37
Automation and Robotics-20EC53I 2023
Ladder Diagram:
Working.
Pressing X0 will turn ON the conveyor.
The metals count is done using Counter C0.
When counter value becomes 4 (Maximum), Timer 0 starts.
When timer value reaches 100 (10 Seconds) , output of timer becomes ON. Now this
resets the counter. Now counter is ready to count the metals again.
Pressing X1 stops the automation process.
Keep the ONLINE mode in software to see the metals counted .Observe the counter
C0.
Result:
Naveen Kumar S , GPT Mulabagal - 156 Page 38
Automation and Robotics-20EC53I 2023
Experiment 10:Interface SCADA, HMI integration in any automation industry using any
simulation software.
A. Automation of Water level controller using PLC and SCADA
Aim: To automate water level controller using PLC and SCADA
Theory:
Circuit Diagram
Start and Stop Push buttons are connected to the X0 and X1 of the PLC.
Output Y0 is connected to the Relay to control tuning ON and OFF of the Sump_motor
placed in the sump.
Ladder Diagram:
Naveen Kumar S , GPT Mulabagal - 156 Page 39
Automation and Robotics-20EC53I 2023
M0 and M1 memories are required to implement Start and Stop actions from the
SCADA.
Procedure :
1. Connect Modbus (Serial) cable between PLC and PC.
2. Develop PLC Ladder diagram and download it to the PLC.
3. Develop the SCADA screen and Run.
Note: The communication between PC and PLC uses RS-232 Protocol whereas
communication between SCADA and PLC uses Modbus Protocol.
https://youtu.be/u8-6sq9jTik PLC and SCADA Interfacing, SCADA Screen Development.(if
you have Delta PLC Hardware)
Figure 2:SCADA Screen developed for Water level Controller
https://youtu.be/cb6VOTinKPQ working of the Water Level Controller using SCADA.
https://youtu.be/HpKf1Kj-tU8 What is SCADA and its working for water level application.
Naveen Kumar S , GPT Mulabagal - 156 Page 40
Automation and Robotics-20EC53I 2023
Script for Animation of Tank and Sump according to the sensors data.
All other sensor data and motor status is directly read from the real hardware by SCADA.
Sub ConditionScript_DataChangedOrTimeout()
if((Var.TLLS=False) and (Var.THLS=False)) Then
Var.Tank=20
ElseIf((Var.TLLS=True) and (Var.THLS=False)) Then
Var.Tank=50
Else Var.Tank=100
End if
if (Var.SLS=True)Then
Var.Sump=100
else Var.Sump=20
End if
End Sub
Result:
Simluation of SCADA for water level controller.
We can simulate the automation process even if we do not have PLC and related hardware.
Here is the Link to develop the SCADA screen for simulation.
https://youtu.be/GLWgeYsgfPg Simulation of SCADA, SCADA Screen Development. (If you
have NO Delta PLC Hardware)
The Simulation results are explained below.
No Water in the Tank. So Tank LLS and HLS are RED. When we press start button ,the
controller reads the status of Tank LLS and HLS and lets Sump Motor turn ON.
Naveen Kumar S , GPT Mulabagal - 156 Page 41
Automation and Robotics-20EC53I 2023
Water is above the TLLS , S Tank LLS is Green(ON).
SumpMotor Indicator is Green indicating that the Sump Motor is ON.
When the tank becomes full , it is indicated by Tank LLS and HLS with Green. And the Motor
turns OFF. Shown by Red indication in SUMP Motor Indicator.
Naveen Kumar S , GPT Mulabagal - 156 Page 42
Automation and Robotics-20EC53I 2023
We need to write script for simulation.
Follow the steps shown in the video and use the following script.
Sub ConditionScript_DataChangedOrTimeout()
If(Var.Start=True) Then
Var.Latch1=True
End if
if(Var.Stop=True) Then
Var.Latch1=False
End if
If(Var.Latch1=True) Then
if((Var.TLLS=False) and (Var.THLS=False)) Then
Var.Latch2=True
End if
if(Var.THLS=True) Then
Var.Latch2=False
End if
If(Var.Latch2=True) Then
Var.Sump_Pump=True
Var.Tank=Var.Tank+1
Else Var.Sump_Pump=False
End if
if(Var.Tank<200) Then
Var.TLLS=False
Var.THLS=False
ElseIf(Var.Tank>=200) And (Var.Tank<=950) Then
Var.TLLS=True
Var.THLS=False
ElseIf(Var.Tank>950) Then
Var.TLLS=True
Var.THLS=True
End if
ElseIf(Var.Latch1=False) Then
Var.Sump_Pump=False
End if
if(Var.Tank>150)Then
If(Var.Tank_tap=True)Then
Var.Tank=Var.Tank-1
End if
End if
End Sub
Naveen Kumar S , GPT Mulabagal - 156 Page 43
Automation and Robotics-20EC53I 2023
10 B. Automated metal counting system to count the metals detected on the conveyor
at the packaging department using PLCand HMI.
Aim: To develop an automated metal counter to count the metals passed through the
conveyor.
Components used: Delta PLC DVP14SS2 ,Delta HMI , Driver module to drive 12V DC
motor in the conveyor .
Theory:
Circuit Diagram:
Start Push Button is connected to X0.
Stop Push Button is connected to X1.
Metal detector is connected to X3.
The output Y0 is connected to DC motor of conveyor belt through DC motor driver.
The HMI and PLC are interfaced using RS-485 cable.
The Ladder diagram is downloaded onto PLC using RS-232 serial cable.
Naveen Kumar S , GPT Mulabagal - 156 Page 44
Automation and Robotics-20EC53I 2023
Ladder Diagram
Working .
Pressing X0 will turn ON the conveyor.
The metals count is done using Counter C0.
When counter value becomes 4 (Maximum), Timer 0 starts.
When timer value reaches 100 (10 Seconds) , output of timer becomes ON. Now this
resets the counter. Now counter is ready to count the metals again.
Pressing X1 stops the automation process.
The purpose of M0 and M1 is same as that of X0 and X1. These memory bits are
linked to START and STOP buttons in the HMI.
Thus Pressing START icon in the HMI screen turns ON the automated metal
counting system where as pressing STOP icon on the HMI screen turns OFF the
Automated metal counting System
HMI screen developed for the Automated metal counting system.
Naveen Kumar S , GPT Mulabagal - 156 Page 45
Automation and Robotics-20EC53I 2023
The procedure for Interfacing and testing.
1. Download the PLC program into PLC
2. Develop and download screen onto HMI
3. Connect RS-485 cable between PLC and HMI
4. Now the status of conveyor belt and metals count can be seen on the HMI screen. By operating
START and STOP in the HMI screen , we can even the control turning ON and OFF of the
automated system.
5. Thus an operator sitting in front of the HMI screen can monitor the status of field devices and
automated process and control the working of the system using Human Machine Interface(HMI).
The video for developing the HMI screen for automatic metal
counting system and its working is :
https://youtu.be/KwmSg-HW22g?si=2n7jBXKUB2m6EPGf
Naveen Kumar S , GPT Mulabagal - 156 Page 46
Automation and Robotics-20EC53I 2023
Experiment 11: A parking plot has a certain capacity of cars/two wheelers. Number of
empty spots should be displayed on the display outside the Parking Plot and the spots
available is to be indicated by LEDs.
11.A. Using Serial Monitor to display the Empty Slots on the Monitor.
Aim: To develop Arduino based Car Parking Control system and display the empty slots
count on the Serial Monitor.
Components Required: Arduino Uno , IR modules/Ultrasonic sensors , LEDs, PC.
Circuit Diagram:
Testing:
We have considered 2 car slots/spots for demo. When No cars in the slots, the number of
empty slots will be 2. As the slots are occupied by the cars, the counter value is decremented .
In addition to this as car enters the slot, it is indicated though LED. The Empty slots count is
displayed on the serial monitor.
Result:
Note: The IR sensor Module, Photo sensor module and Relay used here are Active Low.
Arduino Sketch for Car parking control system.
int sensor1=2;
int sensor2=3;
int spot1=12;
int spot2=13;
Naveen Kumar S , GPT Mulabagal - 156 Page 47
Automation and Robotics-20EC53I 2023
int TEMP1=0;
int TEMP2=0;
int TEMP3=1;
int TEMP4=1;
intE_slots=2; /* Total slots Available for parking */
voidsetup(){
pinMode(sensor1,INPUT);
pinMode(sensor2,INPUT);
pinMode(spot1,OUTPUT);
pinMode(spot2,OUTPUT);
Serial.begin(9600);
}
voidloop(){
TEMP1=digitalRead(sensor1);
TEMP2=digitalRead(sensor2);
if(TEMP1^TEMP3==1)
{
TEMP3=TEMP1;
if(TEMP1==0) /* Check if a car Enters or leaves the slot1 */
{
E_slots=E_slots-1;
digitalWrite(spot1,HIGH);
}
else
{
E_slots=E_slots+1;
digitalWrite(spot1,LOW);
}
}
if(TEMP2^TEMP4==1)
{
TEMP4=TEMP2;
if(TEMP2==0) /* Check if a car Enters or leaves the slot2 */
{
E_slots=E_slots-1;
digitalWrite(spot2,HIGH);
}
else
{
E_slots=E_slots+1;
digitalWrite(spot2,LOW);
}
}
Serial.print("Number of Empty Slots:");
Serial.println(E_slots);
delay(1000);
}
Naveen Kumar S , GPT Mulabagal - 156 Page 48
Automation and Robotics-20EC53I 2023
11.B. Using LCD display to display the Empty slots available.
Aim: To develop Arduino based Car Parking Control system and display the car empty slots
on the LCD display.
Components Required: Arduino Uno , IR modules/Ultrasonic sensors , LEDs, PC.
Circuit Diagram:
Testing:
We have considered 2 car slots/spots for demo. When No cars in the slots, the number of
empty slots will be 2. As the slots are occupied by the cars, the counter value is decremented.
In addition to this as car enters the slot, it is indicated though LED. The Empty slots count is
displayed on the serial monitor.
Arduino Sketch
#include<LiquidCrystal.h>
constintrs=12;
constinten=11;
constint d5=5;
constint d4=4;
constint d3=3;
constint d2=2;
LiquidCrystallcd(rs,en,d5,d4,d3,d2) ;
int sensor1=6;
int sensor2=7;
int spot1=8;
int spot2=9;
Naveen Kumar S , GPT Mulabagal - 156 Page 49
Automation and Robotics-20EC53I 2023
int TEMP1=0;
int TEMP2=0;
int TEMP3=1;//Active Low sensors used. Temp3=1 indicates no car in spot1 previously
int TEMP4=1;// Temp4=1 indicates no car in spot2 previously
intE_slots=2;
void setup (){
lcd.begin(16,2);
pinMode(sensor1,INPUT);
pinMode(sensor2,INPUT);
pinMode(spot1,OUTPUT);
pinMode(spot2,OUTPUT);
}
void loop(){
TEMP1=digitalRead(sensor1);
TEMP2=digitalRead(sensor2);
if(TEMP1^TEMP3==1)// for spot 1
{
TEMP3=TEMP1;
if(TEMP1==0) /* Check if a car Enters or leaves the slot1 */
{
E_slots=E_slots-1;
digitalWrite(spot1,HIGH);
}
else
{
E_slots=E_slots+1;
digitalWrite(spot1,LOW);
}
}
if(TEMP2^TEMP4==1) //For spot2
{
TEMP4=TEMP2;
if(TEMP2==0) /* Check if a car Enters or leaves the slot2 */
{
E_slots=E_slots-1;
digitalWrite(spot2,HIGH);
}
else
{
E_slots=E_slots+1;
digitalWrite(spot2,LOW);
}
}
lcd.print("NO of E slots :");
lcd.println(E_slots);
delay(3000);
lcd.clear();
}
Naveen Kumar S , GPT Mulabagal - 156 Page 50
Automation and Robotics-20EC53I 2023
Experiment 12: Display the number of students in a classroom at any time of the day
Aim: To Display the number of students in a classroom at any time of the day.
Components Required: Arduino Uno , IR modules/Ultrasonic sensors , LEDs, PC.
Circuit Diagram:
Testing:
1. When a student Enters though the Entry Door, the LED 1 gets ON and the counter is
incremented by 1.
2. Similarly, when a student exits through the exit door, the LED 2 gets ON and the counter is
decremented by 1.
3. The number of students is displayed on the Serial Monitor.
Result:
Arduino Sketch for Counting the number of students in the class.
intEntrysensor = 2;
intExitsensor = 3;
int temp1;
int temp2;
int led1 = 12;
int led2 = 13;
int counter = 0;
Naveen Kumar S , GPT Mulabagal - 156 Page 51
Automation and Robotics-20EC53I 2023
voidsetup()
{
pinMode(Entrysensor, INPUT);
pinMode(Exitsensor, INPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
Serial.begin(9600);
}
voidloop()
{
temp1 = digitalRead(Entrysensor);
temp2 = digitalRead(Exitsensor);
if(temp1 == 0)
{
counter = counter + 1; /*Increment the counter when student enters*/
digitalWrite(led1, HIGH);
}
else
digitalWrite(led1, LOW);
if(temp2 == 0)
{
counter = counter - 1; /*Increment the counter when student exits*/
digitalWrite(led2, HIGH);
}
else
digitalWrite(led2, LOW);
Serial.print("NUMBER OF STUDENTS IN CLASS ROOM");
Serial.println(counter);
delay(500);
}
Naveen Kumar S , GPT Mulabagal - 156 Page 52
Automation and Robotics-20EC53I 2023
Experiment 14: Develop an Arduino based system such that the lights and fans should switch
OFF if no one is present in the room.
Aim: Develop an Arduino based system such that the lights and fans should switch OFF if no one is
present in the room.
Components Required: Arduino Uno, IR modules/Ultrasonic sensors , LEDs, PC.
Circuit Diagram:
Testing :
1. Initially the Lights are OFF.
2. When the students Enter the clasRoom, the Lamp is turned ON.
3. When the students leave the room , the Lamp is turned OFF.
4. In addition to controlling the Lamp, the students’ entry and exit is also indicated though the
LEDs.
Result:
Naveen Kumar S , GPT Mulabagal - 156 Page 53
Automation and Robotics-20EC53I 2023
Arduino Sketch for turning OFF the Lamp when No students present in the class room.
int Entrysensor = 2;
int Exitsensor = 3;
int temp1;
int temp2;
int led1 = 12;
int led2 = 13;
int relay = 11;
int counter = 0;
void setup(){
pinMode(Entrysensor, INPUT);
pinMode(Exitsensor, INPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(relay, OUTPUT);
Serial.begin(9600);
}
void loop()
{
temp1 = digitalRead(Entrysensor);
temp2 = digitalRead(Exitsensor);
if(temp1 == 0)
{
counter = counter + 1;
digitalWrite(led1, HIGH);
}
else
digitalWrite(led1, LOW);
if(temp2 == 0)
{
counter = counter - 1;
digitalWrite(led2, HIGH);
}
else
digitalWrite(led2, LOW);
Serial.print("NUMBER OF STUDENTS IN CLASS ROOM");
Serial.println(counter);
if(counter == 0)
digitalWrite(relay, HIGH);/*OFF the light when No students in the class*/
else
digitalWrite(relay, LOW); *ON the light when students are in the class*/
delay(500);
}
Naveen Kumar S , GPT Mulabagal - 156 Page 54
Automation and Robotics-20EC53I 2023
Experiment 14: Switch ON the street light during dark and automatically switch OFF during
the Day time using Arduino.
Aim: To switch ON the street light during dark and automatically switch OFF during the Day time
using Arduino.
Components Required: Arduino Uno , IR modules/Ultrasonic sensors , LEDs, PC.
Circuit Diagram:
Testing:
1. Keep the Photo sensor module in Low light , the Lamp is turned ON.
2. Bring Photo sensor module to the better sun-light , the Lamp gets OFF.
Result:
Arduino Sketch for automatic street light Controller.
int Sensor = 2;
int Relay = 12;
int TEMP = 0;
void setup()
{
pinMode(Sensor, INPUT);
pinMode(Relay, OUTPUT);
}
void loop()
{
TEMP = digitalRead(Sensor);
if(TEMP == 0)
digitalWrite(Relay, HIGH);
else
digitalWrite(Relay, LOW);
}
Naveen Kumar S , GPT Mulabagal - 156 Page 55
Automation and Robotics-20EC53I 2023
Experiment 15: Automated Guided Vehicles:
15A. Obstacle Avoiding Robot
Aim: - Develop a simple obstacle avoiding robot using ultrasonic sensor with Arduino.
Components Required: - Arduino Uno board, Ultrasonic sensor(HC-SR04) module,
LM298N motor driver module.
Circuit diagram: -
How it works: https://youtu.be/nKx7OEN5P2g?si=-0o_lrhSvT8o2ebb
Instructions to make Connections.
1. Connect 12V DC ( 8 no’s AA size batteries in series) power supply to the LM298
motor driver.
2. Connect a separate 9 V HW battery to the Arduino UNO.
3. Connect 5V and GND points of LM298n driver to the 5V and GND points in the
Arduino. Otherwise the PWM part will not work properly.
4. The Pins connected to IN1 and IN2 controls the direction of the motor connected at
Channel 1.
5. The Pins connected to IN3 and IN4 controls the direction of the motor connected at
Channel 2.
Naveen Kumar S , GPT Mulabagal - 156 Page 56
Automation and Robotics-20EC53I 2023
Introduction of obstacle avoiding robot
In obstacle avoiding robot we place an ultrasonic senor that can scan for the obstacles & free
path. It can measure the distance from the obstacle & send the signals to the Arduino.
Arduino causes the robot to take diversions.
Applications
1. Automated vacuum cleaners.
2. Automated Floor cleaners.
3. Goods Carriers in industries.
4. Aiding emergency services and work in hazardous environments
5. Entertainment industries
6. Human ease and personal assistance
7. Space exploration and deep-sea exploration
8. Industrial sectors and assembling line
9. Automobile manufacturing line
Procedure:-
Make the connections as per circuit diagram.
Type the sketch in Arduino IDE.
Compile. if on errors flash the Arduino.
ARDUINO SKETCH FOR OBSTACLE AVOIDING ROBOT
//Connect right motor to channel 1
//control pins for right motor are IN1 and IN2
//Connect right motor to channel 2
//control pins for left motor are IN3 and IN4
int trigpin=2; // trig pin of ultrasonic sensor
int echopin=3; //echo pin of ultrasonic sensor
long duration;
int distance;
int RIGHTMOTORFORWARD=10;// in1 right motor forward
int RIGHTMOTORRIVERSE=9;// in2 RIGHT motor REVERSE
int LEFTMOTORFORWARD=8;// in3 LEFT MOTOR FORWARD
int LEFTMOTORRIVERSE=7;//in4 left motor REVERSE
int ENR = 11;//To control the speed of the right motor using PWM
int ENL = 6;
void setup(){
pinMode(trigpin,OUTPUT);
pinMode(echopin,INPUT);
pinMode(RIGHTMOTORFORWARD,OUTPUT);
pinMode(LEFTMOTORFORWARD,OUTPUT);
pinMode(RIGHTMOTORRIVERSE,OUTPUT);
pinMode(LEFTMOTORRIVERSE,OUTPUT);
Naveen Kumar S , GPT Mulabagal - 156 Page 57
Automation and Robotics-20EC53I 2023
pinMode(ENR, OUTPUT);
pinMode(ENL, OUTPUT);
Serial.begin(9600);
}
void loop(){
analogWrite(ENL, 255);
analogWrite(ENR, 255);
digitalWrite(trigpin,LOW); /*generate a pulse on Trigger pin of ultrasonic sensor module*/
delayMicroseconds(3);
digitalWrite(trigpin,HIGH);
delayMicroseconds(11);
digitalWrite(trigpin,LOW);
duration=pulseIn(echopin,HIGH);
distance=duration*0.034/2;
Serial.print("DISTANCE IN CM");
Serial.println(distance);
if((distance<=20)) // if obtsacle found turn RIGHT
{
digitalWrite(LEFTMOTORFORWARD,HIGH);
digitalWrite(RIGHTMOTORRIVERSE,HIGH);
digitalWrite(LEFTMOTORRIVERSE,LOW);
digitalWrite(RIGHTMOTORFORWARD,LOW);
delay(400); //To turn the robot about 90 degree
// this delay depends on the speed of the motors
//if speed is more the delay should be less
}
else //keep moving Forward if not obstacle
{
digitalWrite(RIGHTMOTORFORWARD,HIGH);
digitalWrite(LEFTMOTORFORWARD,HIGH);
digitalWrite(RIGHTMOTORRIVERSE,LOW);
digitalWrite(LEFTMOTORRIVERSE,LOW);
RESULT:-
Naveen Kumar S , GPT Mulabagal - 156 Page 58
Automation and Robotics-20EC53I 2023
Experiment 15 B: Human Following Robot
AIM:-Develop a simple human following robot using Arduino.
COMPONENTS:-Arduino UNO board,Ultrasonic Sensor(HC-SR04)Module,L298N Motor
Driver & their parts.
CIRCUIT DIAGRAM
How it works: https://www.youtube.com/shorts/LFmSCAX9y5A
TESTING:-
If the person is between 20 and 100 cm, the robot moves forward and follows him. If the
person/any obstacle is within the 20cm, the Robot stops moving.
Sketch for Human Follower Robot.
int trigpin = 2;
int echopin = 3;
long duration;
int distance;
int RIGHTMOTORFORWARD = 10; // in1 right motor forward
int RIGHTMOTORRIVERSE = 9; // in2 RIGHT motor REVERSE
int LEFTMOTORFORWARD = 8; // in3 LEFT MOTOR FORWARD
int LEFTMOTORRIVERSE = 7; //in4 left motor REVERSE
int ENR = 11;
int ENL = 6;
Naveen Kumar S , GPT Mulabagal - 156 Page 59
Automation and Robotics-20EC53I 2023
void setup(){
pinMode(trigpin, OUTPUT);
pinMode(echopin, INPUT);
pinMode(RIGHTMOTORFORWARD, OUTPUT);
pinMode(LEFTMOTORFORWARD, OUTPUT);
pinMode(RIGHTMOTORRIVERSE, OUTPUT);
pinMode(LEFTMOTORRIVERSE, OUTPUT);
pinMode(ENR, OUTPUT);
pinMode(ENL, OUTPUT);
Serial.begin(9600);
}
void loop(){
digitalWrite(trigpin, LOW);//generate a pulse on Trigger pin of ultrasonic sensor module
delayMicroseconds(3);
digitalWrite(trigpin, HIGH);
delayMicroseconds(11);
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin, HIGH);
distance = duration * 0.034 / 2;
Serial.print("DISTANCE IN CM");
Serial.println(distance);
if((distance >= 20)&&(distance <= 100)){
digitalWrite(RIGHTMOTORRIVERSE, LOW);
digitalWrite(LEFTMOTORRIVERSE, LOW);
digitalWrite(RIGHTMOTORFORWARD, HIGH);
digitalWrite(LEFTMOTORFORWARD, HIGH);
analogWrite(ENL, 220);
analogWrite(ENR, 195);
}
else{
digitalWrite(RIGHTMOTORRIVERSE, LOW);
digitalWrite(LEFTMOTORRIVERSE, LOW);
digitalWrite(RIGHTMOTORFORWARD, LOW);
digitalWrite(LEFTMOTORFORWARD, LOW);
}
}
Result:
Naveen Kumar S , GPT Mulabagal - 156 Page 60
Automation and Robotics-20EC53I 2023
Experiment 15 C: Line Follower Robot
Aim: Develop an arduino based Line Follower Robot.
Components Required:
How AGVs works for path planning:
https://youtu.be/Z-P_suDEG6M?si=3xkTn08EX0uFUbqk
Arduino Sketch for Line Follower Robot.
int ENR = 11;
int ENL = 6;
int leftsensor = 2;
int rightsensor = 3;
int RIGHTMOTORFORWARD = 10;
int RIGHTMOTORRIVERSE = 9;
int LEFTMOTORFORWARD = 8;
int LEFTMOTORRIVERSE = 7;
int ir_left = 0;
int ir_right = 0;
Naveen Kumar S , GPT Mulabagal - 156 Page 61
Automation and Robotics-20EC53I 2023
void setup(){
pinMode(ENR, OUTPUT);
pinMode(ENL, OUTPUT);
pinMode(leftsensor, INPUT);
pinMode(rightsensor, INPUT);
pinMode(RIGHTMOTORFORWARD, OUTPUT);
pinMode(RIGHTMOTORRIVERSE, OUTPUT);
pinMode(LEFTMOTORFORWARD, OUTPUT);
pinMode(LEFTMOTORRIVERSE, OUTPUT);
Serial.begin(9600);
}
void loop(){
analogWrite(ENR, 150); // Motor has to rotate slow so that
analogWrite(ENL, 150); // -- its direction can be controlled upon sensor signals
ir_left = digitalRead(leftsensor);
ir_right = digitalRead(rightsensor);
if((ir_left == 0)&&(ir_right == 0)){ // Move Farward
digitalWrite(RIGHTMOTORFORWARD, HIGH);
digitalWrite(LEFTMOTORFORWARD, HIGH);
digitalWrite(RIGHTMOTORRIVERSE, LOW);
digitalWrite(LEFTMOTORRIVERSE, LOW);
}
elseif((ir_left == 0)&&(ir_right == 1)){// the right sensor is on black line
digitalWrite(RIGHTMOTORFORWARD, LOW); // slide right
digitalWrite(LEFTMOTORFORWARD, HIGH);
digitalWrite(RIGHTMOTORRIVERSE, HIGH);
digitalWrite(LEFTMOTORRIVERSE, LOW);
elseif((ir_left == 1)&&(ir_right == 0)){// the left sensor is on black line
digitalWrite(RIGHTMOTORFORWARD, HIGH); // slide left
digitalWrite(LEFTMOTORFORWARD, LOW);
digitalWrite(RIGHTMOTORRIVERSE, LOW);
digitalWrite(LEFTMOTORRIVERSE, HIGH);
}
else{
digitalWrite(RIGHTMOTORFORWARD, LOW);
digitalWrite(LEFTMOTORFORWARD, LOW);
digitalWrite(RIGHTMOTORRIVERSE, LOW);
digitalWrite(LEFTMOTORRIVERSE, LOW);
}
}
Naveen Kumar S , GPT Mulabagal - 156 Page 62
Automation and Robotics-20EC53I 2023
Programming a Robot to trace different paths.
Procedure for Programming the Robot using Program pendent.
1. Open Robo Studio software.
2. Give the project name and click on create project.
3. Go to ABB Library select any ROBOT
4. Import Library Equipment select Mytool
5. Drag the tool onto the Robot under your PROJECT in Layout.
6. HOMEVirtual Controller From Layout Next Next Finish. Wait till
Controller status is ON
7. Modelling solid select any required shape and Enter its dimensions. Create Close
8. Keep the solid within the work volume.
9. Controller - Select IRC5 FlexPendent Under FlexPendent .
In Program Pendent
10. Keep the Robot in Manual Mode and click on Enable to keep MOTOR ON
11. Menu Program Editor
12. Module File New Module --> Yes Give the Module Name and select OK
13. Select your Module and click on Show module
14. Routines File New Routine Give the Routine Name and press OK
15. Select Show Routine.
16. Click on ADD instruction
17. Select the appropriate instructions according to the task.
18. Select the Positions by operating the Robot tool. Select any position ( P10/P20/P30/….)
Operate the Robot to fix the position and click on Modify Position.
19. After fixing the Positions , Debug PP to Routine
20. Run to see the Robot Operation.
Video showing how to trace a Square path using Robostudio:
https://youtu.be/Vn9kpip4f1Y?si=n3Vj3eEZG_-vE_DK
How 4 robots are programmed for tracing different paths:
https://youtu.be/A2_nU5eWKcs?si=9O_m5oimM5p0Scl4p
Naveen Kumar S , GPT Mulabagal - 156 Page 63
Automation and Robotics-20EC53I 2023
Experiment 16: Program a Robot to trace Rectangular Path.
MoveJ P10 , v1000 ,Z50,tool0
i. Tool0 Moves the tool0 . tool0 is the name of the End effector used in this project.
ii. V1000:Velocity of the tool movement should be 1000 mm/s.
iii. Z specifies a corner Zone defined by a constant of data type. There are many predefined
values , such as
a. Fine : The Robot will go exactly to the specified position.
b. Z10: The robot path can take shortcuts around the corners if it is less than 10mm
from TO Point.
c. Z50: The robot path can take shortcuts around the corners if it is less than 50mm
from TO Point.
iv. P10 : Position in the Work Volume.
Naveen Kumar S , GPT Mulabagal - 156 Page 64
Automation and Robotics-20EC53I 2023
Experiment 17: Program a Robot to trace Square Path.
Experiment 18: Program a Robot to trace Triangular Path.
Naveen Kumar S , GPT Mulabagal - 156 Page 65
Automation and Robotics-20EC53I 2023
Experiment 19: Program a Robot to trace Circular Path.
Experiment 20: Program a Robot to trace Conical Path.
Naveen Kumar S , GPT Mulabagal - 156 Page 66
Automation and Robotics-20EC53I 2023
Experiment 21: Build a MAZE solving ROBOT in Real environment
Aim : To build MAZE solving ROBOT
Components Required:
Theory:
A maze solving robot is designed to move in a maze and escape through it by following its
walls. A maze solving robot is quite similar to a line follower.
A maze follower finds a wall and starts following it until it finds an escape route.
A maze follower is designed to find an escape route that is not known beforehand.
Figure 3:Sample Maze
Circuit Diagram:
The working of maze solver
https://youtu.be/pDvO_QMqzVU?si=tGOZsdD7_ByhaMsH
We have used
1. An ultrasonic sensor to determine the obstacle ahead. An ultrasonic sensor uses sound
waves for obstacle detection.
2. Arduino Uno with AtMega 328 controller board. It is programmed to control the
direction of robot movement upon the signalling from the Ultrasonic Sensor.
3. Servo motor which is rotated to find out in which direction the Robot can be moved.
4. An LN298N DC motor driver module to control the speed of the Motors and also the
rotation angle. The LN298N has built-in PWM technique with we speed control of DC
motor can be achieved.
5. Geared DC motor to limit the speed of the Robot and also to have control on the speed.
Naveen Kumar S , GPT Mulabagal - 156 Page 67
Automation and Robotics-20EC53I 2023
Arduino Sketch for Maze solver Robot
#include<Servo.h>
Servo s1;
int trigpin = 3;
int echopin = 4;
long duration;
int distance = 0;
int servopin = 5;
int rightmotorforward = 9; //IN1
int rightmotorbackward = 10; //IN2
int leftmotorforward = 7; //IN3
int leftmotorbackward = 8; //IN4
Naveen Kumar S , GPT Mulabagal - 156 Page 68
Automation and Robotics-20EC53I 2023
int ena = 6; //ENL
int enb = 11; //ENR
void setup() {
pinMode(rightmotorforward, OUTPUT);
pinMode(rightmotorbackward, OUTPUT);
pinMode(leftmotorforward, OUTPUT);
pinMode(leftmotorbackward, OUTPUT);
pinMode(ena, OUTPUT);
pinMode(enb, OUTPUT);
s1.attach(servopin);
pinMode(trigpin, OUTPUT);
pinMode(echopin, INPUT);
Serial.begin(9600);
s1.write(90);
analogWrite(ena, 100); /*These PWM values depend on the Power level in the battery
used*/
analogWrite(enb, 87);
}
void loop(){
digitalWrite(trigpin, LOW);
delay(3);
digitalWrite(trigpin, HIGH);
delay(11);
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin, HIGH);
distance = duration * 0.034 / 2;
Serial.print("Distance in CM:");
Serial.println(distance);
Naveen Kumar S , GPT Mulabagal - 156 Page 69
Automation and Robotics-20EC53I 2023
if (distance > 20) //check front
{
digitalWrite(rightmotorforward, HIGH);
digitalWrite(rightmotorbackward, LOW);
digitalWrite(leftmotorforward, HIGH);
digitalWrite(leftmotorbackward, LOW);
}
else if (distance > 0 and distance <= 25)
{
digitalWrite(rightmotorforward, LOW); // stop the robot
digitalWrite(rightmotorbackward, LOW);
digitalWrite(leftmotorforward, LOW);
digitalWrite(leftmotorbackward, LOW);
delay(2000);
s1.write(0); //look right
delay(1000);
digitalWrite(trigpin, LOW); /// check if there is an obstacle on right
delay(3);
digitalWrite(trigpin, HIGH);
delay(11);
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin, HIGH);
distance = duration * 0.034 / 2;
Serial.print("Distance in CM:");
Serial.println(distance);
if ( distance> 0 and distance <= 25)
{
s1.write(90);
delay(2000);
digitalWrite(rightmotorforward, HIGH); // turn the body left
Naveen Kumar S , GPT Mulabagal - 156 Page 70
Automation and Robotics-20EC53I 2023
digitalWrite(rightmotorbackward, LOW);
digitalWrite(leftmotorforward, LOW);
digitalWrite(leftmotorbackward, LOW);
delay(1150);// delay for rotating BODY BY 90 LEFT
digitalWrite(rightmotorforward, LOW);// after the rotation wait for 2 sec
digitalWrite(rightmotorbackward, LOW);
digitalWrite(leftmotorforward, LOW);
digitalWrite(leftmotorbackward, LOW);
delay(2000);
digitalWrite(rightmotorforward, HIGH);// after the rotation move forward
digitalWrite(rightmotorbackward, LOW);
digitalWrite(leftmotorforward, HIGH);
digitalWrite(leftmotorbackward, LOW);
}
else { // if something is on right , turn left
s1.write(90);
digitalWrite(rightmotorforward, LOW);// after the rotation wait for 2 sec
digitalWrite(rightmotorbackward, LOW);
digitalWrite(leftmotorforward, LOW);
digitalWrite(leftmotorbackward, LOW);
delay(5000);
digitalWrite(rightmotorforward, LOW); // if nothing on right , turn right
digitalWrite(rightmotorbackward, LOW);
digitalWrite(leftmotorforward, HIGH);
digitalWrite(leftmotorbackward, LOW);
delay(900);// ROTATE BODY RIGHT BY 90
Naveen Kumar S , GPT Mulabagal - 156 Page 71
Automation and Robotics-20EC53I 2023
digitalWrite(rightmotorforward, LOW);// after the rotation wait for 2 sec
digitalWrite(rightmotorbackward, LOW);
digitalWrite(leftmotorforward, LOW);
digitalWrite(leftmotorbackward, LOW);
delay(2000);
digitalWrite(rightmotorforward, HIGH); // after rotation move forward
digitalWrite(rightmotorbackward, LOW);
digitalWrite(leftmotorforward, HIGH);
digitalWrite(leftmotorbackward, LOW);
}
}
Naveen Kumar S , GPT Mulabagal - 156 Page 72
Automation and Robotics-20EC53I 2023
How to develop PLC trainer kit?
Are you curious about how one develops PLC trainer kit?
Here is the circuit diagram of PLC trainer kit we have developed. You can yourself develop
the one.
Procedure for wiring.
a. We have used Delta make DVP-14SS211R PLC. Apply 24V DC power supply to the
PLC.
b. Connect C0 and C1 from PLC outputs to 24V.
c. It supports two protocols RS-232 and RS-485. Connect DIN to RS-232 connector to the
slot shown. The other is available now to connect to PC’s serial port.
d. The RS-485(2-wires) port can be used for interfacing the PLC with HMI.
e. The inputs X0-X7 are connected to push buttons/Toggle switches for applying ON/OFF
signalling to the PLC. These are connected to 24V DC such that when those switches are
ON, the PLC inputs get Logic HIGH signal.
At the same time X0-X7 are connected to Banana plugs for applying external inputs from
sensors and other inputs.
f. The outputs Y0-Y5 are connected to the indicators. At the same time these outputs are
connected to the Banana plugs to take the outputs to actuators such as relays
Naveen Kumar S , GPT Mulabagal - 156 Page 73
Automation and Robotics-20EC53I 2023
This is how the kit Look like after development.
Naveen Kumar S , GPT Mulabagal - 156 Page 74
Automation and Robotics-20EC53I 2023
The amazon app links to get the components required .
a) PLC-https://www.amazon.in/dp/B08CKQ5X5H?ref=ppx_pop_mob_ap_share
b) DOP CABLE - https://www.amazon.in/dp/B085XVRSGV?ref=ppx_pop_mob_ap_share
c) Push Buttons - https://www.amazon.in/dp/B08L9J848N?ref=ppx_pop_mob_ap_share
d) Toggle switches -
https://www.amazon.in/dp/B0845NCBDR?ref=ppx_pop_mob_ap_share
e) Banana plugs and connectors -
https://www.amazon.in/dp/B084KT339N?ref=ppx_pop_mob_ap_share
f) LED panel mount Indicators - https://amzn.eu/d/bjolhgj
Naveen Kumar S , GPT Mulabagal - 156 Page 75