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

Arduino Push Button & 7-Segment Display Guide

This document describes the use of a push button and a 7-segment display with Arduino. It explains how a push button works, and then how to display numbers and letters on a 7-segment display by individually connecting each segment to an output pin of the Arduino.

Translated by

ScribdTranslations
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)
11 views6 pages

Arduino Push Button & 7-Segment Display Guide

This document describes the use of a push button and a 7-segment display with Arduino. It explains how a push button works, and then how to display numbers and letters on a 7-segment display by individually connecting each segment to an output pin of the Arduino.

Translated by

ScribdTranslations
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

TP 2: Push buttons & 7-segment display under

ARDUINO

PART A: use of a push button


Presentation:
Buttons are the simplest sensors. By pressing a button, you connect its wires, in such a way...
Fortunately, the button acts like a switch. By releasing the button, we interrupt the circuit. There exists
buttons of different sizes and shapes. When using a test plate, it is practical
to use a button with four wires. The wires operate in pairs, so that two adjacent wires
are always connected to each other.

Figure 1: Different views of a push button


The principle of this button is that when you press it, the current flows, and when you release it, well...
the current no longer passes. Unlike a switch, it does not hold the position (it is necessary to keep the
finger on it to make contact.
To understand, the Arduino can read a value of +5V or 0V. So in theory, if we send the
+5V on a push button, when it is pressed, it allows current to pass and the Arduino receives +5V, it indicates
So HIGH (or 1). If the button is open, the Arduino should receive nothing, so it should be at 0V and indicate
LOW (or 0).
Here is the corresponding assembly for connection on pin 10:

Figure 2
1/6
When the button is lifted, it is ultimately not connected to anything. The result read by the Arduino is therefore low.
interpretable. There is a way to force the Arduino to read something, simply by adding
of a resistance...

10 KΩ pull-down resistor 10 KΩ pull-up resistor

1. Explain the operating principle of the two diagrams presented above and indicate the role of
the resistance R(10KΩ)
…………………………………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………………………………
To read the state of the push button, you need to use the function: digitalRead(pin).
Manipulation :
Write a program that allows you to turn on the LED associated with pin 3 when the button is pressed.
Button associated with pin 2, the LED should turn off and when the button is released, the LED should turn on.
In other words, as long as the button is off, the LED is on.

Figure 3
2/6
➔Compile the program.
➔ Create the diagram in PROTEUS and transfer the .hex file to the microcontroller.
➔Then simulate the operation.
➔ Create the wiring diagram.
➔Transfer your compiled program to the microcontroller, then validate the operation.

PART B:
Presentation
A 7-segment display has 7 LEDs embedded in a casing. Therefore, there are 8 sections.
counting the decimal point (DP) of the display. These are the little lights that form the number 8 and that
are red or green in color most of the time, but can also be blue, white, etc.

2. Segments of the 7-segment display


a) Consult the technical datasheet of the display LD5613AR, and determine if it is a
common cathode or common anode display. What is the color of its light?
numbers (LED) ?
b) Determine the meaning of the ten pins.
Is it necessary to use resistors with this display? Why?

3. Wiring of the 7-segment display to the Arduino


. For the components, use a common cathode display, 8 resistors of 270Ω.
(Generally, a 270Ω resistor will be used for a voltage of +5V. If we want
to increase brightness, simply decrease this value. If on the contrary (decrease the
(brightness), the resistance must be increased).
. Place the display over the test plate, find the pin representing the anode.
connect and link it to the future +5V column. Afterwards, put a resistor on each
signal pin. Finally, connect some of these resistors to the ground of the Arduino.

3/6
Power the Arduino board (via USB cable / PC). Check the proper functioning of the display: the
segments connected to the mass via their resistances should light up when you power the circuit.
4. Manipulation 1: Display numbers and letters
a) Take the previous diagram again, but by connecting each pin (segment) of the display to
an output from the Arduino board, where each LED of the display will be controlled separately
one another.

4/6
Assembly instructions
. Connect to pin 2 (configured as output) the
pin of the segmented digit via a resistor in
series
. Connect to pin 3 (configured as output) the
connect the digit segment via a resistor in
series
. Connect to pin 4 (configured as output) the
connect the digit segment via a resistor in
series
. Connect to pin 5 (configured as output) the
pin of the segment of the digit through a resistor in
series
. Connect pin 6 (configured as output) to the segment g of the digit via a
series resistance
. Connect pin 7 (configured as output) to the segment pin of the digit via a
series resistance
. Connect pin 8 (set as output) to the segment pin of the digit via a
series resistance
. Connect pin 9 (configured as output) to the segment b of the digit via a
series resistance

Preparation of the assembly and programming of the Arduino board:


b) Write the program to display the digit 0 for example (use the appendix).
c) Modify the previous program so that we can display the digits from 0 to 9 and the letters.
from A to F successively.
d) Start by assembling the setup indicated on the experimental board.
e) Then, test the program.

5/6
Annex

//Here is the code to display '9':


int neuf[] = {LOW, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH};
void setup()
{
Note that we do not manage the display of the point
int i;
for (i = 2 ; i <= 9 ; i++)
{
//definition of the output pins (2 to 9)
pinMode(i, OUTPUT);
set these outputs to HIGH to turn off the LEDs
the display
digitalWrite(i, HIGH);
}
}
void loop()
{
//display the number 9
int i, j = 0;
for (i = 2; i <= 9; i++, j++)
{
digitalWrite(i, nine[j]);
}

6/6

You might also like