Arduino Practical Tute
Arduino Practical Tute
REQUIREMENTS
Step 1:
Connect the setup as required.
Step 2:
Step 3
Using IDE , code the requires instructions to blink the LED.
Step 4:
Using verify button you can verify the code and finally you can upload the code to the arduino
borad using upload button.
REQUIREMENTS
STEP 1
Connect the setup as required.
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.
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.
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
Step 4
Using IDE , code the required instructions to blink the LEDs.
void setup() {
void loop() {
else {
Serial.println("---------------");
Step 5
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.
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
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
#include <dht11.h>
#define DHT11PIN 4
dht11 DHT11;
void setup()
{
Serial.begin(9600);
void loop()
{
Serial.println();
delay(2000);
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.
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 −
RESULT
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
// ---------------------------------------------------------------- //
// 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);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
REQUIREMENTS
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.
Step 1
Step 2
Step 3
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.".
HARDWARE REQUIRED
Arduino UNO
USB 2.0 cable type A B
Door Sensor
Relay
Warning Light Bright Waterproof
Jumper Wires
METHOD
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.)
CODE
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
}
}