Handout Activity Sheet Unit 4
Handout Activity Sheet Unit 4
Actuators
Pneumatic Actuators: - Pneumatic actuators are devices that convert the energy of compressed
air or gas into a mechanical motion that regulates one or more final control elements. Pneumatic
for simple motions.
Hydraulic Actuators:- Hydraulic actuator definition is, a device that is used to change the
fluid’s pressure energy into mechanical motion is known as a hydraulic actuator.
Electric Actuators:- Electric actuators are devices that convert electrical energy into mechanical
motion to perform a specific task. They are used in a wide range of applications, including
industrial automation, robotics, automotive systems, and household appliances. Electric
Actuators are most commonly used.
Figure 1: Electric Actuator
● Potentiometer is a variable resistor by varying the knob the resistance varies there by the
flow of current controlled in it.
Figure 5. Potentiometer
4.2.1 Sensors
A sensor is a device that measures physical input from its environment and converts it into data.
It is a device that converts signals from one energy domain to the electrical domain.
Humans have 5 main senses: touch, sight, hearing, smell and taste.
4.2.2 Active and Passive Sensor
An active sensor emits some form of energy, say light or sound, and measures the energy
reflected from the environment, similar to an ultrasound sensor.
A passive sensor measures the energy available in the surroundings. It does not emit a beam of
light or sound or other form of energy for making the measurements.
Example of Active Sensor : Radar (Radio Detection and Ranging) , Lidar ( Light Detection and
Ranging)
Example of passive sensor : PIR Sensor, IR Sensor.
The sensors can also be classified as Analog and Digital Sensors.
Analog Sensors produce an analog output i.e., a continuous output signal (usually voltage but
sometimes other quantities like Resistance etc.) with respect to the quantity being measured.
Figure 9. IR Sensor
It works by emitting infrared radiation and detecting the reflected or emitted radiation from objects
in its field of view. The detector converts the radiation into an electrical signal, which is processed
and compared to a threshold. If the signal is above the threshold, the sensor outputs a signal to
indicate the presence of an object. IR sensors are used in a variety of applications, including
automation, security systems, and remote controls.
4.2.4.1. Pinout
VCC: supplies power to the HC-SR04 ultrasonic sensor. You can connect it to the 5V output from your
Arduino.
Trig (Trigger): pin is used to trigger ultrasonic sound pulses. By setting this pin to HIGH for 10µs, the
sensor initiates an ultrasonic burst.
Echo: pin goes high when the ultrasonic burst is transmitted and remains high until the sensor receives an
echo, after which it goes low. By measuring the time the Echo pin stays high, the distance can be
calculated.
4.3.2. Operators
When using an “if” statement, the code in its body runs only when the if statement evaluates to
true. If it evaluates to false, program execution skips the code in the body of the if statement and
goes to statement the body of the if statement.
By adding an “else” statement, the code in the body of the else statement will run, but only when
its corresponding if statement evaluates to false.
Syntax of “if-else”
If (conditional expression) {
Body of the if statement when conditional expression is true
}
else {
Body of the else statement when conditional expression is false
}
Conditionals { if- else if}
if (conditional expression 1) {
Body of the if statement when conditional expression 1 is true
}
else if (conditional expression 2) {
Body of the else-if statement when conditional expression 1 is false and conditional expression 2
is true
}
else {
Body of the else statement when conditional expression 1 and 2 are both false
}
4.3.4. Realization of Digital Logic
Digital logic is the manipulation of binary values through printed circuit board technology that
uses circuits and logic gates to construct the implementation of computer operations.
Binary Numbers
A binary number is a number expressed in the base-2 numeral system or binary numeral system,
a method of mathematical expression which uses only two symbols: typically "0" (zero) and "1"
(one).
AND Gate
The AND gate is a basic digital logic gate that implements logical conjunction (∧)
from mathematical logic – AND gate behaves according to the truth table. A HIGH output (1)
results only if all the inputs to the AND gate are HIGH (1). If not all inputs to the AND gate are
HIGH, LOW output results.
Symbol:
Truth Table
A B Q=A.B
0 0 0
0 1 0
1 0 0
1 1 1
Circuit Diagram
0 0 0
0 1 1
1 0 1
1 1 1
Circuit Diagram
void setup() {
pinMode(LEDred, OUTPUT);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
}
void loop(){
buttonStatus1 = digitalRead(buttonPin1);
buttonStatus2 = digitalRead(buttonPin2);
// check if the either the first button is HIGH, OR the second button is HIGH, then turn on the
LED
// else turn the LED off
if (buttonStatus1 == HIGH || buttonStatus2 == HIGH )
{ digitalWrite(LEDred, HIGH);
} else { digitalWrite(LEDred, LOW);
}
}
NOT Gate
A NOT gate is a logic gate that inverts the digital input signal. For this reason, a NOT gate is
sometimes is referred to as an inverter.
Symbol
A X
0 1
1 0
Task3: Write the Arduino code and flowchart for interfacing of NOT Gate
Circuit diagram
int IRSensor = 9; // connect ir sensor module to Arduino pin 9
int LED = 13; // connect LED to Arduino pin 13
void setup()
{
Serial.begin(115200); // Init Serial at 115200 Baud
Serial.println("Serial Working"); // Test to check if serial is working or not
pinMode(IRSensor, INPUT); // IR Sensor pin INPUT
pinMode(LED, OUTPUT); // LED Pin Output
}
void loop()
{
int sensorStatus = digitalRead(IRSensor); // Set the GPIO as Input
if (sensorStatus == 1) // Check if the pin high or not
{
// if the pin is high turn off the onboard Led
digitalWrite(LED, LOW); // LED LOW
Serial.println("Object Detected!"); // print Motion Detected! on the serial monitor window
}
else
{
//else turn on the onboard LED
digitalWrite(LED, HIGH); // LED High
Serial.println("Object Not Detected!"); // print Motion Ended! on the serial monitor window
}
}
Task 5: Connection diagram and Coding for detecting object
void setup() {
pinMode(trigPin, OUTPUT); // set the trigger pin as an output
pinMode(echoPin, INPUT); // set the echo pin as an input
Serial.begin(9600); // set the baud rate of serial communication to 9600
}
void loop() {
digitalWrite(trigPin, LOW); // set the trigger pin low
delayMicroseconds(2); // wait for 2 microseconds
digitalWrite(trigPin, HIGH); // set the trigger pin high
delayMicroseconds(10); // wait for 10 microseconds
digitalWrite(trigPin, LOW); // set the trigger pin low again
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
Task 6 : Code “Break Down” for Servo motor interface with Arduino
#include <Servo.h> // Library used for Servo
servo.attach() // Declares the servo object and then initializes the servo
myservo.write() // Declare the amount of degree rotation required for Servo motor
#include <Servo.h>
Servo myservo;
void setup() {
myservo.attach(6);
}
void loop() {
myservo.write(90);
delay(1000);
myservo.write(0);
delay(1000);