Quiz Prep.
Quiz Prep.
Notes
prepared by
Prof. Rida Mir
Contents
• Introduction to Robotics
• Introduction to Arduino
• Clap Switch using sound sensor
• Door Opening System using IR sensor
Robotics
Robotics involves design, construction, operation, and use of robots that mimic
human acts. The goal of robotics is to design robots that can help and assist
humans.
Robot
It is an autonomous system which interacts with the physical world, and can sense,
think and act to achieve some goals
Sensor
A sensor is a device that detects or measures a physical quantity
For example : Infrared sensor (IR sensor)
It measures the distance to an object using reflected light waves
Computer
Robots can be programmed by computers. Computer gives the robot its intelligence
and ability to perform tasks.
Actuator
Actuators provide robots with mechanical movement. This movement is often
achieved by motors. Like turns of robot wheels and rotation of joints of robotic arm.
For example : Servo Motors
Energy
Energy is a vital component of robots. All sensors, computers and actuators need
energy to perform their functions. Energy can be obtained through batteries
Machines
A machine is any physical system with ordered structural and functional properties
that performs a predefined task repeatedly
Robots vs machines
Robots can response to changes in the environment , machines can’t.
For example :
• Conventional washing unit is a machine
• Smart inverter AC is a robot
Humanoid Robots
Humanoid robot is a robot resembling the human body in shape. Humanoid robots
are professional service robots built to mimic human motion and interaction.
For example : Sophia
Arduino
It is an open source electronic prototyping platform used to create interactive
electronic objects or robots. It is based on easy to use hardware and software
• Arduino board
• Arduino IDE
Arduino UNO
Arduino UNO is based on programmable microcontroller Atmega328P. It consists of
14 digital pins ( 0 to 13) and 6 analog pins ( A0 to A5) , a reset button, power jack,
USB connection and serial communication header. Voltage greater than 20V will
destroy Arduino.
Arduino IDE
Arduino software is open source integrated development environment used to write
code and upload it to arduino board. The IDE is a special program running on your
computer that allows you to write sketch for the Arduino board. Arduino IDE
consists of 2 functions , Setup() and loop()
Arduino Programming
A set of instructions is called a program. Programming is the process of creating a
set of instructions that commands a computer to perform a task. Programming can
be done using computer programming language C++.
Project 1 : Clap Switch
This is used to make the light ON through a clap sound but it can work through any
kind of same pitch sound
Working Principle
Clap switch uses a sound sensor as an input to detect the clap sound & generates
the output by processing the input into the circuit. Once clap sound is provided to
the Mic, then it gets Electrical Energy & turns ON LED. The main function of this
device is to change the energy of sound to electrical energy
Components Required
• Arduino UNO
• USB Cable
• Sound Sensor
• Breadboard
• LED
• 5 M-M jumper wires
Applications
The applications of clap switch circuits are useful in everyday work. A clap switch is
used to switch ON/OFF different electrical appliances like the following
• Fan
• Light
• TV
• Motor
• AC
Code :
const int ledpin=13; // led pin and sound pin are not changed throughout the
process
const int soundpin=A2;
const int threshold=200; // sets threshold for sound sensor
void setup() {
Serial.begin(9600);
pinMode(ledpin,OUTPUT);
pinMode(soundpin,INPUT);
}
void loop() {
int soundsens=analogRead(soundpin); // read analog data from sensor
if (soundsens>=threshold) {
digitalWrite(ledpin, HIGH); // turn led on
delay(5000); // wait for 5 seconds
}
else{
digitalWrite(ledpin, LOW);
}
}
Project 2 : Automatic door opening system
Automatic door system is used to open door when a person comes close to door
and closes the door as person moves away from it or enters it.
Working Principle
IR sensor is used to detect objects using infrared energy. The IR sensor is activated
when human body advances towards it and opens the door automatically. Infrared
sensor measure distance through reflected light waves
Applications
Automatic door opening system is used in houses. It also has some prominent
applications in following
• Commercial buildings
• Shopping malls
• Theatres
Components Required
• Arduino UNO
• USB Cable
• IR Sensor
• Breadboard
• LED
• 5 M-M jumper wires
Code :
int IRSensor = 3; // connect ir sensor to arduino pin 3
int LED = 13; // conect Led to arduino pin 13
void setup() {
pinMode(13,OUTPUT);
pinMode(3,INPUT);
Serial.begin(9600);
}
void loop() {
if (digitalRead(3)== HIGH)
{
digitalWrite(13,HIGH);
delay(10);
}
else
{
digitalWrite(13,LOW);
delay(10);
}
}