0% found this document useful (0 votes)
32 views70 pages

Automation and Robotics Trainer Kit Programming Manual

Robotics and automation testing system with components

Uploaded by

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

Automation and Robotics Trainer Kit Programming Manual

Robotics and automation testing system with components

Uploaded by

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

Automation And Robotics (20EC53I)

AUTOMATION AND ROBOTICS TRAINER KIT


PROGRAMMING MANUAL

(2024-25)

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 1


Automation And Robotics (20EC53I)

Arduino Uno
Arduino is an open-source platform used for building electronics projects. Arduino consists of both a
physical programmable circuit board (often referred to as a microcontroller) and a piece of software, or
IDE (Integrated Development Environment) that runs on your computer, used to write and upload
computer code to the physical board.

The Arduino platform has become quite popular with people just starting out with electronics, and
for good reason. Unlike most previous programmable circuit boards, the Arduino does not need a
separate piece of hardware (called a programmer) in order to load new code onto the board -- you
can simply use a USB cable. Additionally, the Arduino IDE uses a simplified version of C++,
making it easier to learn to program. Finally, Arduino provides a standard form factor that breaks
out the functions of the micro-controller into a more accessible package.

Programming

The Arduino UNO can be programmed with the (Arduino Software (IDE)). Select "Arduino UNO
from the Tools > Board menu (according to the microcontroller on your board). For details, see
the reference and tutorials.

The ATmega328 on the Arduino UNO comes preprogrammed with a bootloader that allows you
to upload new code to it without the use of an external hardware programmer. It communicates
using the original STK500 protocol (reference, C header files).

The ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is available in the
Arduino repository. The ATmega16U2/8U2 is loaded with a DFU bootloader, which can be
activated by:

Warnings

The Arduino UNO has a resettable polyfuse that protects your computer's USB ports from shorts
and overcurrent. Although most computers provide their own internal protection, the fuse
provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse
will automatically break the connection until the short or overload is removed.

Differences with other boards : The UNO differs from all preceding boards in that it does not
use the FTDI USB-to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to
version R2) programmed as a USB-to-serial converter.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 2


Automation And Robotics (20EC53I)

Power: The Arduino UNO board can be powered via the USB connection or with an external
power supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or battery. The
adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack.
Leads from a battery can be inserted in the GND and Vin pin headers of the POWER connector.

The power pins are as follows:

Vin. The input voltage to the Arduino board when it's using an external power source (as opposed to 5
volts from the USB connection or other regulated power source). You can supply voltage through this pin,
or, if supplying voltage via the power jack, access it through this pin.

3.3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.

GND. Ground pins.

IOREF. This pin on the Arduino board provides the voltage reference with which the microcontroller
operates. A properly configured shield can read the IOREF pin voltage and select the appropriate power
source or enable voltage translators on the outputs to work with the 5V or 3.3V.

Memory: The ATmega328 has 32 KB (with 0.5 KB occupied by the bootloader). It also has 2 KB of
SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).

Input and Output

See the mapping between Arduino pins and ATmega328P ports. The mapping for the Atmega8, 168, and
328 is identical.

Microcontroller ATmega328P

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital I/O Pins 14 (of which 6 provide PWM output)

PWM Digital I/O Pins 6

Analog Input Pins 6

DC Current per I/O Pin 20 mA

DC Current for 3.3V Pin 50 mA

Flash Memory 32 KB (ATmega328P) of which 0.5 KB used by bootloader

SRAM 2 KB (ATmega328P)

EEPROM 1 KB (ATmega328P)

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 3


Automation And Robotics (20EC53I)

1. Blinking LED
Aim: To create a simple circuit that makes an LED blink on and off at regular intervals.

Components

 1 x LED (any color)


 1 x Resistor (220Ω or 330Ω)
 1 x Breadboard
 1 x Arduino or microcontroller (optional)
 Jumper wires
 Power supply (e.g., battery or USB for Arduino)

Procedure

 Connect the LED:


 Place the LED on the breadboard.
 Connect the anode (long leg) of the LED to a digital pin on the Arduino (e.g., pin 13).
 Connect the cathode (short leg) to one terminal of the resistor.
 Connect the other terminal of the resistor to the ground (GND).

Block daigram:

Fig 1: Blinking led

Theory : A light-emitting diode (LED) is a semiconductor device that emits light when an
electric current passes through it. The basic operation of an LED relies on its forward voltage,
typically around 2-3V for standard LEDs, which is crucial for ensuring proper functionality
without damage. To limit the current flowing through the LED and protect it, a resistor is often
used in series with the LED. When a pin is set to HIGH, current flows through the LED, causing
it to light up; conversely, setting the pin to LOW stops the current, turning the LED off. The

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 4


Automation And Robotics (20EC53I)

timing of the LED's blinking is controlled using functions like delay(), which allows for precise
management of how long the LED remains lit or unlit.

Code

const int ledpin=13;

void setup( ) {

pinMode(13, OUTPUT); // Set pin 13 as output

void loop( ) {

digitalWrite(13, HIGH); // Turn LED on

delay(1000); // Wait for 1 second

digitalWrite(13, LOW); // Turn LED off

delay(1000); // Wait for 1 second

Result

The LED blinks on for 1 second and then off for 1 second repeatedly. This demonstrates basic
LED control and timing.

2. Blinking Tricolor LED

Aim: To create a circuit that makes a tricolor LED (RGB LED) blink in different colors.

Components

 1 x RGB LED
 3 x Resistors (220Ω for each color)
 1 x Breadboard
 1 x Arduino or microcontroller
 Jumper wires
 Power supply (e.g., battery or USB for Arduino)

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 5


Automation And Robotics (20EC53I)

Procedure

o Insert the RGB LED into the breadboard.


o Identify the pins: Common Anode (or Cathode), Red, Green, Blue.
o For a common anode RGB LED, connect the common pin to VCC (5V).
o Connect the Red pin to a digital pin on the Arduino (e.g., pin 9) through a resistor.
o Connect the Green pin to another digital pin (e.g., pin 10) through a resistor.
o Connect the Blue pin to another digital pin (e.g., pin 11) through a resistor.

Block daigram

Fig 2.Blinking tricolor led

Theory : A tricolor LED, or RGB LED, comprises three individual LEDs (red, green, and blue)
housed within a single package, enabling the production of a wide spectrum of colors through
additive color mixing. This principle allows for combinations of different intensities of red, green,
and blue light to create various hues; for example, mixing red and green produces yellow, while
combining all three colors results in white. RGB LEDs can be either common anode or common
cathode, affecting how they are controlled: in common anode configurations, the anode connects
to a positive voltage, requiring the corresponding pins to be set LOW to activate the colors,
whereas in common cathode types, the pins are set HIGH.

Code

const int red_pin=9;

const int green_pin=10;

const int blue_pin=11;

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 6


Automation And Robotics (20EC53I)

void setup( ) {

pinMode(9, OUTPUT); // Red pin

pinMode(10, OUTPUT); // Green pin

pinMode(11, OUTPUT); // Blue pin

void loop( ) {

digitalWrite(9, HIGH); // Red

delay(1000);

digitalWrite(9, LOW);

digitalWrite(10, HIGH); // Green

delay(1000);

digitalWrite(10, LOW);

digitalWrite(11, HIGH); // Blue

delay(1000);

digitalWrite(11, LOW); // All off

delay(1000);

Result: The RGB LED cycles through red, green, and blue colors, each blinking for 1 second. This
demonstrates how to control an RGB LED and use multiple outputs.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 7


Automation And Robotics (20EC53I)

3. Interfacing the LCD display with Arduino board.

AIM : To conduct an experiment to interface the lcd display with Arduino board

APPARATUS REQUIRED:

 Arduino UNO
 lcd display
 USB cable & Jumper Wires
 LED
 Desktop.

Procedure:

1. Code Preparation: Write or obtain the Arduino code for controlling the LCD. Ensure the code
includes the necessary library, such as LiquidCrystal.h.

2. Compile the Code: Verify that the code compiles without errors in the Arduino IDE.

3. Power Setup: Power on the Arduino kit using a +12V, 2A adapter.

4. Connect to PC: Connect the Arduino to your PC using a USB cable.

5. Kit Connections: Connect the LCD module as follows:

RS Pin: Connect to Digital Pin 12 on the Arduino.

Enable Pin: Connect to Digital Pin 11 on the Arduino.

VCC Pin: Connect to the 5V pin on the Arduino.

Ground Pin: Connect to the GND pin on the Arduino.

Data Pins: (if using a 4-bit mode)

Connect Data Pin 1 (D4) to Digital Pin 8 on the Arduino.

Connect Data Pin 2 (D5) to Digital Pin 9 on the Arduino.

Connect Data Pin 3 (D6) to Digital Pin 10 on the Arduino.

Connect Data Pin 4 (D7) to Digital Pin 11 on the Arduino.

6. Upload the Program: Upload the code to the Arduino board using the IDE.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 8


Automation And Robotics (20EC53I)

7. Monitor Output: Open the Serial Monitor in the Arduino IDE to observe the output from the
LCD.

Theory : The LCD (Liquid Crystal Display) is an essential output device used for visually
representing data. It operates based on liquid crystal technology, which modulates light to create
images or text. Communication between the Arduino and the LCD is facilitated through various
pins, including the Register Select (RS) pin, which distinguishes between command and data
modes; the Enable (E) pin, which triggers the reading of data; and the data pins (D4 to D7), used
for transmitting information in 4-bit mode.

The LCD requires a power supply (VCC) and a ground connection (GND) for stable operation.
By utilizing the LiquidCrystal library in the Arduino IDE, users can send commands and display
text with ease, allowing for real-time data visualization in a variety of projects. Properly
interfacing the LCD with the Arduino enables quick and effective communication, making it an
invaluable tool for displaying information in embedded systems.

Block diagram

Fig 3.Interfacing LCD

Code :

#include<LiquidCrystal.h>

Const int RS=12,E=11;

Const int D4=5,D5=4,D6=3,D7=2;

LiquidCrystal lcd (12,11,5,4,2);

void setup( )

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 9


Automation And Robotics (20EC53I)

lcd.begin(16,2);

lcd.print(“hello world”);

void loop( )

lcd.setCursor(5,1);

lcd.print(“lcd display”);

RESULT:-

LCD module display using Arduino board is verified .

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 10


Automation And Robotics (20EC53I)

4. Temperature Sensor (LM 35) Interface Using Trainer Kit

Aim :To develop a system that accurately measures and displays temperature using the LM34
temperature sensor and an Arduino, addressing the need for reliable temperature monitoring in
various applications.

Components Required

1. Arduino Board
2. LM34 Temperature Sensor
3. 12V 2A Power Supply
4. USB Cable for Programming
5. Jumper Wires (2-line connector

Procedure

 Follow the code section mentioned bellow make sure the code doesn’t have error
at compilation
 Power on the kit by using 12v 2A adaptor
 Connect the programmer USB cable to kit and PC
 Kit connection
1. Use 2-line connector, connect the connector head to
LM35TEMPERATURE SENSOR module of pinheader [LM35,OUT]
2. Connect the LM35 pin to 5v power supply section
3. Connect the OUT pin to pin no.A0 of Arduino
4. Done with connections
 Load the program to Kit

Theory :The LM35 temperature sensor is a highly precise device used for measuring
temperature in various applications, including environmental monitoring and industrial processes.
It provides an analog output that is directly proportional to the temperature in degrees Celsius,
with a sensitivity of 10 mV/°C. This means that at 25°C, the output voltage will be 250 mV. The
sensor connects to the Arduino through its output pin, which can be read using an analog input pin
on the Arduino board. The system allows users to easily capture and display real-time temperature
readings, making it suitable for applications that require reliable temperature monitoring, such as
weather stations or HVAC systems. By interfacing the LM35 with an Arduino, users can develop
projects that automatically adjust to temperature changes, enhancing automation and control.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 11


Automation And Robotics (20EC53I)

Bock Diagram

Fig 4.LM35 interfacing

Code section
#define sensorPin A0

float value=0;

float voltage;

float temp;

void setup( ) {

Serial.begin(9600);

void loop( ) {

// Get the voltage reading from the LM35

float value = analogRead(sensorPin);

// Convert that reading into voltage

float voltage = value * (5.0 / 1024.0);

// Convert the voltage into the temperature in Celsius

float temp = voltage * 100;

Serial.print("Temperature:");

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 12


Automation And Robotics (20EC53I)

Serial.print(temp); // Print the temperature in Fahrenheit

float Fahrenheit = (temp * 9.0 / 5.0) + 32.0;

Serial.println(Fahrenhiet);

delay(1000); // wait a second between readings

Result: The implementation of a temperature sensor interface using an LM34 and Arduino is
done and verified, successfully demonstrating accurate temperature readings based on the sensor's
output.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 13


Automation And Robotics (20EC53I)

5.Temperature Sensor(DHT11) Interface Using Trainer Kit

Aim: To develop a system that accurately measures and displays temperature and humidity using
the DHT11 temperature sensor and an Arduino, addressing the need for reliable environmental
monitoring in various applications.

Components Required

 Arduino Board
 DHT11 Temperature and Humidity Sensor
 12V 2A Power Supply
 USB Cable for Programming
 Jumper Wires (2-line connector)

Procedure

1. Follow the code section mentioned bellow make sure the code doesn’t have
error at compilation
2. Power on the kit by using 12v 2A adaptor
3. Connect the programmer USB cable to kit and PC
4. Kit connection
1. Use 4-line connector, connect the connector head toDHT11
TEMPERATURE SENSOR module of pinheader [DHT11,OUT]
2. Connect theDHT11 pin to 5v power supply section
3. Connect the OUT pin to pin no.A0 of Arduino
4. Done with connections
5. Load the program to Kit

Theory : The DHT11 temperature and humidity sensor is a popular choice for environmental
monitoring due to its affordability and ease of use. It provides both temperature and humidity
readings, making it versatile for various applications such as home automation, weather
monitoring, and greenhouse control. The DHT11 operates using a digital signal, simplifying the
interfacing process with an Arduino. It typically measures temperatures from 0 to 50°C with an
accuracy of ±2°C and humidity from 20% to 90% with an accuracy of ±5%. The sensor
communicates with the Arduino using a single-wire protocol, allowing for straightforward data
collection.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 14


Automation And Robotics (20EC53I)

Block diagram

Fig 5.DHT11 Interfacing

Code Section:

#include <DFRobot_DHT11.h>
#define DHT11_PIN 2
DFRobot_DHT11 mydht;
void setup( )
{
Serial.begin(9600);
}
void loop( )
{
mydht.read(DHT11_PIN); // mydht(DHT11_PIN);
//int mydht.read();
Serial.print("Temperature:");
Serial.print(mydht.temperature);

Serial.print("Humidity:");
Serial.print(mydht.humidity);

Serial.println("%");

delay(2000);
}

Result: The implementation of a temperature and humidity sensor interface using the DHT11
and Arduino is done and verified, successfully demonstrating accurate readings of temperature
and humidity based on the sensor's output.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 15


Automation And Robotics (20EC53I)

6. Interfacing MQ-3 alcohol sensor with Arduino board.


AIM: To interfacing MQ-3 alcohol sensor to detect the alcohol using Arduino board.

APPARATUS REQUIRED:-

 Arduino board
 MQ-3 Alcohol sensor module
 buzzer
 USB cable and jumper wires
 Desktop

PROCEDURE:

 Follow the code section mentioned above

 Make sure that the code doesn't have error at the time of Compilation

 Connect the DOUT pin of MQ-3 sensor to 9th pin of Arduino.

 Connect the AOUT pin of MQ-3 sensor to A0 pin of Arduino.

 connect VCC to +5v pin of Arduino.

 Connect one terminal of buzzer to digital pin 7 pin of arduino and other pin to GND pin.

 Connect the USB cable to PC and kit.

 Load the program to kit & observe the output in serial monitor.

Theory :

The MQ-3 alcohol sensor is designed to detect the presence of alcohol in the environment and is
commonly used in breathalyzer applications. It operates by measuring the concentration of
alcohol vapors in the air and providing an analog output that correlates with the alcohol level. The
sensor consists of a sensing layer that changes resistance based on the concentration of alcohol,
allowing the Arduino to read this change through its analog input. In addition to detecting alcohol,
the MQ-3 sensor can also detect other gases, making it versatile for various applications. When
the sensor detects alcohol, it can trigger a response, such as activating a buzzer or sending a

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 16


Automation And Robotics (20EC53I)

notification. This capability is essential for safety applications, including vehicle ignition locks
and personal breathalyzers.

Block Daigram

Fig 6.MQ-3 Alochol Sensor interfacing

CODE SECTION:

const int digital=9;

const int analog=A0;

const int buz=7;

void setup( )

Serial.begin(9600);

pinMode(9,INPUT);

pinMode(A0,INPUT);

pinMode(7,OUTPUT);

void loop( )

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 17


Automation And Robotics (20EC53I)

int x=digitalRead(9);

if(x==1) {

digitalWrite(buz,HIGH);

Serial.println("Alcohol detected");

else {

digitalWrite(buz,LOW);

Serial.println("Alcohol not detected"); }

int y=analogRead(A0);

Serial.print("Quantity of Alcohol:");

Serial.println(y);

RESULT:

Hence, the interfacing MQ-3 alcohol sensor to detect the alcohol using Arduino board is verified.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 18


Automation And Robotics (20EC53I)

7. Sound Sensor Interface Using Arduino Controller Kit

Aim: To develop a system that accurately detects sound levels using a sound sensor and an
Arduino, addressing the need for effective sound monitoring in various applications.

Components Required

1. Arduino Board
2. Sound Sensor Module
3. 12V 2A Power Supply
4. USB Cable for Programming
5. Jumper Wires (4-line connector)

Procedure

 Follow the code section mentioned below make sure the code doesn’t have error at
compilation Power on the kit by using 12v 2A adaptor.
 Connect the programmer USB cable to kit and PC Kit connection
 Use 4-line connector connect the connector head to sound sensor module of pin header
[VCC, GND, D0]
 Connect the VCC pin to 5v power supply section
 Connect the GND pin to GND power supply section
 Connect the OUT pin to pin no. A0 of Arduino

INTERFACE WITH ARDUINO

VCC VCC
GND GND

A0 A_out

Arduino Sound
Sensor

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 19


Automation And Robotics (20EC53I)

Theory :The sound sensor interface using an Arduino controller is an effective way to monitor
sound levels in various environments, enhancing applications like noise monitoring,
environmental studies, and safety systems. The sound sensor module detects sound waves and
converts them into an electrical signal, which is then processed by the Arduino board. The
Arduino, a versatile microcontroller platform, allows for easy programming and integration with
various sensors and modules.

Code
const int analog=A0;

const int led=7;

void setup( ) {

pinMode(A0,INPUT);

pinMode(7,OUTPUT);

void loop( ) {

int value=analogRead(A0);

if(value>200) {

digitalWrite (led,HIGH);

else {

digitalWrite(led,LOW);

Result

The implementation of a sound sensor interface using an Arduino is done and verified,
successfully demonstrating the detection of sound levels based on the sensor's output.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 20


Automation And Robotics (20EC53I)

8. Current sensor interface using Arduino Controller kit

Aim: To develop a system that accurately measures and monitors current using a current
sensor and an Arduino, addressing the need for reliable current measurement in various
electronic applications.

Components Required
 Arduino Board
 Current Sensor Module
 12V 2A Power Supply
 USB Cable for Programming
 Jumper Wires (3-line or 4-line connector)

Procedure
 Follow the code section mentioned below; make sure the code doesn’t have error at
compilation.
 Power on the kit by using 12v 2A adaptor.
 Connect the programmer USB cable to kit and PC.
 Kit connection:
 Use 3-line, 4-line connector; connect the connector head to current sensor module
of pin header [signal, VCC, GND].
 Connect the VCC pin to 5v power supply section.
 Connect the GND pin to GND power supply section.
 Connect the signal pin to GPIO A0 of Arduino PIN.
 Load the program to Kit.

INTERFACE WITH ARDUINO

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 21


Automation And Robotics (20EC53I)

Theory: Current sensors are critical components for monitoring electrical current in circuits,
enabling users to measure the flow of electricity accurately. These sensors typically output an
analog signal that correlates with the current passing through a conductor. By connecting the
current sensor to an Arduino, users can read the current values through the analog input pins,
allowing for real-time monitoring and data logging. This capability is essential in various
applications, including power management systems, battery monitoring, and load monitoring in
electrical appliances. The system can be designed to trigger alerts or actions based on specific
current thresholds, enhancing safety and efficiency in electrical systems.

Code
const int sensor = A0;
void setup( )
{
Serial.begin(9600);
}
void loop( )
{
int temp = analogRead(senor);
Serial.print("data:");
Serial.println(temp);
delay(1500);
}

Result
The implementation of a current sensor interface using an Arduino is done and verified,
successfully demonstrating accurate current measurements based on the sensor's output.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 22


Automation And Robotics (20EC53I)

9. Voltage sensor interface with Arduino

Aim:To interface a voltage sensor with an Arduino for measuring voltage levels,
enabling real-time monitoring and feedback through an LED indicator.

Components Required

 Arduino Board (e.g., Arduino Uno)


 Voltage Sensor Module
 12V 2A Power Supply
 USB Cable for Programming
 Jumper Wires (3-line/4-line connector)
 LED
 Resistor (220Ω - 330Ω)

Procedure
 Follow the code section
 Power on the kit by using 12v 2A adaptor.
 Connect the programmer USB cable to kit and PC.
 Kit connection:
 Use 3-line, 4-line connector; connect the connector head to voltage sensor module of pin
header [signal, VCC, GND].
 Connect the VCC pin to 5v power supply section.
 Connect the GND pin to GND power supply section.
 Connect the signal pin to GPIO A0 of Arduino PIN.
 Load the program to Kit.

INTERFACE WITH ARDUINO

VCC VCC
GND GND
A0 A_out

Arduino Voltage
Sensor

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 23


Automation And Robotics (20EC53I)

Theory : The sound sensor module is designed to detect sound levels in the environment and is
useful in various applications, including sound level monitoring and voice-activated systems. The
module typically features a microphone that converts sound waves into an electrical signal. This
signal is processed to determine sound intensity, which can be read as a digital output or an
analog voltage by the Arduino. By connecting the sound sensor to the Arduino, users can create
systems that respond to sound levels, such as activating alarms or controlling devices based on
noise detection. The ability to monitor sound in real time makes this sensor valuable for
applications in home automation, security systems, and environmental monitoring.

Code

const int sensor = A0;


void setup( )
{
Serial.begin(9600);
}
Void loop( )
{
int temp = analogRead(senor);
Serial.print("data:");
Serial.println(temp);
delay(1500);
}

Result:

The implementation of a voltage sensor interface using an Arduino has been completed and verified,
successfully demonstrating accurate voltage measurements based on the sensor's output, with real-time
feedback provided through the LED indicator.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 24


Automation And Robotics (20EC53I)

10. Proximity sensor interface with led using Arduino

Aim: To interface a proximity sensor with an Arduino to detect the presence of objects and control an
LED based on the sensor's output, facilitating applications in automation and remote sensin g.

Components Required.

 Arduino Board (e.g., Arduino Uno)


 Proximity Sensor Module
 12V 2A Power Supply
 USB Cable for Programming
 Jumper Wires (3-line/4-line connector)
 LED
 Resistor (220Ω - 330Ω)

Procedure

 Follow the code section mentioned below to make sure the code doesn’t have error at
compilation.

 Power on the kit by using 12V 2A adaptor.

 Connect the programmer USB cable to kit and PC.

 Kit connection.

 Use 3-line, 4-line connector, connect the connector head to proximity sensor module of
pin header [signal, VCC, GND].

 Connect the VCC pin to 5V power supply section & GND pin to GND power supply
section.

 Connect the signal pin to GPIO of 8 Arduino PIN.

 Connect the LED pin to GPIO of 10 Arduino PIN.


 Load the program to Kit.

Theory : Proximity sensors are devices used to detect the presence of nearby objects without
physical contact. They are widely utilized in automation, robotics, and safety applications. One
common type of proximity sensor is the ultrasonic sensor, which emits sound waves at a

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 25


Automation And Robotics (20EC53I)
frequency higher than the audible range to measure distance. The sensor emits a pulse and listens
for the echo that returns after bouncing off an object. The time it takes for the echo to return is
used to calculate the distance to the object based on the speed of sound.

INTERFACE WITH ARDUINO

VCC VCC
GND GND
8 SIG

Arduino Proximity
Sensor

10

LED
Gnd

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 26


Automation And Robotics (20EC53I)
Code

const int sensor = 8;

const int LED = 9;

void setup() {

Serial.begin(9600);
pinMode(sensor,INPUT);
}
voidloop(){
int temp=digitalRead(sensor);
if(temp ==HIGH)
{
Serial.println("metal object found");
digitalWrite(LED, HIGH);
delay(1500);
}
else
{
digitalWrite(LED, LOW);
delay(1500);
}
}

Result:

The implementation of a proximity sensor interface using an Arduino has been completed and
verified.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 27


Automation And Robotics (20EC53I)
11. Relay interface with Arduino

Aim :To develop a system that interfaces a relay with an Arduino, enabling control of high-
voltage devices through low-voltage signals for automation and control applications.

Appartus Required
 Arduino Board (e.g., Arduino Uno)

 Relay Module (with 2-line connector)

 12V 2A Power Adapter


 USB Programmer Cable

Procedure

 Follow the code section mentioned below to make sure the code doesn’t have error at
compilation.
 Power on the kit by using 12V 2A adaptor.
 Connect the programmer USB cable to kit and PC.
 Kit connection.
 Use 2-line connector, connect the connector head to relay module of pin header [signal,
VCC, SIG].
 Connect the VCC pin to 5V power supply section.
 Connect the GND pin to GND power supply section.
 Connect the signal pin to GPIO of 8 Arduino PIN.
 Connect motor terminal to relay output.
 Load the program to Kit.

Theory :

A relay typically consists of an electromagnet, a movable armature, and a set of contacts. When a
current flows through the electromagnet, it generates a magnetic field that pulls the armature,
closing or opening the contacts. This action allows the relay to control a high-voltage circuit
based on the input from the Arduino.A relay module usually includes three main pins: VCC, GND,
and a signal pin. The VCC pin connects to the power supply (typically 5V), while the GND pin is
connected to the ground. The signal pin is connected to a GPIO pin on the Arduino. By sending a
HIGH signal to the relay's signal pin, the Arduino activates the relay, allowing current to flow
through the connected load.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 28


Automation And Robotics (20EC53I)

Block Diagram

Code

const int relay = 8;

void setup( )

Serial.begin(9600);
pinMode(relay,OUTPUT);
}
void loop( )
{
digitalWrite(relay, HIGH);
delay(3500);
digitalWrite(relay, LOW);
delay(3500);
}

Result:The relay was successfully verified to activate and deactivate the connected load as per
the Arduino control signals.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 29


Automation And Robotics (20EC53I)

12. Motor control using Relay interface with Arduino

Aim : To develop a motor control system using a relay interface with an Arduino, allowing for
the automation of motor operations in various applications, such as robotics and home
automation.

Appartus Required
 Arduino Board (e.g., Arduino Uno)

 Relay Module (with 2-line connector),Motor

 12V 2A Power Adapter

 USB Programmer Cable

Procedure
Follow the code section mentioned below to make sure the code doesn’t have error at
compilation.Power on the kit by using 12V 2A adaptor.
Connect the programmer USB cable to kit and PC.
Kit connection.
Use 2-line connector, connect the connector head to relay module of pin header [signal, VCC,
SIG].
Connect the signal pin to GPIO of 8 Arduino PIN.
Load the program to Kit

INTERFACE WITH ARDUINO

VCC VCC
GND GND
8 SIG

Arduino Relay

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 30


Automation And Robotics (20EC53I)

Theory :The motor control system using a relay and Arduino leverages the ability of relays to
control high-power devices like motors with low-power signals from the microcontroller. A relay
acts as an electrically operated switch that can open or close a circuit, enabling or disabling the
flow of electricity to the motor. The Arduino sends a signal to the relay module's signal pin,
activating or deactivating the relay based on the programmed conditions. This setup typically
involves connecting the relay's VCC and GND pins to the Arduino's power supply, ensuring

MOTOR
proper operation. The use of relays is crucial for isolating the Arduino from high voltage, thereby
protecting the microcontroller while still allowing it to control the motor. By programming the
Arduino to toggle the relay, the motor can be turned on or off based on user-defined conditions or
inputs, facilitating automated processes in various applications.

Code

const int relay = 8;

void setup( )

Serial.begin(9600);
pinMode(relay,OUTPUT);
}
void loop( )
{
digitalWrite(relay, HIGH);
delay(3500);
digitalWrite(relay, LOW);
delay(3500);
}

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 31


Automation And Robotics (20EC53I)

Result: The motor successfully operates via relay control when activated by the Arduino.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 32


Automation And Robotics (20EC53I)

13. Servo motor using Arduino controller kit


Aim:To develop a system that accurately controls the position of a servo motor using an Arduino,
addressing the need for precise movement in applications such as robotics and automation, while
ensuring the reliability of communication and control through PWM signals.

Components Required
Arduino Board
Servo Motor
12V 2A Power Supply
USB Cable for Programming
Jumper Wires (3-line connector)

Procedure
 Follow the code section mentioned below makes sure the code doesn't have error at
compilation
 Power on the kit by using 12v 2A adaptor
 Connect the programmer USB cable to kit and PC
 Kit connection
 Use 3-line connector, connect the connector head to servo module of pin header [5v, PWM,
GND]
 Connect the 5v pin to 5v power supply section
 Connect the GND pin to GND power supply section
 Connect the PWM pin to PWM of Arduino pin No 9
 Done with connections
 Load the program to Kit
 Open the serial monitor in ARDUINO IDE

Block Diagram

VCC VCC
GND GND
IO9 PWM

Arduino SERVO
MOTOR

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 33


Automation And Robotics (20EC53I)

Theory : Servo motors are crucial components in applications that require precise control over
angular positioning, such as robotics and automation. Unlike standard DC motors, servos include
built-in feedback mechanisms that ensure accurate positioning. The motor typically connects to
the Arduino via a power supply (VCC), a ground (GND), and a PWM (Pulse Width Modulation)
pin, which receives the control signal from the Arduino. The duration of the PWM signal dictates
the position of the servo arm, allowing for a range of movement, often between 0° and 180°. The
operation of a servo motor involves the Arduino sending a PWM signal, which the servo
interprets to adjust its position accordingly. This feedback system allows for precise movements,
making servo motors ideal for tasks such as controlling robotic arms or camera gimbals, where
accuracy is paramount.

Code section
#include<Servo.h>
Servo myservo;
int i=0;

void setup( )
{
myservo.attach(9);
}

void loop( )
{

for( i=0; i<90; i++)


{
myservo.Write(i);
}

for(i=90; i>0 ;i--)


{
myservo.Write(i);
}
}

Result: The implementation of a servo motor control system using an Arduino is done and
verified, successfully demonstrating accurate position control of the servo motor based on PWM
signals.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 34


Automation And Robotics (20EC53I)
14. DC MOTOR interface using trainer kit

Aim: To develop a system that accurately controls the speed and direction of a DC motor using
an Arduino, addressing the need for reliable motor control in various automation and robotics
applications.

Components Required

1. Arduino Board
2. DC Motor
3. 12V 2A Power Supply
4. USB Cable for Programming
5. Jumper Wires (5-line connector)
6. Motor Driver Module (if applicable)

Procedure

 Follow the code section mentioned bellow make sure the code doesn’t have error
at compilation
 Power on the kit by using 12v 2A adaptor

 Connect the programmer USB cable to kit and PC


 Kit connection

 Use 5-line connector, connect the connector head to dc module


ofpinheader[v+,IN1,IN2]
 Connect the v+p into 5v power supply section
 Connect the IN1,IN2 pin to pin no.8,9 of Arduino

 Done with connections

 Load the program to Kit

 Observe the output

Theory : DC motors play a vital role in converting electrical energy into mechanical energy,
facilitating rotational motion through electromagnetic principles. They are widely used in various
mechanical systems and applications, including fans and robotics. The DC motor connects to the
Arduino via a power supply (V+) and control pins (IN1 and IN2), which dictate the motor's
rotational direction. By setting these pins high or low, the Arduino can reverse the motor's
direction. Additionally, the speed of the motor can be controlled using PWM signals; by varying
the duty cycle, the average voltage supplied to the motor is adjusted, enabling precise speed
Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 35
Automation And Robotics (20EC53I)
control. This versatility allows DC motors to be employed in numerous applications requiring
reliable motor control, making them essential components in automation and robotics.

Block Diagram

VCC
VCC
GND
GND
IO8
IN1I
IO9
N2
Arduino L293DDR
IVER

MOTOROUT

DC MOTOR
Code Section:
const int IN1 = 8;

const int IN2 = 9;

void setup( )

pinMode(IN1, OUTPUT);

pinMode(IN2, OUTPUT);

void loop( )

digitalWrite(IN1, HIGH);

digitalWrite(IN2, LOW);

delay(1500); }

Result: The implementation of a DC motor control system using an Arduino is done and
verified, successfully demonstrating control of the motor’s direction and speed based on
input signals.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 36


Automation And Robotics (20EC53I)
15. Stepper Motor Interface Using Trainer Kit

Aim: To develop a system that accurately controls the position and rotation of a stepper motor
using an Arduino, addressing the need for precise control in applications such as 3D printing and
robotics.

Components Required

 Arduino Board
 Stepper Motor
 12V 2A Power Supply
 USB Cable for Programming
 Jumper Wires (8-line connector)
 Motor Driver Module (if applicable)

Procedure

 Follow the code section mentioned bellow make sure the code doesn’t have error
at compilation
 Power on the kit by using 12v 2A adaptor
 Connect the programmer USB cable to kit and PC
 Kit connection
Use 8 lineconnector, connect the connector head to stepper module
of pinheader[ST1,ST2,ST3,ST4]
Connect the ST1,ST2,ST3,ST4 pin to pin no.8,9,10,11 of Arduino
 Load the program to Kit
 Observe the output

Theory : Stepper motors are specialized devices that move in discrete steps, providing high
precision in positioning and control, making them ideal for applications such as CNC machines
and 3D printers. They typically have multiple coils that must be energized in a specific sequence
to achieve rotation. Each pulse sent to the motor advances it by a fixed angle, allowing for
accurate control of its position. Stepper motors require a power supply that may exceed that of
standard components, often ranging from 5V to 12V. The precise control offered by stepper
motors is essential in tasks requiring repeatability and accuracy, as they can be programmed to
move to specific positions reliably. This capability makes stepper motors invaluable in
automation, robotics, and any application where controlled movement is necessary.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 37


Automation And Robotics (20EC53I)
Block Diagram

Code Section.
#include<Stepper.h>
const int stepsPerRevolution = 50; //change this to fit the no of steps perrevolution
SteppermyStepper(stepsPerRevolution,8,9,10,11);
void setup( ){
myStepper.setSpeed(60); // set the speed at 60 rpm:
Serial.begin(9600);//initializetheserialport:
}

void loop( ){
// step one revolutionin one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);
// step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}

Result: The implementation of a stepper motor control system using an Arduino is done and
verified, successfully demonstrating precise control over the motor's position and rotation based
on input signals.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 38


Automation And Robotics (20EC53I)

16. Seven Segment Display


Aim: To interface a 7-segment display with an Arduino to display numerical values

Components Required

 Arduino Board (e.g., Arduino Uno)


 7-Segment Display (common anode or common cathode)
 Resistors (220Ω or 330Ω for each segment)
 Breadboard (optional)
 Connecting Wires
 USB Cable (for programming the Arduino)
 Power Supply (if needed)

Procedure

1. Connect the segments of the 7-segment display to the Arduino pins using resistors.
2. If using a common cathode display, connect the common pin to GND. For a common
anode display, connect the common pin to VCC (5V).
3. Example pin connections for a common anode display:
1. Segment A to Arduino pin 2
2. Segment B to Arduino pin 3
3. Segment C to Arduino pin 4
4. Segment D to Arduino pin 5
5. Segment E to Arduino pin 6
6. Segment F to Arduino pin 7
7. Segment G to Arduino pin 8
8. Decimal Point (optional) to Arduino pin 9

Block diagram

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 39


Automation And Robotics (20EC53I)

Theory : A 7-segment display is an electronic component used to display decimal numbers and
some letters through the illumination of its seven individual segments. Each segment is typically
an LED that can be turned on or off to form various digits and characters. These displays come in
two main types: common cathode, where all segments share a ground connection, and common
anode, where they share a positive voltage. When specific segments are activated, they combine
to create numbers like 0-9, making 7-segment displays ideal for applications in digital clocks,
measurement devices, and counters due to their simplicity and clarity.

Code Section:

const int A=2;


const int B=3;
const int C=4;
const int D=5;
const int E=6;
const int F=7;
const int G=8;
void setup( )
{
pinMode(A,OUTPUT);
pinMode(B,OUTPUT);
pinMode(C,OUTPUT);
pinMode(D,OUTPUT);
pinMode(E,OUTPUT);
pinMode(F,OUTPUT);
pinMode(G,OUTPUT);
}
void loop( )
{
digitalWrite(A,1);
digitalWrite(B,1);
digitalWrite(C,1);
digitalWrite(D,1);
digitalWrite(E,0);
digitalWrite(F,1);
digitalWrite(G,1);
Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 40
Automation And Robotics (20EC53I)
delay(1000);

digitalWrite(A,1);
digitalWrite(B,0);
digitalWrite(C,1);
digitalWrite(D,1);
digitalWrite(E,1);
digitalWrite(F,1);
digitalWrite(G,1);
delay(1000);
}

Result: The 7-segment display successfully illuminated the numbers, demonstrating proper
functionality and accurate representation of decimal digits, confirming successful interfacing with
the Arduino.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 41


Automation And Robotics (20EC53I)
17. Bluetooth Interface With Arduino

Aim: To develop a Bluetooth communication interface using an Arduino, enabling wireless data
transmission and control between the Arduino and a smartphone, addressing the need for remote
monitoring and control in various applications.

Components Required

 Arduino Board
 Bluetooth Module (e.g., HC-05)
 12V 2A Power Supply
 USB Cable for Programming
 Jumper Wires (4-line connector)

Procedure

 Follow the code section mentioned below; make sure the code doesn’t have error at
compilation.
 Power on the kit by using 12v 2A adaptor.
 Connect the programmer USB cable to kit and PC.
 Kit connection:
1. Use 4-line connector; connect the connector head to BLUETOOTH module of pin
header [STATE, RXD, TXD, GND, VCC, EN].
2. Connect the VCC pin to 5v power supply section.
3. Connect the GND pin to GND power supply section.
4. Connect the RXD pin to pin no. 1 (TX) of Arduino.
5. Connect the TXD pin to pin no. 0 (RX) of Arduino.
6. Done with connections.

Tricolor LED:

1. Connect the red pin of the tricolor LED to pin No. 2 of the Arduino.
2. Connect the green pin of the tricolor LED to pin No. 3 of the Arduino.
3. Connect the blue pin of the tricolor LED to pin No. 4 of the Arduino.
4. Connect the common cathode or anode of the LED to the power.
5. Load the program to Kit:
o NOTE: While loading the program to kit, REMOVE the connection pin 0, 1 in
Arduino. After uploading, connect it to the same pin no.
6. Pair the BLUETOOTH device HC-05 to smartphone (password: 1234).
7. Open the application, select the HC-05 device, click on connect.
8. Now live data is streamed to smartphone.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 42


Automation And Robotics (20EC53I)
Block Diagram

VCC VCC
GND GND
Rx0 Tx
Tx 1 Rx
Red 2
blue 3 HC05
Green 4 Arduino
RGB

Theory: The Bluetooth module (such as the HC-05) facilitates wireless communication between
the Arduino and other Bluetooth-enabled devices, such as smartphones. This interface allows for
remote data transmission and control, which is particularly useful in applications requiring
mobility or distance from the control unit. The HC-05 module operates using a serial
communication protocol, connecting to the Arduino through designated pins for power (VCC),
ground (GND), and data transmission (RX and TX). Users can create applications that allow them
to send commands or receive data wirelessly, enhancing user interaction with their projects. By
pairing the Bluetooth module with a smartphone app, users can monitor and control their Arduino
projects in real time, expanding the capabilities of their systems and making them more versatile
in various applications, including home automation and remote monitoring.

Code section
#include<SoftwareSerial.h>

SoftwareSerial mybluetooth (0, 1);

const int red=2;

Const int green = 3;

const int blue = 4;

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 43


Automation And Robotics (20EC53I)
void setup( ){

pinMode (2, OUTPUT);

pinMode (3, OUTPUT);

pinMode (4, OUTPUT);

mybluetooth. begin(9600);

void loop ( ) {

if (mybluetooth.available( )) {

char x = mybluetooth.read( );

if (x =='R'){

digitalWrite(2, 1);

digitalWrite (3,0);

digital Write (4,0);

else if (x == 'G')

digitalWrite (2,0);

digitalWrite (3,1);

digitalWrite (4.0);

else if (x == 'B'){

digitalWrite (2,0);

digital Write (3,0),

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 44


Automation And Robotics (20EC53I)
digital Write (4, 1); }

else

digitalWrite (2,0);

digital Write (3,0),

digital Write (4,0);

Result:

The implementation of a current sensor interface using an Arduino is done and verified,
successfully demonstrating accurate current measurements based on the sensor's output.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 45


Automation And Robotics (20EC53I)
18. Count number of students in classroom

Aim: To Count number of students in classroom.

Apparatus Required

 Arduino Board (e.g., Arduino Uno)


 IR Module (Infrared sensor)
 LCD Module (e.g., 16x2 LCD)
 PIR Module (Passive Infrared sensor)
 Buzzer Module
 LED Module (with appropriate resistors)
 12V 2A Power Adapter
 USB Programmer Cable (for connecting Arduino to PC)
 Connecting Wires (jumper wires)
 Breadboard (optional, for circuit assembly)
 Computer (for programming the Arduino)

Procedure
 Follow the code section mentioned below to make sure the code doesn’t have error at
compilation.

 Power on the kit by using 12V 2A adaptor.

 Connect the programmer USB cable to kit and PC.


 Kit connection.

 Use 3-line connector, connect the connector head to IR module of pin header [signal,
VCC, SIG].
 Connect the VCC pin to 5V power supply section.

 Connect the GND pin to GND power supply section.

 Connect the signal pin to GPIO of 8 Arduino PIN.

 Use 3-line connector, connect the connector head to LCD module of pin header [RS, VCC,
EN].

 Connect the VCC pin to 5V power supply section.

 Connect the RS pin to GPIO of 14 Arduino PIN.


 Connect the EN pin to GPIO of 15 Arduino PIN.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 46


Automation And Robotics (20EC53I)
 Use 8-line connector, connect the connector head to LCD module of pin header [D4, D5,
D6, D7].

 Connect the D4 pin to GPIO of 16 Arduino PIN.

 Connect the D5 pin to GPIO of 17 Arduino PIN.

 Connect the D6 pin to GPIO of 18 Arduino PIN.

 Connect the D7 pin to GPIO of 19 Arduino PIN.


 Use 3-line connector, connect the connector head to PIR module of pin header [GND,
VCC, SIG].

 Connect the VCC pin to 5V power supply section.

 Connect the GND pin to GND power supply section.

 Connect the SIG pin to GPIO of 10 Arduino PIN.

 Use 2-line connector, connect the connector head to buzzer module of pin header [VCC,
SIG].
 Connect the VCC pin to 5V power supply section.

 Connect the GND pin to GND power supply section.

 Connect the SIG pin to GPIO of 11 Arduino PIN.

 Use 8-line connector, connect the connector head to LED module of pin header.
 Connect the SIG pin to GPIO of 7 Arduino PIN.

 Load the program to Kit.

INTERFACE WITH ARDUINO

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 47


Automation And Robotics (20EC53I)

Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(14, 15, 16, 17, 18, 19);
const int LED = 7;
const int buzzer = 11;
const int in1 = 8; // IR sensor
const int pir = 10; // PIR sensor
int entryCount = 0;
void setup()
{
lcd.begin(16, 2);
pinMode(LED, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(in1, INPUT);
pinMode(pir, INPUT);
}
void loop()
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Count: ");
lcd.print(entryCount);
int x=digitalRead(in1);
// Check if someone enters using the IR sensor
if (x == HIGH)
{
entryCount= entryCount+1 ;
digitalWrite(buzzer, HIGH); // Activate buzzer
delay(500);
digitalWrite(buzzer, LOW);
}
// Check if the PIR sensor detects motion

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 48


Automation And Robotics (20EC53I)
if (digitalRead(pir) == HIGH)
{
digitalWrite(LED, HIGH); // Turn on LED
}
else
{
digitalWrite(LED, LOW); // Turn off LED
}
}

Result

The system successfully counts the number of students entering the classroom, with the LCD
displaying the count, the buzzer sounding upon entry, and the LED lighting up when motion is
detected.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 49


Automation And Robotics (20EC53I)
19. Street light controller using LDR

Aim: To develop a street light controller using a Light Dependent Resistor (LDR) and an
Arduino, enabling automatic control of street lighting based on ambient light levels.

Components Required

 Arduino Board (e.g., Arduino Uno)

 Light Dependent Resistor (LDR)

 12V 2A Power Supply


 USB Cable for Programming

 Jumper Wires (8-line and 2-line connectors)

 LED Module (8-bit LED)

 Buzzer Module

Procedure

 Follow the code section mentioned below to make sure the code doesn’t have error at
compilation.

 Power on the kit by using 12V 2A adaptor.

 Kit connection.

 Use 8-line connector, connect the connector head to LED module of pin header [8-bit
LED].

 Connect the LED pin to GPIO of 10 Arduino PIN.

 Use 2-line connector, connect the connector head to buzzer module of pin header [VCC,
SIG].

 Connect the VCC pin to 5V power supply section.


 Connect the GND pin to GND power supply section.

 Connect the SIG pin to GPIO of A0 Arduino PIN.

 Load the program to Kit.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 50


Automation And Robotics (20EC53I)
Block Diagram

Code Section

const int LDR = A0;

cons tint LED = 10;

int temp=0;
voidsetup()
{
Serial.begin(9600);
pinMode(LED,OUTPUT);
}
voidloop()
{
temp = analogRead(LDR);
Serial.print("INTENSITY:");Seri
al.println(temp);
if(temp<= 500)
{
digitalWrite(LED, HIGH);
delay(2000);
}
else
{
digitalWrite(LED, LOW);
Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 51
Automation And Robotics (20EC53I)
delay(2000);
}
}

Result
The implementation of a street light controller using an LDR and Arduino has been completed
and verified, successfully demonstrating automatic activation and deactivation of street lights
based on ambient light conditions, with sound feedback from the buzzer.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 52


Automation And Robotics (20EC53I)

20. Parking system to identify the available slots


Aim: To develop a parking system using an Arduino that identifies available parking slots
through infrared (IR) sensors, providing visual and textual feedback on an LED module and LCD
display.

Components Required

1. Arduino Board (e.g., Arduino Uno)


2. Infrared (IR) Sensor Module
3. 12V 2A Power Supply
4. USB Cable for Programming
5. Jumper Wires (8-line and 3-line connectors)
6. LED Module (8-bit LED)
7. LCD Module (compatible with Arduino)

Procedure
 Follow the code section mentioned below to make sure the code doesn’t have error at
compilation.

 Power on the kit by using 12V 2A adaptor.

 Connect the programmer USB cable to kit and PC.

 Kit connection.
 Use 8-line connector, connect the connector head to LED module of pin header [8 BIT
LED].

 Connect the LED pin to pin no. 3 of Arduino.

 Use 3-line connector, connect the connector head to IR module of pin header [GND, VCC,
SIG].

 Connect the VCC pin to 5V power supply section.

 Connect the GND pin to GND power supply section.

 Connect the SIG pin to GPIO of 4 Arduino PIN.

 Use 3-line connector, connect the connector head to LCD module of pin header [RS, VCC,
EN].

 Connect the VCC pin to 5V power supply section.


 Connect the RS pin to GPIO of 14 Arduino PIN.

 Connect the EN pin to GPIO of 15 Arduino PIN.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 53


Automation And Robotics (20EC53I)
 Use 8-line connector, connect the connector head to LCD module of pin header [D4, D5,
D6, D7].

 Connect the D4 pin to GPIO of 16 Arduino PIN.

 Connect the D5 pin to GPIO of 17 Arduino PIN.

 Connect the D6 pin to GPIO of 18 Arduino PIN.

 Connect the D7 pin to GPIO of 19 Arduino PIN.


 Load the program to Kit.

INTERFACE WITH ARDUINO

Code:

#include<LiquidCrystal.h>

LiquidCrystal lcd(14,15,16,17,18,19);

const int slot1 = 4;


const int slot1_in = 3;
int count=3;
voidsetup( )
{

Serial.begin(9600);
lcd.begin(16, 2);
pinMode(slot1, OUTPUT);

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 54


Automation And Robotics (20EC53I)
pinMode(slot1_in,INPUT);

}
voidloop( )
{
lcd.setCursor(0,0);
lcd.print("P1:RP2:RP3:R");
if(digitalRead(slot1_in)==LOW)

{
lcd.setCursor(0,1);
lcd.print("P4:R");
lcd.print(" TP:4");
digitalWrite(slot1,HIGH);
}
else
{
lcd.setCursor(0,1);
lcd.print("P4:G");
lcd.print(" TP:3");
digitalWrite(slot1,LOW);
}
delay(2000);
}

Result

The implementation of a parking system to identify available slots using an IR sensor and
Arduino has been completed and verified, successfully demonstrating the detection of parking
space occupancy. The system provides real-time visual feedback through an LED module and
displays availability status on the LCD.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 55


Automation And Robotics (20EC53I)
21. Home automation using sensor

Aim: To implement a home automation system using an Arduino that integrates multiple
sensors, enabling automated control of devices based on temperature and motion detection,
with real-time feedback displayed on an LCD.

Components Required

 Arduino Board (e.g., Arduino Uno)


 LM35 Temperature Sensor
 PIR Motion Sensor
 12V 2A Power Supply
 USB Cable for Programming
 Jumper Wires (various connectors)
 LED Module (8-bit LED)
 LCD Module (compatible with Arduino)
 DC Motor Module

Procedure

 Follow the code section mentioned below to make sure the code doesn’t have error at
compilation.
 Power on the kit by using 12V 2A adaptor.
 Connect the programmer USB cable to kit and PC.
 Kit connection.
 Use 8-line connector, connect the connector head to LED module of pin header [8 BIT
LED].
 Connect the LED pin to pin no. 2, 3 of Arduino.
 Use 2-line connector, connect the connector head to LM35 temperature sensor module of
pin header [LM35, OUT].
 Connect the LM35 pin to 5V power supply section.
 Connect the OUT pin to pin no. A0 of Arduino.
 Done with connections.
 Use 3-line connector, connect the connector head to PIR module of pin header [GND,
VCC, SIG].
 Connect the VCC pin to 5V power supply section.
 Connect the GND pin to GND power supply section.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 56


Automation And Robotics (20EC53I)
 Connect the SIG pin to GPIO of 10 Arduino PIN.
 Use 5-line connector, connect the connector head to DC module of pin header [V+, IN1,
IN2].
 Connect the V+ pin to 5V power supply section.
 Connect the IN1, IN2 pins to pin no. 8, 9 of Arduino.
 Use 3-line connector, connect the connector head to LCD module of pin header [RS, VCC,
EN].
 Connect the VCC pin to 5V power supply section.
 Connect the RS pin to GPIO of 14 Arduino PIN.
 Connect the EN pin to GPIO of 15 Arduino PIN.
 Use 8-line connector, connect the connector head to LCD module of pin header [D4, D5,
D6, D7].
 Connect the D4 pin to GPIO of 16 Arduino PIN.
 Connect the D5 pin to GPIO of 17 Arduino PIN.
 Connect the D6 pin to GPIO of 18 Arduino PIN.
 Connect the D7 pin to GPIO of 19 Arduino PIN.
 Load the program to Kit.

Block diagram

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 57


Automation And Robotics (20EC53I)
Code
#include <LiquidCrystal.h>
LiquidCrystal lcd(11,12,16,17,18,19);
const intm1=6;
const int m2 = 7;
const int m3 = 8;
const int PIR = 5;
constintlm35=A0;
void setup( )
{
Serial.begin(9600); //Change baud rate as required!
pinMode(m1,OUTPUT);
pinMode(m2,OUTPUT);
pinMode(m3,OUTPUT);
pinMode(PIR,INPUT);
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print("home automation");
delay(2000);

lcd.clear( );
}
void loop() {
float temp = 0;
int ppl=0;
temp = analogRead(lm35);
temp = temp/2.62;
lcd.setCursor(0,0);
lcd.print("temp=");
lcd.print(temp);
if(temp >= 30)
{
digitalWrite(m2, HIGH);
digitalWrite(m3,LOW);
}
else

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 58


Automation And Robotics (20EC53I)
{
digitalWrite(m2, LOW);
digitalWrite(m3,LOW);
}
ppl = digitalRead(PIR);
if(ppl ==HIGH)
{
digitalWrite(m1, HIGH);
lcd.setCursor(0,1);
lcd.print("Light on ");
delay(1500);
}
else
{
digitalWrite(m1, LOW);
lcd.setCursor(0,1);
lcd.print("Light off ");

delay(1500);
}
delay(1000);
}

Result: The implementation of a home automation system using sensors and Arduino has been
successfully completed and verified.

Mr.Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 59


Automation And Robotics (20EC53I)

22. Obstacle avoidance robot

Aim: To develop an obstacle avoidance robot using an Arduino and an ultrasonic sensor, enabling
the robot to navigate around obstacles autonomously.

Components Required

 Arduino Board (e.g., Arduino Uno)

 Ultrasonic Sensor (e.g., HC-SR04)

 DC Motors

 L293D Motor Driver Module


 12V 2A Power Supply

 USB Cable for Programming

 Jumper Wires

Procedure

 Follow the code section mentioned below to make sure the code doesn’t have error at
compilation.

 Power on the kit by using 12V 2A adaptor.

 Connect the programmer USB cable to kit and PC.

 Kit connection.

 Connect ultrasonic sensor to Arduino.

 Trigger pin to pin no. 4 of Arduino.

 Echo pin to pin no. 5 of Arduino.

 Connect the power supply to the sensor.

 Connect DC motors to L293D output pins M1, M2.

 Connect C1A, C1B to 8, 9 of Arduino.

 Connect C2A, C2B to 10, 11 of Arduino.

 Done with connections.

Mr. Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 60
Automation And Robotics (20EC53I)

 Load the program to Kit.

 Send the controlled data to robot.

 Observe the output.

Code Section

const int trigPin = 14;

const int echoPin = 15;

const int motorPin1 = 8;

const int motorPin2 = 9;

const int motorPin3 = 10;

const int motorPin4 = 11;

void setup() {

Serial.begin(9600);

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

pinMode(motorPin1, OUTPUT);

pinMode(motorPin2, OUTPUT);

pinMode(motorPin3, OUTPUT);

pinMode(motorPin4, OUTPUT);

void loop() {

long distance = measureDistance();

Mr. Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 61
Automation And Robotics (20EC53I)

Serial.print("Distance: ");

Serial.println(distance);

if (distance < 25)

stopMotors( );

Serial.println("Object Detected - Stopping");

} else {

// Example command to move forward

moveForward();

delay(500); // Small delay for stability

long measureDistance( )

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

return pulseIn(echoPin, HIGH) * 0.034 / 2; // Convert to cm

void moveForward( )

Mr. Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 62
Automation And Robotics (20EC53I)

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, HIGH);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, HIGH);

void stopMotors() {

digitalWrite(motorPin1, LOW);

digitalWrite(motorPin2, LOW);

digitalWrite(motorPin3, LOW);

digitalWrite(motorPin4, LOW);

Result: Obstacle avoidance system is implemented and verified.

Mr. Sucheth S and Mrs.Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 63
Automation And Robotics (20EC53I)

23.Line Folowing robot


Aim:To design and build a line follower robot that can detect and follow a line on the ground
using infrared sensors.

Components Required

 Arduino Uno
 IR Line Sensors (2 pcs)
 DC Motors (2 pcs)
 Motor Driver (L298N or similar)
 Chassis (robot body)
 Wheels (2 pcs)
 Caster Wheel (1 pc)
 Battery Pack (6V or suitable for motors)
 Jumper Wires
 Breadboard (optional)

Procedure

Chassis Assembly

 Assemble the chassis and attach the motors to it.


 Fix the wheels on the motors and the caster wheel at the front or back.

Sensor Setup

 Mount the IR sensors on the front of the robot, positioned to detect the line on
the ground.

Wiring Connections

 Connect the IR sensors:

o Left Sensor Output to Arduino Digital Pin 2.


o Right Sensor Output to Arduino Digital Pin 3.
 Connect the motor driver:

Mr. Sucheth S and Mrs. Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 64
Automation And Robotics (20EC53I)

o Motor A to Arduino Pins 4 (IN1) and 5 (IN2).


o Motor B to Arduino Pins 6 (IN3) and 7 (IN4).
 Power the motors from the battery pack, and connect the motor driver to the
Arduino for control.

Truth Table

Left Sensor Right Sensor Action Reason

LOW LOW Move Forward Both sensors on the black line (centered).

LOW HIGH Turn Right Left sensor on the line, right sensor off the line.

HIGH LOW Turn Left Right sensor on the line, left sensor off the line.

HIGH HIGH Stop or Reverse Both sensors off the line (lost the track).

Code:

const int leftSensor = 2;

const int rightSensor = 3;

const int motorA1 = 4;

const int motorA2 = 5;

const int motorB1 = 6;

const int motorB2 = 7;

void setup() {

pinMode(leftSensor, INPUT);

pinMode(rightSensor, INPUT);

pinMode(motorA1, OUTPUT);

Mr. Sucheth S and Mrs. Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 65
Automation And Robotics (20EC53I)

pinMode(motorA2, OUTPUT);

pinMode(motorB1, OUTPUT);

pinMode(motorB2, OUTPUT);

void loop( ) {

int leftValue = digitalRead(leftSensor);

int rightValue = digitalRead(rightSensor);

if ((leftValue == LOW) &&(rightValue == LOW)) // Both sensors on line

{ digitalWrite(motorA1, HIGH);

digitalWrite(motorA2, LOW);

digitalWrite(motorB1, HIGH);

digitalWrite(motorB2, LOW);

else if ((leftValue == LOW)&&(rightValue == HIGH) ) // Left sensor on line

digitalWrite(motorA1, HIGH);

digitalWrite(motorA2, LOW);

digitalWrite(motorB1, LOW);

digitalWrite(motorB2, LOW);

Mr. Sucheth S and Mrs. Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 66
Automation And Robotics (20EC53I)

else if((leftValue == HIGH)&&(rightValue == LOW)) // Right sensor on line

{ // Right sensor on line

digitalWrite(motorA1, LOW);

digitalWrite(motorA2, LOW);

digitalWrite(motorB1, HIGH);

digitalWrite(motorB2, LOW);

else { // Both sensors off line

digitalWrite(motorA1, LOW);

digitalWrite(motorA2, LOW);

digitalWrite(motorB1, LOW);

digitalWrite(motorB2, LOW); }

Resut: Upon uploading the code and powering the robot, it should be able to follow a
black line on a white surface. The robot will move forward when both sensors detect the
line and will turn accordingly when one sensor is off the line.

24.Stepper Motor Interface with Ardunio

Mr. Sucheth S and Mrs. Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 67
Automation And Robotics (20EC53I)

Aim:To control a stepper motor using an Arduino to demonstrate how to interface and control
stepper motors for precise movements.

Apparatus Required

 Arduino board (e.g., Arduino Uno)


 Stepper motor (e.g., NEMA 17)
 Stepper motor driver (e.g., A4988 or ULN2003)
 Power supply for the stepper motor
 Breadboard and jumper wires
 Resistor (if necessary for signal protection)
 External power source (if required for the motor)

Theory

A stepper motor divides a full rotation into a series of discrete steps, allowing for precise control
of position and speed. The Arduino can control the stepper motor's movements by sending a
series of pulses to the motor driver, which energizes the motor coils in a specific sequence. The
two common types of stepper motors are bipolar and unipolar, and the control method will vary
slightly based on the motor type and driver used.

Procedure

Wiring the Circuit:

 Connect the stepper motor to the motor driver according to the driver’s datasheet.
 Connect the motor driver to the Arduino:
 IN1, IN2, IN3, IN4 (or similar) pins to Arduino digital pins.
 Power and ground connections for the driver and motor.
 If using a bipolar motor, ensure to connect the coils correctly.
 Install the Required Libraries:
 Open the Arduino IDE and install the AccelStepper library for more advanced control.
 Programming the Arduino: Use the following sample code to control the stepper motor.

Mr. Sucheth S and Mrs. Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 68
Automation And Robotics (20EC53I)

Block Diagram

Code:

#include <Stepper.h>

// Define the number of steps per revolution for your motor

const int stepsPerRevolution = 200;

// Create an instance of the Stepper class

Stepper myStepper(stepsPerRevolution, 2, 3, 4, 5); // Pin configuration

void setup( ) {

// Set the speed of the motor (RPM)

myStepper.setSpeed(60); // Set speed to 60 RPM

void loop( ) {

Mr. Sucheth S and Mrs. Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 69
Automation And Robotics (20EC53I)

// Step the motor one revolution in one direction

myStepper.step(stepsPerRevolution);

delay(1000); // Wait for a second

// Step the motor one revolution in the opposite direction

myStepper.step(-stepsPerRevolution);

delay(1000); // Wait for a second

Result: Upon running the program, the stepper motor will rotate 200 steps in one direction and
then return to the starting position.

Mr. Sucheth S and Mrs. Shobharani H.N, Dept.of ECE, RPT (2024-25) Page 70

You might also like