DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
===============================================
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
ARDUINO PROGRAMMING
LABORATORY MANUAL
FOR II [Link] (IV SEM)
1 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
LIST OF EXPERIMENTS
CYCLE - I Experiments
1. Electrical Circuit by using ARDUINO UNO
2. Blinking LED
3. LED Intensity Control
4. Relay Control
5. 16 x 2 LCD Display
6. Rotation Measurement
7. Voice Operated ON/OFF control circuit.
CYCLE - II Experiments
8. Ultra Sonic Distance Measurement
9. Speed Control of Hybrid Vehicles using PWM
Technique
10. Drunk and Drive Detection
11. Temperature Measurement
12. Women Security System using GPS & GSM
13. Soil Moisture Control
14. Auto Intensity controlled LED
New / Additional experiments planned
1. LED Blinking of 25 times
2. Theft Alarm Circuit
3. IoT based Light Monitoring System
4. GSM pollution monitoring
5. Thermistor
2 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
INDEX
[Link]. Experiment Name Page No.
1 Electrical Circuit by using ARDUINO UNO 4
2 Blinking LED 9
Blinking LED 10 Times 12
3 LED Intensity Control 15
4 Relay Control 19
5 16 x 2 LCD Display 22
6 Voice Operated ON/OFF control circuit 26
7 Ultra Sonic Distance Measurement 30
8 Soil Moisture Control 34
3 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
EXPT: No-1 ELECTRICAL CIRCUITS USING ARDUINO
AIM: Study the Electrical circuit of ARDUINO
APPARATUS:
[Link] AT Mega328P
ARDUINO MICROCONTROLLER PIN DIAGRAM
4 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
5 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CPU 8-bit AVR
Number of Pins 28/30
Operating Voltage (V) +1.8 V TO +5.5V
CPU Speed 1MIPS for 1MHz
[Link] Upto 20MHz
Program Memory or Flash memory 32Kbytes[10000 write/erase cycles]
RAM 2Kbytes Internal SRAM
1Kbytes EEPROM
EEPROM LifeTime :100000
Write/Erase CyclesData
Retention: 20 Years
6 Channels With
ADC
10 bit Resolution
PWM CHANNELS Six PWM Channels
Two Master/Slave SPI Serial Interface
– One Programmable Serial
INTERFACE
USART
– One Byte-oriented 2-wire
Serial Interface(Philips I2C
compatible)
COMPARATOR One On-chip Analog Comparator
8 BIT TIMERS/COUNTERS 2
16 BIT TIMERS/COUNTERS 1
Idle,
ADC Noise
Reduction,
SLEEP MODES Power-save,
Powe
r-
down
,
Stand
by,
and
Extended Standby
SECURITY Programming Lock for Software
Security
Advanced RISC Architecture 131 Powerful Instructions
6 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
ARDUINO POWER SUPPLY
ARDUINO RESET AND OSCILLATOR
7 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
FEATURES OF DIFFERENT TYPES OF ARDUINO BOARDS
The features of different types of Arduino boards are listed in the
tabular form.
Digital Analogue
Arduino Board Processor Memory
I/O I/O
Arduino Uno 16Mhz 6 input, 0
14
2KB SRAM, 32KB output
ATmega328
flash
84MHz 96KB SRAM, 12 input, 2
Arduino Due 54
512KB output
AT91SAM3X8E
flash
Arduino Mega 16MHz 54 16 input, 0
8KB SRAM, 256KB
ATmega2560 output
flash
Arduino 16MHz ATmega32u4 2.5KB 20 12 input,0 output
SRAM,32KB
Leonardo flash
Arduino Uno (R3)
Arduino Nano
Arduino Micro
Arduino Due
LilyPad Arduino Board
Arduino Bluetooth
Arduino Diecimila
RedBoard Arduino Board
Arduino Mega (R3) Board
Arduino Leonardo Board
Arduino Robot
Arduino Esplora
Arduino Pro Mic
Arduino Ethernet
Arduino Zero -Fastest Arduino Board
8 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
EXPT: No-2 BLINKING LED
AIM: Program to turn ON / OFF LED using Arduino Uno.
APPARATUS:
[Link] BOARD
2. BREAD BOARD
3. RESISTER 100Ω - 1
4. 8mm LED -1
5. PATCH CARDS REQUIRED
6. DESKTOP WITH ARDUINO SOFTWARE
CONNECTION DIAGRAM:-
9 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CIRCUIT DIAGRAM:-
CODE:-
#define LED 8
void setup()
pinMode (LED,OUTPUT);
void loop()
{
digitalWrite(LED,1);
delay(1000);
digitalWrite(LED,0);
delay(1000);
10 ARDUINO PROGRAMMING LAB
} DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
PROCEDURE:-
1. Connections are made as per the circuit diagram.
2. Enter the code in Adriuno tool and verify the code.
3. Connect the Ardiuno board to pc USB port and check the COM port in the tool.
4. Upload the code to the Ardiuno board.
5. Verify the output.
RESULT:-
11 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
EXPT: No-2(a) LED BLINKING 10 TIMES
AIM: Program to LED blinking 10 times using Arduino Uno.
APPARATUS:
[Link] BOARD
2. BREAD BOARD
3. RESISTER 100Ω - 1
4. 8mm LED -1
5. PATCH CARDS REQUIRED
6. DESKTOP WITH ARDUINO SOFTWARE
CONNECTION DIAGRAM:-
12 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CIRCUIT DIAGRAM:-
13 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CODE:-
#define LED
8 int i=0;
void setup()
{
pinMode(LED,OUTPUT);
}
void loop()
{
for(i=0;i<10;i++)
digitalWrite(LED,1)
; delay(500);
digitalWrite(LED,0)
; delay(500);
}
while(1);
PROCEDURE:-
1. Connections are made as per the circuit diagram.
2. Enter the code in Adriuno tool and verify the code.
3. Connect the Ardiuno board to pc USB port and check the COM port in the tool.
4. Upload the code to the Ardiuno board.
5. Verify the output.
RESULT:-
14 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
EXPT: No-3 LED INTENSITY CONTROL
AIM: Program to LED Intensity control using Arduino Uno.
APPARATUS:
[Link] BOARD
2. BREAD BOARD
3. RESISTER 100Ω - 1
4. 8mm LED -1
5. PATCH CARDS REQUIRED
6. DESKTOP WITH ARDUINO SOFTWARE
CONNECTION DIAGRAM:-
15 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CIRCUIT DIAGRAM:-
16 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CODE:-
#define LED 8
void setup( )
pinMode(LED,OUTPUT);
void loop()
analogWrite(LED,0);
delay(3000);
analogWrite(LED,1);
delay(3000);
analogWrite(LED,50);
delay(3000);
analogWrite(LED,100);
delay(3000);
analogWrite(LED,150);
delay(3000);
analogWrite(LED,200);
delay(3000);
analogWrite(LED,255);
delay(3000);
17 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
PROCEDURE:-
1. Connections are made as per the circuit diagram.
2. Enter the code in Adriuno tool and verify the code.
3. Connect the Ardiuno board to pc USB port and check the COM port in the tool.
4. Upload the code to the Ardiuno board.
5. Verify the output.
RESULT:-
18 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
EXPT: No-4 RELAY CONTROL
AIM: Program to Relay control using Arduino Uno.
APPARATUS:
[Link] BOARD
2. BREAD BOARD
3. Relay – 5V
4. 60Watt bulb with holder
5. PATCH CARDS REQUIRED
6. DESKTOP WITH ARDUINO SOFTWARE
CONNECTION DIAGRAM:-
19 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CIRCUIT DIAGRAM:-
20 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CODE:-
int relay_pin = 7;
void setup() {
pinMode(relay_pin,OUTPUT);
void loop() {
digitalWrite(relay_pin,HIGH);
delay(2000);
digitalWrite(relay_pin,LOW);
delay(2000);
PROCEDURE:-
1. Connections are made as per the circuit diagram.
2. Enter the code in Adriuno tool and verify the code.
3. Connect the Ardiuno board to pc USB port and check the COM port in the tool.
4. Upload the code to the Ardiuno board.
5. Verify the output.
RESULT:-
21 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
EXPT: No-5 16 X 2 LCD DISPLAY
AIM: Program to 16 x 2 LCD DISPLAY using Arduino Uno.
APPARATUS:
[Link] BOARD
2. BREAD BOARD
3. 16 x 2 LCD DISPLAY
4. PATCH CARDS REQUIRED
6. DESKTOP WITH ARDUINO SOFTWARE
CONNECTION DIAGRAM:-
22 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CIRCUIT DIAGRAM:-
23 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CODE:-
#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
void setup() {
// put your setup code here, to run once:
analogWrite(6,100);
[Link](16,2);
void loop() {
// put your main code here, to run repeatedly:
[Link](); [Link](0,0);
[Link](" ASIST ");
[Link](0,1);
[Link](" E.C.E ");
delay(3000);
[Link]();
[Link](0,0);
[Link]("ARDIUNO");
[Link](0,1);
[Link]("II-ECE");
delay(3000);
24 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
PROCEDURE:-
1. Connections are made as per the circuit diagram.
2. Enter the code in Adriuno tool and verify the code.
3. Connect the Ardiuno board to pc USB port and check the COM port in the tool.
4. Upload the code to the Ardiuno board.
5. Verify the output.
RESULT:-
25 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
EXPT: No-6 VOICE OPERATED ON/OFF CONTROL CIRCUIT
AIM: Program to Voice operated on/off control circuit using Arduino Uno.
APPARATUS:
[Link] BOARD
2. BREAD BOARD
3. Relay – 5V
4. 60Watt bulb with holder
5. Bluetooth
6. PATCH CARDS REQUIRED
7. DESKTOP WITH ARDUINO SOFTWARE
CONNECTION DIAGRAM:-
26 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CIRCUIT DIAGRAM:-
27 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CODE:-
//Voice Controlled Light
String voice;
#define relay 12
void setup()
{ // put your setup code here, to run once:
[Link](9600);
pinMode(relay, OUTPUT);
digitalWrite(relay, LOW);
int relayVal;
void loop() {
while ([Link]()) //Check if there is an available byte to read
delay(10); //Delay added to make thing stable
char c = [Link](); //Conduct a serial read
if (c == '#') {break;} //Exit the loop when the # is detected after the word
voice += c; //Shorthand for voice = voice + c
if ([Link]() > 0) {
[Link](voice);
//----------Control Light----------//
if(voice == "*turn on the light") // To tune ON the bulb
digitalWrite(relay, HIGH);
28 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
else if(voice == "*turn off the light") // To turn OFF the bulb
digitalWrite(relay, LOW);
voice=""; //Reset the variable after initiating
PROCEDURE:-
1. Connections are made as per the circuit diagram.
2. Enter the code in Adriuno tool and verify the code.
3. Connect the Ardiuno board to pc USB port and check the COM port in the tool.
4. Upload the code to the Ardiuno board.
5. Verify the output.
RESULT:-
29 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
EXPT: No-7 ULTRASONIC DISTANCE MEASUREMENT
AIM: Program to Ultrasonic Distance Measurement using Arduino Uno.
APPARATUS:
[Link] BOARD
2. BREAD BOARD
3. UV SENSOR
4. BUZZER
5. PATCH CARDS REQUIRED
6. DESKTOP WITH ARDUINO SOFTWARE
CONNECTION DIAGRAM:-
30 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CIRCUIT DIAGRAM:-
31 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CODE:-
#define trigPin 6
#define echoPin 5
#define buzzer 2
float new_delay;
void setup()
[Link] (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzer,OUTPUT);
void loop()
long duration, distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
new_delay= (distance *3) +30;
[Link](distance);
[Link](" cm");
32 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
if (distance < 50)
digitalWrite(buzzer,HIGH);
delay(new_delay);
digitalWrite(buzzer,LOW);
else
digitalWrite(buzzer,LOW);
delay(200);
PROCEDURE:-
1. Connections are made as per the circuit diagram.
2. Enter the code in Adriuno tool and verify the code.
3. Connect the Ardiuno board to pc USB port and check the COM port in the tool.
4. Upload the code to the Ardiuno board.
5. Verify the output.
RESULT:-
33 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
EXPT: No-8 SOIL MOISTURE CONTROL
AIM: Program to Soil Moisture Control using Arduino Uno.
APPARATUS:
[Link] BOARD
2. BREAD BOARD
3. MOISTURE SENSOR
4. PATCH CARDS REQUIRED
5. DESKTOP WITH ARDUINO SOFTWARE
CONNECTION DIAGRAM:-
34 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CIRCUIT DIAGRAM:-
35 ARDUINO PROGRAMMING LAB
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING ASIST
CODE:-
int sensor;
int const powerpin=8;
int const delaytime=1000;
void setup()
[Link](9600);
pinMode (powerpin,OUTPUT);
void loop()
digitalWrite (powerpin,HIGH);
delay (10);
sensor=analogRead (A0);
digitalWrite (powerpin,LOW);
[Link](sensor);
delay(delaytime);
PROCEDURE:-
1. Connections are made as per the circuit diagram.
2. Enter the code in Adriuno tool and verify the code.
3. Connect the Ardiuno board to pc USB port and check the COM port in the tool.
4. Upload the code to the Ardiuno board.
5. Verify the output.
RESULT:-
36 ARDUINO PROGRAMMING LAB