All Mte309 Practical Solution
All Mte309 Practical Solution
ii. To understand the design and working principles of a dual-output power supply unit.
iii. To construct and test a 5V and 12V power supply unit in a virtual environment.
iv. To verify the stability of the output voltages using simulation tools in Tinkercad.
Theoretical Background
A power supply unit converts AC voltage to stable DC voltage suitable for electronic devices. In
this practical:
1. Step-down Transformer Simulation: In real circuits, a transformer reduces AC voltage from the mains to
a lower level. Here, a 12V DC source simulates this step.
2. Bridge Rectifier: Four diodes arranged in a bridge configuration convert AC voltage into pulsating DC
voltage. This simulation uses four 1N4007 diodes.
3. Filtering: Capacitors smooth out the pulsating DC voltage, reducing ripples and providing more stable DC.
4. Voltage Regulators:
• 7805: Provides a stable 5V output.
• 7812: Provides a stable 12V output.
5. LED Indicators: Used to visually confirm that the outputs are active.
Procedure:
1. Setting Up Tinkercad:
• Start Simulation:
- I Clicked on "Start Simulation" to power the circuit.
• The multimeter to measures the voltages at the outputs of the 7805 and 7812 regulators.
Circuit Diagram
Observations:
I observed that:
I. The multimeter readings show a stable 5V and 12V at the respective outputs.
2. The LEDs light up, indicating that both outputs are active and functioning.
3. The capacitors effectively reduce ripples in the output voltage, providing stable DC power.
Precautions
Iii. I double-checked all connections before starting the simulation to avoid errors
iv. I Ensured correct orientation of diodes and polarized capacitors to prevent malfunction.
v. I Verified that the voltage regulators are connected properly, with the input, output, and ground pins correctly
assigned.
Vi I used appropriate resistor values for the LEDs to avoid excessive current flow that could damage them.
Conclusion:
The simulated power supply unit successfully provided stable 5V and 12V outputs. The bridge rectifier and
capacitors worked efficiently to rectify and filter the DC voltage, and the voltage regulators maintained
constant output levels. The simulation confirmed the functionality of the design and demonstrated the
importance of proper filtering and voltage regulation in power supply circuits.
Practical 2
Lab 2
Title: Interfacing the RGB LED with the Arduino
Aim:
To interface an RGB LED with an Arduino and control its colors using digital outputs.
Objective:
1. To understand how to use and program an RGB LED using an Arduino.
2. To learn how to create different colors by varying the intensity of red, green, and blue components.
3. To simulate and observe the functionality of an RGB LED in Tinkercad.
Theoretical background
There are actually two types of RGB LED’s; the common cathode one and the common anode one.
In the common cathode RGB led, the cathode of all the LED’s is common and we give PWM signals
to the anode of LED’s while in the common anode RGB led, the anode of all the LED’s is common
and we give PWM signals to the cathode of LED’s. Inside the RGB led, there are three more LED’s.
So, by changing the brightness of these LED’s, we can obtain many other colors. To change
brightness of RGB led, we can use the PWM pins of Arduino. The PWM pins will give signal
different duty cycles to the RGB led to obtain different colors.
Connection Diagram:
Procedures
1. I inserted the RGB LED into the breadboard and connected its cathode pin to the GND of the
Arduino.
2. I inserted the LED into the breadboard. And attached Red pin to pin 8, Green pin to pin 9 and
Blue pin to pin 10 of the Arduino via the 220-ohm resistor, and the negative leg to GND.
3. I uploaded the code as given
4. I observed the changes in the color of the RGB LED.
The Sketch
/************RGB LED Blink*******/
void setup() {
pinMode(8,OUTPUT);
Curated
by Otenaike A.B
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite (8,HIGH);
digitalWrite (10,LOW);
delay(1000);
digitalWrite (9,HIGH);digitalWrite (8,LOW);
delay(1000);
digitalWrite (10,HIGH);
digitalWrite (9,LOW);
delay(1000);
}
Observations
1. I observed that the sketch works by setting pinsD8, D9, D10 as for the different legs of RGB
LED.
2. I also observed that the run a loop continually reads the value from the pins and sends that value
as voltage to the LED.
3. I observed the voltage value is between 0–5 volts, and the blinking of the LED varies accordingly
Precautions
1. I ensured the correct orientation of the RGB LED pins to avoid incorrect connections.
2. I used appropriate resistors to prevent excessive current from damaging the LED.
3. I double-checked connections before starting the simulation to avoid short circuits or malfunctioning
components.
4. I verified that the code is correctly written and uploaded to the Arduino to ensure the expected behavior.
Conclusion
The simulation of interfacing an RGB LED with an Arduino on Tinkercad was successful. The Arduino code was
able to control the LED colors effectively, demonstrating how digital signals can create various color combinations.
This practical helped in understanding the principles of RGB LED operation and the use of PWM for color control.
Practical 3
Lab 6
Theoretical Background
A Servo Motor is a small device that has an output shaft. This shaft can be positioned to specific angular
positions by sending the servo a coded signal. As long as the coded signal exists on the input line, the servo
will maintain the angular position of the shaft. If the coded signal changes, the angular position of the shaft
changes. Servo motors have three terminals – power, ground, and signal. The power wire is typically red,
and should be connected to the 5V pin on the Arduino. The ground wire is typically black or brown as
shown below.
Specifications:
Connection Diagram:
Procedures
The Sketch
// C++ cod
#include<Servo.h>
Servo myServo;
int pos=0;
const int servoPin = 9;
void setup(){
myServo.attach(servoPin);
}
void loop(){
for(int i = 0; i<=180; i++){
myServo.write(i);
delay(10);
}
}
Observations
i. I observed that the servo motor moves from 0-180 degrees and back to 0 degrees
ii. I also observed that the movement is smooth and precise
iii. Also the servo motor can be controlled using the Arduino board
Observations Table
1 5V 180 rpm
2 6V 200 rpm
3 7V 220 rpm
4 8V 240 rpm
Conclusion
Interfacing a servo motor with Arduino is a simple and fun project that can be used in various applications
such as robotics, automation, and more. By following the procedures and using the code provided, I was
able to control a servo motor using Arduino.
Practical 4
Lab 8
Title: Interfacing of the Relay with Arduino.
Aims & Objectives
- To understand the basics of relays and their control using Arduino
- To learn how to interface a relay with Arduino
- To develop a simple project using Arduino and relay to control a high-voltage device
Theoretical Background :
Relay is an electromagnetic switch, which is controlled by small current, and used to switch
ON and OFF relatively much larger current. Means by applying small current we can
switch ON the relay which allows much larger current to flow.
Connection Diagram:
Procedures:
1. I started by switching on the system and login to my account on tinkercad.
2. I clicked on create new design and selected circuit.
3. I dragged and dropped the components (Arduino board, breadboard, resistor and the relay module) from
the components window to the workspace of the tinkercad.
4. The relay module connected with three pins. The black one of relay is usually the ground. I
connected this to the Arduino GND.
5. I connected the red wire of relay module to 5V of the Arduino.
6. I connected the signal pin of relay module to a digital pin 6 of the Arduino.
7. I wrote and simulated the code and observed the clicking sound of the relay that states the ON and OFF
constantly
Sketch:
Observations
I observed that:
i. the relay switches on and off when the digital signal from Arduino is high or low.
ii. the high voltage device turns on and off according to the relay switching.
Observations Table:
Precautions
i. I ensured I use a suitable power supply for the relay and high voltage device.
ii. I used a suitable current rating for the relay and high voltage device.
iii. I ensured proper insulation and isolation of high voltage devices.
Conclusion
Interfacing a relay with Arduino allows for control of high voltage devices using a low voltage digital signal.
This is a fundamental concept in automation and control systems. By following the procedures and
precautions outlined in this report, I was able to successfully interface a relay with Arduino and control a
high voltage device.
Practical 5
Lab 9
Title: Building Intrusion Detection System with Arduino and Ultrasonic Sensor
Aim & objectives
i. To design and build an intrusion detection system for buildings using Arduino and ultrasonic sensor
ii. To detect and alert the presence of an intruder in a building
iii. To learn about the applications of ultrasonic sensors and Arduino in security systems
Theoretical Background:
An intrusion detection system (IDS) is a device or software application that monitors a network or
systems for malicious activity
Ultrasonic Sensors: The HC-SR04 ultrasonic sensor uses SONAR to determine the distance of an
object just like the bats do. It offers excellent non-contact range detection with high accuracy and
stable readings in an easy- to-use package from 2 cm to 400 cm or 1” to 13 feet. It comes complete
with ultrasonic transmitter and receiver module. Th.Be time taken is used together with the normal
speed of sound in air (340ms-1) to determine the distance between the sensor and the obstacle. The
Ultrasonic sensor is used here for the intruder detection. The sound via a buzzer occurs when an
object comes near to the sensor. The distance to which the sensor will respond can be easily adjusted
in the program.
Precautions
1. I started by switching on the system and login to my account on tinkercad.
2. I clicked on create new design and selected circuit.
3. I dragged and dropped the components (Arduino board, breadboard, resistor buzzer and Ultrasonic
Sensor (HC-SR04) from the components window to the workspace of the tinkercad.
4. I inserted the Ultrasonic sensor into the breadboard and connected its Echo pin to the digital pin 2
and the Trigger pin to digital pin 3 of the Arduino.
5. I inserted the RED and Green LED into the breadboard. Attached the positive leg (the longer leg) of
red LED to signal pin of the Buzzer via the 220- ohm resistor, and the negative leg to GND. The
green LED is connected to digital pin 8 of the Arduino.
6. I wrote and simulated the code in the code editor.
7. I observed the LEDs and the buzzer as I moves the object in front of ultrasonic sensor.
8. I also observed the changes in the LED and buzzer sound.
Connection Diagram
The Sketch
// C++ code
#define echo 2
#define trig 3
#define ledRed 8
#define ledGreen 13
#define buzzer 4
float duration;
float distance;
const int intruderDistance = 150;
void setup(){
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
pinMode(ledRed, OUTPUT);
digitalWrite(ledRed, LOW);
pinMode(ledGreen, OUTPUT);
digitalWrite(ledGreen, LOW);
pinMode(buzzer, OUTPUT);
digitalWrite(buser, LOW);
Serial.begin(9600);
}
void loop(){
time_Measurement();
distance=(float)duration*(0.0343)/2;
Serial.println(distance);
alarm_condition();
}
void time_Measurement(){
digitalWrite(trig, LOW);
delayMicroseconds(10);
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
duration=pulseIn(echo, HIGH);
}
void alarm_condition(){
if(distance<=intruderDistance){
digitalWrite(ledRed, HIGH);
digitalWrite(ledGreen, LOW);
digitalWrite(buzzer, HIGH);
}
else{
digitalWrite(ledRed, LOW);
digitalWrite(ledGreen, HIGH);
digitalWrite(buser, LOW);
}
}
Observations
I observed that:
i. the system detects the presence of an intruder and triggers the alarm or buzzer.
ii. the system can be adjusted to detect intruders at a specific distance from the sensor.
iii. the system can be expanded to include multiple sensors and alarms for a larger building.
Observation Table:
Precautions
i. I ensured I use a suitable power supply for the Arduino and sensor.
ii. I ensured proper insulation and isolation of the sensor and alarm.
Conclusion
The Building Intrusion Detection System with Arduino and Ultrasonic Sensor is a simple and effective
security system for buildings. The system uses the ultrasonic sensor to detect the presence of an intruder
and triggers an alarm or buzzer to alert the authorities. This project demonstrates the application of ultrasonic
sensors and Arduino in security systems and can be expanded to include more features and sensors for a
more comprehensive security system.
Practical 6
Lab 10
- 10k-ohm resistor
- USB Cable
Theoretical Background
A DC motor (Direct Current motor) is the most common type of motor. DC motors normally have
just two leads, one positive and one negative. If you connect these two leads directly to a battery, the
motor will rotate. If you switch the leads, the motor will rotate in the opposite direction.
The control wire is used to communicate the angle. The angle is determined by the duration of a pulse
that is applied to the control wire. This is called Pulse Coded Modulation. The servo expects to see a
pulse every 20 milliseconds (.02 seconds). The length of the pulse will determine how far the motor
turns. A 1.5 millisecond pulse, for example, will make the motor turn to the 90-degree position (often
called as the neutral position). If the pulse is shorter than 1.5 milliseconds, then the motor will turn
the shaft closer to 0 degrees. If the pulse is longer than 1.5 milliseconds, the shaft turns closer to 180
degrees.
Pin Description
Connection-Diagram
Procedures
1. The servo motor has a female connector with three pins. The darkest or the black one is usually
the ground. I connected this to the Arduino GND.
2. I connected the power cable that in all standards should be red to 5V the Arduino board
3. Connect the remaining line on the servo connector to a digital pin on the Arduino.
4. I wrote and simulated the code in the code editor of the Tinkercad.
The Sketch
// C++ code
const int inputPin=1;
pinMode(motorPin2, OUTPUT);
pinMode(ledBlue, OUTPUT);
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
}
void loop(){
int buttonState = digitalRead(inputPin);
if(buttonState==HIGH){
analogWrite(ledRed, 255);
analogWrite(ledGreen, 0);
analogWrite(motorPin1, 255);
}
else{
analogWrite(ledRed, 0);
analogWrite(ledGreen, 0);
analogWrite(ledBlue, 0);
analogWrite(motorPin1, 0);
}
delay(10);
}
Observations
I observed that:
i. the DC motor changes direction when the Arduino sends a digital signal to the L293D IC.
ii. the motor's speed can be controlled by adjusting the voltage supply or using PWM (Pulse Width
Modulation) technique.
iii. the L293D IC protects the motor and Arduino from damage due to overcurrent or voltage surges.
Observation Table:
1 5V 366rpm
2 6V 382rpm
7V 401rpm
3
8V 420rpm
4
10V 436rpm
5
Precautions
i. Ensured use a suitable power supply for the motor and L293D IC.
ii. Ensure proper insulation and isolation of the motor and circuit.
iii. I used a switch or button to control the motor's direction to avoid accidental changes.
Conclusion
The Directional Control of the DC Motor using Arduino project demonstrates the use of Arduino and Push
button to control the direction of a DC motor. This project has applications in robotics, automation, and
other fields where directional control of DC motors is required. By following the procedures and
precautions outlined in this report, I was able to build and test the circuit successfully.