0% found this document useful (0 votes)
13 views26 pages

Lab Manual - Electronic Workshop II

The document is a lab manual for Electronics Workshop II at Delhi Technological University, prepared by Prof. Priyanka Jain. It includes a list of practical jobs involving Arduino programming, such as blinking an LED, designing a traffic light system, and creating a burglar alarm. The manual also provides detailed descriptions of the Arduino board components and programming basics.

Uploaded by

Ronak Gupta
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)
13 views26 pages

Lab Manual - Electronic Workshop II

The document is a lab manual for Electronics Workshop II at Delhi Technological University, prepared by Prof. Priyanka Jain. It includes a list of practical jobs involving Arduino programming, such as blinking an LED, designing a traffic light system, and creating a burglar alarm. The manual also provides detailed descriptions of the Arduino board components and programming basics.

Uploaded by

Ronak Gupta
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/ 26

Delhi Technological University

Electronics and Communication Engineering Department

LAB MANUAL
For
Electronics Workshop II
Prof. Priyanka Jain
Lab In Charge
Delhi Technological University

Manual Prepared by Prof. Priyanka Jain


List of JOB Electronics workshop -II
1. Study of Arduino uno Board Description, download of Arduino IDE software and its connection with laptop.
2. Write a program using Arduino to blink an LED on bread board.
3. Write a program to Fade in-out of LED on bread board using Arduino.
4. Write a program to change color of color-mixer (RGB) LED on bread board using Arduino
5. Design a traffic light control system on Arduino using Red, Green and Yellow LEDs on bread board.
6. Design a burglar alarm system using Arduino, IR sensor, LED and buzzer.
7. Design an automatic night lamp system using LED, LDR and Resistances on bread board using Arduino.
8. Write a program to run a dc motor using Arduino.
9. Write a program to run dc motor using sound sensor.
10. Design a fully automated line follower robot (LFR) using Arduino.
11. Design system to operate robot using Bluetooth(mobile).
Manual Prepared by Prof. Priyanka Jain
Arduino Programming

Manual Prepared by Prof. Priyanka Jain


Arduino -Board Description
In this chapter, we will learn about the different component the Arduino board. We will study
the Arduino UNO board because it is the most popular board in the Arduino board family. In
addition, it is the best board to get started with electronics and coding. Some boards look a
bit different from the one given below, but most Arduino shave majority of these components
in common.
Manual Prepared by Prof. Priyanka Jain
Manual Prepared by Prof. Priyanka Jain
1 Power USB
Arduino board can be powered by using the USB cable from your computer. All
you need to do isconnect the USB cable to the USB connection (1).
2 Power (Barrel Jack)
Arduino boards can be powered directly from the AC mains power supply by
connecting it to the Barrel Jack (2).
3 Voltage Regulator
The function of the voltage regulator is to control the voltage given to the
Arduino board and stabilize the DC voltages used by the processor and other
elements.
4 Crystal Oscillator
The crystal oscillator helps Arduino in dealing with time issues. How does
Arduino calculate time?The answer is, by using the crystal oscillator. The
frequency is 16,000,000 Hertz or 16 MHz.
5 Arduino Reset
You can reset your Arduino board, i.e., start your program from the beginning. You
can reset the UNO board in two ways. First, by using the reset button (17) on the
board. Second, you can connect an external reset button to the Arduino pin
Manual Prepared by Prof. Priyanka Jain
labelled RESET (5).

Manual Prepared by Prof. Priyanka Jain


Pins (3.3, 5, GND, Vin)
6 •3.3V (6) − Supply 3.3 output volt
7 •5V (7) − Supply 5 output volt
•Most of the components used with Arduino board works fine with 3.3 volt and 5 volt.
8 •GND (8)(Ground) − There are several GND pins on the Arduino, any of which can be used to
ground yourcircuit.
9 •Vin (9) − This pin also can be used to power the Arduino board from an external power
source, like AC
mains power supply.
10 Analog pins
The Arduino UNO board has six analog input pins A0 through A5. These pins can read the signal
from an analog sensor like the humidity sensor or temperature sensor and convert it into a digital
value that can beread by the microprocessor.
11 Main microcontroller
Each Arduino board has its own microcontroller (11). You can assume it as the brain of your board.
The main IC (integrated circuit) on the Arduino is slightly different from board to board. The
microcontrollers are usually of the ATMEL Company. You must know what IC your board has before
loading up a new program from the Arduino IDE. This information is available on the top of the IC.
For more details about the IC construction and functions, you can refer to the data sheet.
Manual Prepared by Prof. Priyanka Jain
12 Power LED indicator
This LED should light up when you plug your Arduino into a power source to indicate that your
board is poweredup correctly. If this light does not turn on, then there is something wrong with
the connection.
13 TX and RX LEDs
On your board, you will find two labels: TX (transmit) and RX (receive). They appear in two places
on the Arduino UNO board. First, at the digital pins 0 and 1, to indicate the pins responsible for
serial communication. Second, the TX and RX led (13). The TX led flashes with different speed
while sending the serial data. The speed of flashing depends on the baud rate used by the board.
RX flashes during the receiving process.
14 Digital I/O
The Arduino UNO board has 14 digital I/O pins (15) (of which 6 provide PWM (Pulse Width
Modulation) output. These pins can be configured to work as input digital pins to read logic
values (0 or 1) or as digital output pins to drive different modules like LEDs, relays, etc. The pins
labeled “~” can be used to generate PWM.

Manual Prepared by Prof. Priyanka Jain


• Introduction:
• Arduino is an Integrated Development Environment based upon Processing. It has made very easy several things
namely these are embedded system, physical computing, robotics, automation and otherelectronics-based things.

• Software Required:
.
The Arduino comes for the following operating systems. You may go for any of these

1.Windows
1. Linux
2. Mac OS
• You may download the software from here.
• www.arduino.cc/en/software

Manual Prepared by Prof. Priyanka Jain


Arduino Software Introduction:
Some general Understanding:

1. Code we write in Arduino is known as SKETCH.


2. Compilation of the code is known as VERIFY.
3. Transfer of the code from computer to Arduino board is known as UPLOAD.
4. If you directly hit UPLOAD button of Arduino software, the software will first VERIFY the code and then
will transfer thatcode to Arduino Board.

Buttons of Arduino software:

Manual Prepared by Prof. Priyanka Jain



• 4.3 Until you save your project, it displays its name as sketch_date. Default folder to save Arduino
code(sketch) is My Documents/Arduino or similar location for Mac OS and Linux. Arduinosaves each
code in a folder extension of code is .ino. By default it creates a folder and in that folder create a file
with the extension we have seen. It is to be noted that name of the folder and containing fileshould be
same ( If you want to rename the sketch then change nameof both).

Manual Prepared by Prof. Priyanka Jain


Selection of Board: Select the Arduino Board you are having from the available list.
For Arduino UNO – Arduino/Genuino UNO

Manual Prepared by Prof. Priyanka Jain


Connecting Arduino
Connect the Arduino Board to your computer using USB Cable once connected you will see a COM Port in your
Arduino IDE as shown below.

Manual Prepared by Prof. Priyanka Jain


General understandings for programming:

Manual Prepared by Prof. Priyanka Jain


Manual Prepared by Prof. Priyanka Jain
JOB 2: Write a program using Arduino to blink an LED on bread board.

Arduino Digital Output – LED Blinking


This tutorial explains how to take digital output from Arduino. One of the basic tutorials for Arduino. The
output is taken on aLED that blinks for an interval of 1 second.(100OHM resistance required in the circuit)

// Digital output is taken on a LED that


remains ON for one second and // OFF for
another one second
// Defining Pin 2 as LED.
const int LED = 2;
// from the circuit we can see that we
have connected LED on Pin 2

/ Digital output is taken on a LED that remains ON for one second and // OFF for
another.
// Deining Pin 2 as LED.
const int LED=2;
// from the circuit we can see that we have connected LED on Pin 2
void setup()
{
pinMode(LED, OUTPUT );// Defining LED pin as OUTPUT Pin.
}
// Below mentioned code runs for ever(infinite)
void loop()
{
digitalWrite(LED, HIGH ); // LED gets turned ON (1/HIGH/+
delay(1000);
// Waiting for one second.
digitalWrite(LED, LOW );// LED gets OFF (0/LOW/0V/
delay(1000);
// here and above Delay is in milisecond (1000 = 1 second)
}

Manual Prepared by Prof. Priyanka Jain


Manual Prepared by Prof. Priyanka Jain
JOB 3: Write a program to Fade in -out of LED on bread board using
Arduino.
*
Fade
This example shows how to fade an LED on pin 9
using the analogWrite() function.

The analogWrite() function uses PWM, so if you


want to change the pin you're using, be sure to
use another PWM capable pin. On most Arduino,
the PWM pins are identified with a "~" sign,
like ~3, ~5, ~6, ~9, ~10 and ~11.
*/

int brightness = 0;
const pin = 9;
void setup()
{
pinMode(pin, OUTPUT);
}

void loop()
{
for (brightness = 0; brightness <= 255; brightness += 5) {
analogWrite(pin, brightness);
delay(60); // Wait for 60 millisecond(s)
}
for (brightness = 255; brightness >= 0; brightness -= 5) {
analogWrite(pin, brightness);
delay(60); // Wait for 60 millisecond(s)
}
}

Manual Prepared by Prof. Priyanka Jain


4.JOB: Write a program to change color of color-mixer (RGB) LED on
bread board using Arduino

void setup()
{
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
}

void loop()
{
analogWrite(11, 255);
analogWrite(10, 0);
analogWrite(9, 0);
delay(1000); // Wait for 1000 millisecond(s)
analogWrite(11, 255);
analogWrite(10, 255);
analogWrite(9, 102);
delay(1000); // Wait for 1000 millisecond(s)
}

Manual Prepared by Prof. Priyanka Jain


5. JOB: Design a traffic light control system using Red, Green and
Yellow LEDs on bread board using Arduino.

int RedLED = 13;


int GreenLED = 12;
int YellowLED = 11;
int RedLED1 = 5;
int GreenLED1 =7;
int YellowLED1 =3;

void setup()
{
pinMode(GreenLED, OUTPUT);
pinMode(YellowLED, OUTPUT);
pinMode(RedLED, OUTPUT);
pinMode(GreenLED1, OUTPUT);
pinMode(YellowLED1, OUTPUT);
pinMode(RedLED1, OUTPUT);
pinMode(10, INPUT);
pinMode(7, INPUT);
pinMode(5, INPUT);
Serial.begin(9600);

void loop()

{ //left stop
if(digitalRead(2) == HIGH)
Serial.println("ONE");
else
Serial.println("zero");
delay(500);
digitalWrite(GreenLED,HIGH);
digitalWrite(RedLED, HIGH);
digitalWrite(YellowLED, HIGH);

digitalWrite(GreenLED1, HIGH);
digitalWrite(RedLED, HIGH);
digitalWrite(YellowLED, HIGH);

delay(500);
/* //yellow signal
digitalWrite(GreenLED, LOW);
digitalWrite(RedLED, HIGH);
digitalWrite(YellowLED, HIGH);

Manual Prepared by Prof. Priyanka Jain


digitalWrite(GreenLED1, LOW);
digitalWrite(RedLED, LOW);
digitalWrite(YellowLED, HIGH);

delay(2000);
/* //right stop
digitalWrite(GreenLED, HIGH);
digitalWrite(RedLED, LOW);
digitalWrite(YellowLED, LOW);

digitalWrite(GreenLED1, LOW);
digitalWrite(RedLED, HIGH);
digitalWrite(YellowLED, LOW);

delay(10000);
//right yellow signal
digitalWrite(GreenLED, LOW);
digitalWrite(RedLED, LOW);
digitalWrite(YellowLED, HIGH);

digitalWrite(GreenLED1, LOW);
digitalWrite(RedLED, HIGH);
digitalWrite(YellowLED, HIGH);
delay(1000);*/

Manual Prepared by Prof. Priyanka Jain


JOB 6:Design a Burglar alarm system using Arduino, IR sensor, LED
and buzzer.

int digitalinput = 12; // analog input pin IR sensor.


int inputVal = 1; // to store value of photo diode
int buzzer = 13; // digital pin for buzzer
//int alarm_val = 1; // setting limits for makes buzzer beep

void setup()
{
Serial.begin(9600); // setup Serial Communication.
pinMode(digitalinput, INPUT);
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer, LOW);
}

void loop(){
inputVal = digitalRead(digitalinput); // Reading and storing digital input value.
Serial.print("Input Value:");
Serial.print(inputVal); // Printing Analog input value of Photo Diode.
Serial.print("\n");
if(inputVal == 0)
{

digitalWrite(buzzer, HIGH);
delay(200);
digitalWrite(buzzer, LOW);
delay(100);

}
if(inputVal == 1)
{
digitalWrite(buzzer, LOW);
delay(200);
}
}

Manual Prepared by Prof. Priyanka Jain


Manual Prepared by Prof. Priyanka Jain
JoB7: Design an automatic Night Lamp system using LED, LDR and
Resistances on bread board using Arduino.
onst int LED=9; // LED connect to Digital Pin
const int LDRSensor= A0; //Sensor pin connects to analog pin A0

int state; //declaring variable to store the reading


int threshold=600; //threshold voltage declared

void setup()
{
pinMode (LED, OUTPUT);
pinMode (LDRSensor, INPUT);
Serial.begin(9600);
}

void loop()
{
state= analogRead(LDRSensor); //sensor reading value stored in state variable
if (state < threshold)
{
digitalWrite(LED, HIGH); //if the light is below the threshold value, the LED will turns on
Serial.println(state);
delay(1000);
}
else
{
digitalWrite(LED, LOW); //otherwise, the LED is off
Serial.println(state);
delay(500);
}
}
/*

int
sensorValue = 0;

void setup()
{
pinMode(A0, INPUT);
Serial.begin(9600);
pinMode(9, OUTPUT);
}

Manual Prepared by Prof. Priyanka Jain


void loop()
{
// read the value from the sensor
sensorValue = analogRead(A0);
// print the sensor reading so you know its range
Serial.println(sensorValue);
// map the sensor reading to a range for the LED
analogWrite(9, map(sensorValue, 0, 1023, 0, 255));
delay(1000); // Wait for 100 millisecond(s)
}*/

220ohm
4.7 kohm

Manual Prepared by Prof. Priyanka Jain

You might also like