0% found this document useful (0 votes)
10 views21 pages

Arduino Practical Tute

The document outlines a series of Arduino practical projects aimed at teaching advanced ICT skills, including switching LEDs on and off, using sensors, and controlling devices based on environmental conditions. Each practical includes a list of required materials, step-by-step instructions for setup and coding, and explanations of the underlying concepts. Projects range from basic LED control to more complex applications involving temperature sensors and door sensors.

Uploaded by

pedroishere4
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)
10 views21 pages

Arduino Practical Tute

The document outlines a series of Arduino practical projects aimed at teaching advanced ICT skills, including switching LEDs on and off, using sensors, and controlling devices based on environmental conditions. Each practical includes a list of required materials, step-by-step instructions for setup and coding, and explanations of the underlying concepts. Projects range from basic LED control to more complex applications involving temperature sensors and door sensors.

Uploaded by

pedroishere4
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/ 21

Advanced Level ICT |

ARDUINO PRACTICAL 1- SWITCH A LED ON AND OFF

ARDUINO UNO BOARD PARTS

REQUIREMENTS

 Arduino UNO boards


 Project board
 LED bulbs
 Resistor
 USB cable (to connect Arduino board to pc)
 IDE
 Jumper wires

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

SWITCH A LED ON AND OFF

Step 1:
Connect the setup as required.

Step 2:

Connect the Arduino UNO board to the pc through USB.

Step 3
Using IDE , code the requires instructions to blink the LED.

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

Step 4:
Using verify button you can verify the code and finally you can upload the code to the arduino
borad using upload button.

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

ARDUINO PRACTICAL 2 – BLINK 3 LED BULBS

REQUIREMENTS

 Arduino UNO boards


 Project board
 LED bulbs (3)
 Resistor
 USB cable (to connect Arduino board to pc)
 IDE
 Jumper wires

STEP 1
Connect the setup as required.

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

Connect LED bulbs to the project board and take a common ground line. Connect (+) sides of
LEDs to the digital pins 10, 11, 12 of Arduino board using jumper wires.

STEP 2
Connect the Arduino UNO board to the pc through USB.

STEP 3
Using IDE , code the required instructions to blink the LEDs.
Wokwi.com (arduino simulator)

STEP 4:
Using verify button you can verify the code and finally you can upload the code to the arduino
borad using upload button.

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

ARDUINO PRACTICAL 3 - SWITCH A LED ON/OFF ON AMBIENT


LIGHT INTENSITY

REQUIREMENTS

Arduino project with automated lights that turn ON/OFF with a weather change as per the light
intensity in LDR.
 Arduino Uno
 Arduino Software
 One LED light
 300 Ohm resister
 Jumper wire (Male to Male)
 Bread broad
 LDR (Light Dependent Resistor) sensor– changes resistance on intensity of light falls
upon. Typically used as a voltage divider to get converted light intensity into
voltage.

Step 1
First, connect the Arduino with the laptop or computer. Light blinks in the Arduino board.

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

Step 2
Open Arduino IDE
 Then Click TOOL- Select BOARD - Then press ARDUINO/GENUINO UNO R3
 Again Select TOOL - Select a PORT- COM3 ARDUINO UNO

Step 3
Build up the setup

Analog to Digital converter


 In physical world everything is analog, in microcontroller everything is digital. Sensors
convert other form of energy into voltage.

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

Step 4
Using IDE , code the required instructions to blink the LEDs.

int ledPin = 13; //declare digital I/O pin 13 as LEDpin

int ldrPin = A0; //declare analog input pin AO as LDRpin

void setup() {

pinMode(ledPin, OUTPUT);//initialize the LED pin as an output

pinMode(ldrPin, INPUT);//initialize the LDR pin as an input

void loop() {

int ldrStatus = analogRead(ldrPin);//read the LDR value

if (ldrStatus <= 200) {//if sensor value is less or equal to 200

digitalWrite(ledPin, HIGH); //turn LED on

Serial.println("LDR is DARK, LED and BUZZER is ON");

else {

digitalWrite(ledPin, LOW); //turn LED off

Serial.println("---------------");

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

Step 5

Then click the verify button, to verify the program coding.

Automatic lights on and off Circuit diagram using LDR with the weather change.
When lights in the room are on, the light in the bread broad is off.
When Room Lights are OFF, LDR sensor resistance becomes very high and with
the help of our program Lights in the Breadboard turns ON.

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

PRACTICAL 4 - DHT11 TEMPERATURE/HUMIDITY SENSOR

In this project, we will use the KY-015 Arduino DHT11 Temperature/Humidity sensor and
display it to the Arduino IDE serial monitor. This project is really simple and shouldn't take
us very long.

MATERIALS

The materials are here as follows:


 Arduino Uno
 KY-015 Arduino DHT11 Temperature/Humidity\
 Jumper Wires
 Breadboard
 Cable (USB 2.0)

STEP 1: PLACE THE SENSOR

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

 VCC - red wire Connect to 3.3 - 5V power. Sometime 3.3V power isn't enough in
which case try 5V power.
 Data out - white or yellow wire
 Not connected
 Ground - black wire

DETAILS ABOUT THE CODE

You need to follow these instructions to make it work:


1. You need to add the library to the Arduino IDE.
2. Upload the code.
3. When the code is uploaded, open the Serial Monitor and set the baud rate to
9600.
4. You will see the humidity and temperature.

#include <dht11.h>
#define DHT11PIN 4

dht11 DHT11;

void setup()
{
Serial.begin(9600);

void loop()
{
Serial.println();

int chk = DHT11.read(DHT11PIN);

Serial.print("Humidity (%): ");


Serial.println((float)DHT11.humidity, 2);

Serial.print("Temperature (C): ");


Serial.println((float)DHT11.temperature, 2);

delay(2000);

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

PRACTICAL 5 -ULTRASONIC SENSOR

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.
The operation is not affected by sunlight or black material, although acoustically,
soft materials like cloth can be difficult to detect. It comes complete with
ultrasonic transmitter and receiver module.

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

COMPONENTS REQUIRED
You will need the following components −

 1 × Breadboard
 1 × Arduino Uno R3
 1 × ULTRASONIC Sensor (HC-SR04)

PROCEDURE
Follow the circuit diagram and make the connections as shown in the image
given below.

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

SKETCH
Open the Arduino IDE software on your computer. Coding in the Arduino
language will control your circuit. Open a new sketch File by clicking New.

CODE TO NOTE
The Ultrasonic sensor has four terminals - +5V, Trigger, Echo, and GND
connected as follows −

 Connect the +5V pin to +5v on your Arduino board.


 Connect Trigger to digital pin 7 on your Arduino board.
 Connect Echo to digital pin 6 on your Arduino board.
 Connect GND with GND on Arduino.
In our program, we have displayed the distance measured by the sensor in
inches and cm via the serial port.

RESULT

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

You will see the distance measured by sensor in inches and cm on Arduino serial
monitor.

// ---------------------------------------------------------------- //
// Arduino Ultrasoninc Sensor HC-SR04
// Using Arduino IDE 1.8.7
// Using HC-SR04 Module
// Tested on 17 September 2019
// ---------------------------------------------------------------- //

#define echoPin 2 // attach pin D2 Arduino to pin Echo of HC-SR04


#define trigPin 3 //attach pin D3 Arduino to pin Trig of HC-SR04

// defines variables
long duration; // variable for the duration of sound wave travel
int distance; // variable for the distance measurement

void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an OUTPUT
pinMode(echoPin, INPUT); // Sets the echoPin as an INPUT
Serial.begin(9600);//Serial Communication is starting with 9600 of
baudrate speed
Serial.println("Ultrasonic Sensor HC-SR04 Test"); //print text in
SerialMonitor
Serial.println("with Arduino UNO R3");
}
void loop() {
// Clears the trigPin condition
digitalWrite(trigPin, LOW);
delayMicroseconds(2);

// Sets the trigPin HIGH (ACTIVE) for 10 microseconds


digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);

// Calculating the distance


distance = duration * 0.034 / 2; //Speed of sound wave divided by 2 (go
and back)

// Displays the distance on the Serial Monitor


Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
}

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

ARDUINO PRACTICAL 6 - SENSING THE ROOM TEMPERATURE


WITH TEMPERATURE SENSOR AND SWITCHING A FAN ON AND
OFF

REQUIREMENTS

(All the other requirements needed as in above practical)

Temperature sensor (LM35)


 provides a voltage- a linearly proportional to the temperature sensed.
 Sensitive to temperature from -55c +155c
 Temperature = Vout x 100

DC motor fan
 An actuator
 Convert electrical energy to kinetic energy
 Draws more current than, energy microcontroller i/o port can deliver.

Transistor
 Semiconductor device
 Used to switch electronic signals or amplify electrical power.

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

Step 1

Build the setup as follow

Step 2

Open Arduino IDE

 Then Click TOOL- Select BOARD - Then press ARDUINO/GENUINO UNO R3

 Again Select TOOL - Select a PORT- COM3 ARDUINO UNO

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

Step 3

Creating the code

ARDUINO PRACTICAL 7

Reed switch is used in many of the real-life applications such as magnetic door switch,
laptops, smartphones etc. The door sensor is widely used in security area, it is used to
detect/monitor entrances (such as door, window). The door sensor is also known as "entry
sensors", "contact sensors", or "window sensors.".

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

HARDWARE REQUIRED

Arduino UNO
USB 2.0 cable type A B
Door Sensor
Relay
Warning Light Bright Waterproof
Jumper Wires

METHOD

Door sensor includes two components:


• One reed switch with 1 two pins
• One magnet

The magnet is attached to the door/window (moving part), and the reed switch is attached to the
door frame (fixed part). The two components are in contact when the door is closed. When the
magnet is close to the reed switch, the reed switch circuit is closed. When the magnet is far from
the reed switch, the reed switch circuit is open.

By connecting relay to light bulb, led strip, motor or actuator... We can use the door sensor to
control light bulb, led strip, motor or actuator... (A relay is a programmable electrical switch,
which can be controlled by Arduino or any micro-controller. It is used to programmatically
control on off the devices, which use the high voltage and/or high current. It is a bridge between
Arduino and high voltage devices.)

ADVANCED LEVEL ICT | Practical 1


Advanced Level ICT |

CODE

const int DOOR_SENSOR_PIN = 13;//Arduino pin connected to door


sensor's pin
const int RELAY_PIN = 3; // Arduino pin connected to the IN pin
of relay

int doorState ;

void setup () {
Serial.begin(9600); // initialize serial
pinMode(DOOR_SENSOR_PIN, INPUT_PULLUP);// set Arduino pin to input
pull-up mode
pinMode (RELAY_PIN, OUTPUT); // set Arduino pin to output
mode
}

void loop () {
doorState = digitalRead(DOOR_SENSOR_PIN); // read state

if (doorState == HIGH) {
Serial.println("The door is open");
digitalWrite(RELAY_PIN, HIGH); // turn on relay
}
else {
Serial.println("The door is closed");
digitalWrite(RELAY_PIN, LOW); // turn off relay
}
}

ADVANCED LEVEL ICT | Practical 1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy