0% found this document useful (0 votes)
43 views6 pages

Exp 04

The document describes an experiment using an Arduino Uno microcontroller board to design and implement various circuits. Six circuits were designed - (a) LED blinking, (b) LED fading, (c) traffic light control, (d) interfacing a push button, (e) turning an LED on and off with a push button, and (f) interfacing a potentiometer. The required components, codes, circuit diagrams, and hardware implementations are provided for each circuit. The conclusion states that the experiment was successful in implementing the various circuits after overcoming some troubles.

Uploaded by

ZAHID HOSSAIN
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)
43 views6 pages

Exp 04

The document describes an experiment using an Arduino Uno microcontroller board to design and implement various circuits. Six circuits were designed - (a) LED blinking, (b) LED fading, (c) traffic light control, (d) interfacing a push button, (e) turning an LED on and off with a push button, and (f) interfacing a potentiometer. The required components, codes, circuit diagrams, and hardware implementations are provided for each circuit. The conclusion states that the experiment was successful in implementing the various circuits after overcoming some troubles.

Uploaded by

ZAHID HOSSAIN
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/ 6

Heaven’s Light is Our Guide

Rajshahi University of Engineering & Technology

Department of Electrical & Electronic Engineering

Course Title : Electronic Shop Practice

Course No : EEE 3100


Experiment No : 04
Name of the Experiment : Designing and Implementation of Circuits using Arduino
Uno
Date of Experiment : 09 May, 2023
Date of Submission : 16 May, 2023

Submitted by Submitted to

Name : Zahid Hossain Alok Kumar Paul


Roll : 1901145 Assistant Professor

Section : C Department of EEE

Series : 19 RUET
Experiment No: 04

Experiment Name: Designing and Implementation of Circuits using Arduino Uno.


Theory: Arduino UNO is a microcontroller board based on the ATmega328P. It has
14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs,
a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header and a
reset button. It contains everything needed to support the microcontroller; simply
connect it to a computer with a USB cable or power it with a AC-to-DC adapter or
battery to get started. A lot of works can be done using arduino uno like ,
1. LED blinking.
2. LED Fading.
3. Traffic Light control.
4. Interfacing the push swich.
5. LED will glow after one time press and off after second time press of push switch.
6. Interfacing of POT etc.
Circuit Diagram:

(a) (b)

(c) (d)

(e) (f)
Fig 4.01: Circuit diagram for a) LED blinking, (b) LED fading, (c) Traffic light control, (d)
Interfacing of push switch, (e) On and off of LED by press switch, (f)Interfacing of POT.

Required Apparatus:
01. Arduino UNO.
02. Resistors (220 ohm, 3 pieces)
03. LED (3 pieces)
04. Potentiometer ( 1 pieces, 100k)
05. Bread Board.
06. Laptop.
07. Push button.
08. Wires and etc.
Required Codes:
i) Codes for LED blinking:
void setup() {
pinMode(8, OUTPUT);
// put your setup code here, to run once:

}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(8, HIGH);
delay(500);
digitalWrite(8, LOW);
delay(500);
}

ii) Codes for LED Fading:


int led = 6;
int brightness = 0;
int fadeAmount = 5;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
analogWrite(led, brightness);
brightness = brightness + fadeAmount;
if (brightness <= 0 || brightness >= 255) {
fadeAmount = -fadeAmount;
}
delay(30);
}

iii) Codes for traffic light control:

void setup() {
// put your setup code here, to run once:
pinMode(8, OUTPUT);
pinMode(7,OUTPUT);
pinMode(4,OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(8, HIGH);
digitalWrite(7,LOW);
digitalWrite(4,LOW);
delay(2000);
digitalWrite(8, LOW);
digitalWrite(7,HIGH);
digitalWrite(4,HIGH);
delay(1000);
digitalWrite(8, LOW);
digitalWrite(7,LOW);
digitalWrite(4,HIGH);
delay(1500);

iv) Codes for Interfacing the push swich:


void setup() {
pinMode(2, OUTPUT);
}
void loop() {
digitalWrite(2, HIGH);
}

v) Codes for press switch:

#define LED_PIN 8
#define BUTTON_PIN 7

byte lastButtonState = LOW;


byte ledState = LOW;

unsigned long debounceDuration = 50; // millis


unsigned long lastTimeButtonStateChanged = 0;

void setup() {
pinMode(LED_PIN, OUTPUT);
pinMode(BUTTON_PIN, INPUT);
}

void loop() {
if (millis() - lastTimeButtonStateChanged > debounceDuration) {
byte buttonState = digitalRead(BUTTON_PIN);
if (buttonState != lastButtonState) {
lastTimeButtonStateChanged = millis();
lastButtonState = buttonState;
if (buttonState == LOW) {
ledState = (ledState == HIGH) ? LOW: HIGH;
digitalWrite(LED_PIN, ledState);
}
}
}
}

vi) Codes for Interfacing of POT:


void setup() {
pinMode(3, OUTPUT);
pinMode(A0, INPUT);
}
int n;
void loop() {
n=analogRead(A0);
n=map(n, 0, 1023, 0, 255);
analogWrite(3,n);
// put your main code here, to run repeatedly:
}

Hardware Implementation:

(a) (b)
(c) (d)

(e) (f)
Fig 4.02: Hardware implementation of (a) LED blinking, (b) LED fading, (c) Traffic light
control, (d) Interfacing of push switch, (e) On and off of LED by press switch, (f)Interfacing
of POT.

Conclusion: The experiment of implementation of various types of circuits using


arduino uno was successful. The arduino uno was very sensitive device. Some helps
were taken from various types of website. The codes were run at Arduino IDE and
uploaded to the arduino uno.Then the circuits were designed to bread board and
observed the output. After facing some troubles, the experiment was done successfully.

You might also like