Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
287 views

Build Circuit To Blink LEDs in Different Patterns Microcontroller Programming Project

#Microcontroller_Programming #Project #MCP #22471 Build circuit to blink LEDs in different patterns #Microcontroller_Programming_Project #Report

Uploaded by

Chaitanya Yenge
Copyright
© © All Rights Reserved
0% found this document useful (0 votes)
287 views

Build Circuit To Blink LEDs in Different Patterns Microcontroller Programming Project

#Microcontroller_Programming #Project #MCP #22471 Build circuit to blink LEDs in different patterns #Microcontroller_Programming_Project #Report

Uploaded by

Chaitanya Yenge
Copyright
© © All Rights Reserved
You are on page 1/ 13

SANJIVANI K. B. P.

POLYTECHNIC
DEPARTMENT OF MECHATRONIC TECHNOLOGY

MCP MICRO PROJECT

Title-“Build circuit to blink LEDs in different patterns’’


22471

Submitted By
ROLL
NO. NAME OF STUDENT ENROLMENT NO
152 SHAIKH AMAN AJIJ 2000340620
163 YENGE CHAITANYA MAHESH 2000340650
165 BHAD SUMIT VALMIK 2000340200
166 AHIRE VISHAL SUDHAKAR 2100340539
173 BANBERU SIDDHARTH SHRIKISAN 2100340557

Mrs.S.C.BHANGALE Mr. P.B.KHATKALE


(SUBJECT TEACHER) (HOD)
Sanjivani Rural Education Society’s

SANJIVANI K. B. P. POLYTECHNIC
DEPARTMENT OF MECHATRONIC TECHNOLOGY

CERTIFICATE
This is to certify that the Project report entitled

“Build circuit to blink LEDs in different patterns’’


Submitted By
ROLL NAME OF STUDENT ENROLMENT NO
NO.
152 SHAIKH AMAN AJIJ 2000340620
163 YENGE CHAITANYA MAHESH 2000340650
165 BHAD SUMIT VALMIK 2000340200
166 AHIRE VISHAL SUDHAKAR 2100340539
173 BANBERU SIDDHARTH SHRIKISAN 2100340557

Under our supervision and guidance for partial fulfillment of the requirement for
Diploma in Mecatronics Technology affiliated to
Maharashtra State Board of Technical Education,
Mumbai For academic year
2022 - 2023

Mrs.S.C.BHANGALE Mr. P.B.KHATKALE


(SUBJECT TEACHER) (HOD)
PROCEDURE
The second line begins with void setup() and it has a block of
statements written inside parentheses. Here setup() is a
function in APL (arduino programming language) used to
declare configuration statements for the micro controller ports.
While playing with a micro controller, we need to configure
different micro controller ports as INPUT source or OUTPUT.
Just as the words say, an INPUT means we are receiving some
data into micro controller and an OUTPUT means we are
sending some data out of micro controller. In this project we
are going to blink an LED at port number 13 of micro controller.
To blink an LED means, we have to turn it ON and OFF
alternatively at a certain interval. So we are going to send
commands to turn LED ON and OFF to port 13 of micro
controller (arduino board). To do so, we have to configure port
13 as OUTPUT in our program. This is achieved inside the void
setup() block. In arduino programming language, we use a
library function named pinMode() to configure micro controller
pins of arduino. To configure pin 13 as OUTPUT, we need to
write the instruction pinMode(LED,OUTPUT); we used variable
LED to represent port 13 as we have already assigned port 13 to
variable LED.
The next block begins with void loop() – here loop() is another
predefined function in arduino programming language (APL) . This
function executes all statements written inside its parentheses line by
line consecutively; from first line inside parentheses to last line. Once
the execution finishes last line, it will repeat the process of execution
again beginning from first line in parentheses. In other words, loop() is
a function that indefinitely executes statements written inside its
parentheses. This function enables the micro controller (or arduino
board) to do a set of actions as long as it is ON. In our case, those
actions are turn LED ON and OFF at certain time intervals. So here is
how we are going to tell arduino board to do the ON and OFF process.

APL has an instruction named digitalWrite() – which is an instruction to


write some data to a particular micro controller port in arduino board.
We have connected LED to pin 13. To turn it ON, we have to supply a
voltage at pin 13. We are going to do that via software commands.
Since our arduino board is connected to PC via USB, a +5 volts readily
available. We need to pass this voltage to port 13 of arduino board. To
do so, APL has a keyword instruction called HIGH. So we just need to
write an instruction digitalWrite(LED,HIGH); and this instruction when
executed by micro controller will supply a +5 volts at port 13. This
voltage will power LED and it will turn ON. We have completed 1/3rd
of our task now. Now we need to turn LED OFF. How to do that ? You
just need to disconnect the voltage supply given at port 13. In APL,
there is a keyword instruction named LOW for this purpose. Write an
instruction digitalWrite(LED,LOW); and we cut off supply at port 13.
This instruction will turn LED OFF. We have completed 2 major tasks by
now. What remains is setting a time interval in between ON and OFF
time. Let’s prefer a 1 second time delay between ON and OFF time.
APL has a function called delay() to do this task of setting time delay.
All you need to do is write your desired delay in milli seconds as an
argument in the delay function. To get a 1 second delay, we should
write delay(1000); and this will impart a delay of 1000 milli seconds in
between LED ON and OFF time.

So here is the summary of program inside loop().


digitalWrite(LED,HIGH); will turn the LED ON. Now we need to keep
the LED ON for 1 second. We do so by keeping the micro controller idle
(or we make it to wait ) for 1 second. delay(1000); is the function we
use to keep the micro controller idle for 1 second (even though I wrote
idle, the micro controller is actually in execution mode. It is counting
an inside timer and continuously checking if it reached 1 second. You
will learn about those in next chapters). After 1 second, we need to
turn LED OFF. We do so with instruction digitalWrite(LED,LOW); this
will turn LED OFF. Now we need to keep the LED in its OFF state for 1
second (before it is turned ON again). To do so we write a delay(1000);
instruction once again just below the instruction to turn LED OFF. Since
this is the last statement inside loop() function of our program; the
micro controller will begin executing from beginning statement inside
loop() after waiting 1 second to keep LED OFF. So the LED is ON again
after 1 second.

I hope you understood how to say “hello world” using arduino. This is
a good start for any one new to electronics and arduino. If you have
any doubts, feel free to ask. I have added a photograph of the circuit I
tested below. You can also watch the video of LED blinking using
arduino.
Components Required
You will need the following components −

1 × Breadboard
1 × Arduino Uno R3
5 × LED
28 × Jumper
Program
void setup() {
// put your setup code here, to run once:
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(13, HIGH);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);

delay(500);

digitalWrite(13, LOW);
digitalWrite(12, HIGH);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);

delay(500);

digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
digitalWrite(10, LOW);
digitalWrite(9, LOW);

delay(500);

digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, HIGH);
digitalWrite(9, LOW);

delay(500);

digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
delay(500)
OUTPUT
DIAGRAM
Code explanation:
Code to Note
pinMode(2, OUTPUT) − Before you can use one of Arduino’s pins, you need to
tell Arduino Uno R3 whether it is an INPUT or OUTPUT. We use a built-in
“function” called pinMode() to do this.

digitalWrite(2, HIGH) − When you are using a pin as an OUTPUT, you can
command it to be HIGH (output 5 volts), or LOW (output 0 volts).

APPLICATIONS :-
Blinking LED circuit can be used for any visual sign indication
in any highways or it can be used in advertisement hoarding
also.LED blinking circuit can be used in signaling purpose (It can be
used as signal for help, if you are in danger)LED blinking circuit can
be used as flashing beacon.LED blinking circuit can be used as
vehicle indicator when it is broke down in the middle of the road. It
can be used in operation theaters or offices as an indication that you
are engaged in work. There are lots of applications with these two
circuits.
CONCLUSION
Today’s world the continuous need of automatic appliances is increasing day by day in
our standard of life. So there is an urgent need of developing such circuits that would ease out the
complexity of our daily life. In addition to this, the project provides enriched learning experience to
count the number of visitors in any particular location where the circuit is being implemented with
proper technological experience.
We just took up this project as we were interested in Electronics and wanted to learn
something more about it. Through this project, we learnt a lot about the overall functioning of
the circuit, uses of the various electronic components and their applications in real life. We were
also able to correlate ourselves about whatever we studied in this particular course.

RESULT
You should see your LED turn on and off. If the required output is not
seen, make sure you have assembled the circuit correctly, and verified
and uploaded the code to your board.

REFERENCES :-

➢ http://electronicsproject.org/
➢ https://en.wikipedia.org/

You might also like