[TUTO] Afficheur 7 segments Arduino 5161as, datasheet + code (2024)

SOMMAIRE ►

  • Datasheet afficheur 7 segments Arduino (pinout)
  • Connecter afficheur 7 segments avec Arduino Uno
  • Code Arduino pour afficheur à sept segments
  • Code pour afficheur 7 segments avec boutton

Vous pouvez connecter un afficheurs à sept segments à un seul chiffre à Arduino avec une planche à pain, la chose la plus importante est de connaître le pinout (le pinout de l’indicateur) pour contrôler les segments depuis Arduino Uno. Nous allons voir comment connecter un indicateur 7 segments à Arduino et réaliser un programme simple avec un timer. Nous allons contrôler l’indicateur directement depuis la carte et en utilisant le bouton poussoir.

Pour cette activité, nous aurons besoin:

  • Arduino Uno / Arduino Nano / Arduino Mega
  • afficheurs 7 segments 5161as
  • bouton-poussoir
  • résistances
  • breadboard
  • fils de connexion
Matériel supplémentaire sur ce sujet:
  1. Le registre à décalage 74hc595 Arduino
  2. Allumage et extinction LED à la suite Arduino
  3. Afficheur 7 segments à 4 digits Arduino

Arduino afficheur 7 segments pinout, datasheet

L’image montre le brochage d’un afficheurs à 7 segments à un chiffre avec une cathode commune (moins) et une anode commune (moins). Le module est un petit indicateur à DEL qui contient sept DEL (d’où le nom de l’indicateur – afficheur 7 segments) et une huitième DEL en forme de point. En allumant les LED du module dans différentes séquences à partir du microcontrôleur Arduino Uno, il est possible d’émettre différents chiffres.

[TUTO] Afficheur 7 segments Arduino 5161as, datasheet + code (1)

Notez que le panneau ne possède pas de résistances, utilisez donc des résistances externes pour connecter les DEL. Si vous ne comprenez pas le brochage d’un afficheurs à sept segments avec une anode commune, vous pouvez établir expérimentalement le brochage en connectant l’alimentation à différentes broches. En cas de mauvaise connexion, rien de grave ne se produira, mais sans résistance, les DEL peuvent tomber en panne.

Comment brancher afficheur 7 segments Arduino

[TUTO] Afficheur 7 segments Arduino 5161as, datasheet + code (2)

Pour utiliser le module 5161as / hdsp 7503 sans registre à décalage, nous devrons utiliser un grand nombre de broches de l’Arduino Uno pour allumer les LED de l’écran. Dans le premier exemple, nous allons simplement allumer / faire clignoter les LED alternativement pour indiquer les différents numéros du panneau. Assemblez le circuit comme indiqué dans l’image ci-dessus et chargez le programme suivant dans le microcontrôleur Arduino.

Programme Arduino pour afficheur 7 segments

#define A 8#define B 7#define C 6#define D 5#define E 4#define F 3#define G 2void setup() { pinMode(A, OUTPUT); pinMode(B, OUTPUT); pinMode(C, OUTPUT); pinMode(D, OUTPUT); pinMode(E, OUTPUT); pinMode(F, OUTPUT); pinMode(G, OUTPUT);}void loop() { digitalWrite(A, LOW); digitalWrite(B, HIGH); digitalWrite(C, HIGH); digitalWrite(D, LOW); digitalWrite(E, LOW); digitalWrite(F, LOW); digitalWrite(G, LOW); delay(1000); digitalWrite(A, HIGH); digitalWrite(B, HIGH); digitalWrite(C, LOW); digitalWrite(D, HIGH); digitalWrite(E, HIGH); digitalWrite(F, LOW); digitalWrite(G, HIGH); delay(1000); digitalWrite(A, HIGH); digitalWrite(B, HIGH); digitalWrite(C, HIGH); digitalWrite(D, HIGH); digitalWrite(E, LOW); digitalWrite(F, LOW); digitalWrite(G, HIGH); delay(1000);}

Explication du code afficheur 7 segments Arduino:

  1. s’est avéré être important, nous nous sommes donc limités à trois numéros. La sortie sur afficheur à sept segment d’autres numéros ne sera pas difficile;
  2. la broche 9 est utilisée pour activer le point.
[TUTO] Afficheur 7 segments Arduino 5161as, datasheet + code (3)

Dans l’exemple suivant, les chiffres de afficheur 7 segments ne changent que lorsque l’on appuie sur le bouton poussoir. Lorsque le chiffre 3 est atteint, le minuteur se remet à zéro et attend que l’on appuie de nouveau sur le bouton poussoir. Ce sont des programmes assez simples pour l’Arduino et afficheur 7 segments, pour des programmes plus complexes et intéressants vous devez utiliser le registre à décalage 74hc595 pour l’Arduino Uno.

Programme Arduino afficheur 7 segments et boutton

#define A 8#define B 7#define C 6#define D 5#define E 4#define F 3#define G 2#define BUTTON 12byte v = 0;void setup() { pinMode(A, OUTPUT); pinMode(B, OUTPUT); pinMode(C, OUTPUT); pinMode(D, OUTPUT); pinMode(E, OUTPUT); pinMode(F, OUTPUT); pinMode(G, OUTPUT); pinMode(BUTTON, INPUT);}void loop() { digitalWrite(A, HIGH); digitalWrite(B, HIGH); digitalWrite(C, HIGH); digitalWrite(D, HIGH); digitalWrite(E, HIGH); digitalWrite(F, HIGH); digitalWrite(G, LOW); delay(500); if (digitalRead(BUTTON) == HIGH) { v = 1; } while (v == 1) { digitalWrite(A, LOW); digitalWrite(B, HIGH); digitalWrite(C, HIGH); digitalWrite(D, LOW); digitalWrite(E, LOW); digitalWrite(F, LOW); digitalWrite(G, LOW); delay(500); if (digitalRead(BUTTON) == HIGH) { v = 2; } } while (v == 2) { digitalWrite(A, HIGH); digitalWrite(B, HIGH); digitalWrite(C, LOW); digitalWrite(D, HIGH); digitalWrite(E, HIGH); digitalWrite(F, LOW); digitalWrite(G, HIGH); delay(500); if (digitalRead(BUTTON) == HIGH) { v = 3; } } while (v == 3) { digitalWrite(A, HIGH); digitalWrite(B, HIGH); digitalWrite(C, HIGH); digitalWrite(D, HIGH); digitalWrite(E, LOW); digitalWrite(F, LOW); digitalWrite(G, HIGH); delay(500); if (digitalRead(BUTTON) == HIGH) { v = 0; } }}

Explication du code afficheur led Arduino 7 segments et boutton:

  1. la variable byte v = 0 est utilisée dans le programme pour passer d’une boucle while à une autre. Lorsque l’on appuie sur le bouton, la valeur de la variable v change;
  2. les numéros de port ont été remplacés par des lettres latines en utilisant #define.

Conclusion. Nous nous sommes limités à une introduction à ce module et à son application avec la carte Arduino. En utilisant plusieurs panneaux ou un indicateur 7 à quatre chiffres, vous pouvez déjà réaliser une minuterie à part entière sur l’Arduino ou une horloge en temps réel. Nous avons placé ces circuits sur notre site web dans la section Projets Arduino pour débutants, où chacun peut trouver un projet de microcontrôleur à son goût.

5/5 - (5 votes)


[TUTO] Afficheur 7 segments Arduino 5161as, datasheet + code (2024)

FAQs

How to make a 7-segment display using Arduino? ›

Connect either of the common pins (seven-segment pin 3 or 8) to the ground. And connect the rest of the pins to D2 to D9 of the Arduino through a current limiting resistor, as per the connection diagram. Just like driving an LED, it is preferable to use these current limiting resistors to increase the display life.

What is the IC code for 7-segment display? ›

In most practical applications, 7-segment displays are driven by a suitable decoder/driver IC such as the CMOS 4511 or TTL 7447 from a 4-bit BCD input.

What is the 7 segment pinout of Arduino? ›

The 7-segment display pinout is as follows. a, b, c, d, e, f, g, and DP are connected to the digital pins on an Arduino to operate the display's individual segments. By lighting up individual segments, you can create any numeric character. COM The pins 3 and 8 are connected internally to form a common pin.

How to use 7-segment display? ›

In common cathode seven segment displays, all the cathode connections of LED segments are connected together to logic 0 or ground. We use logic 1 through a current limiting resistor to forward bias the individual anode terminals a to g.

How do you create a 7 segment? ›

How to Make 7 Segment Digit
  1. Step 1: Watch This Video. yobots. ...
  2. Step 2: Material List. Thermocol, ...
  3. Step 3: Print 7 Segment Digit Image. Print this image in a paper.
  4. Step 4: Cut the Layout. ...
  5. Step 5: LED Fixing. ...
  6. Step 6: Connection. ...
  7. Step 7: Connect All Anode. ...
  8. Step 8: Connection of Cathode.

How do you set up a 7 segment? ›

Connect the ground (black) wire to any pin of the display. Then insert the positive (red) wire into each one of the other pins. If no segments light up, move the ground wire over to another pin and repeat the process. Do this until at least one segment lights up.

What is 7-segment code? ›

Seven segment displays were created to display decimal numerals. With its 7 segments, the display can show numbers from 0 to 9. Additionally, they can also display upper case letters A, C, E, F and lower case letters b and d.

What is the BCD to seven segment IC? ›

This BCD to seven segment decoder has four input lines (A, B, C and D) and 7 output lines (a, b, c, d, e, f and g), this output is given to seven segment LED display which displays the decimal number depending upon inputs.

What is an example of a 7-segment display? ›

Seven-segment displays are widely used in digital clocks, electronic meters, basic calculators, and other electronic devices that display numerical information.

How to make a 7-segment display using LED? ›

The basic thing is you have to connect all the different LEDs of each segments a, b, c, d..., ... , .. g together. Doing this, you will get seven + seven total common/base points (7 cathodes & 7 anodes).

How to connect 7-segment display to microcontroller? ›

For a common anode display, we need to connect the common anode pin to Vcc and the segment pins to the output pins of the 8051. Once the display is connected to the microcontroller, we can write a program to control the display. We can use the P1 port of the 8051 to connect to the segment pins of the display.

How to make a 7 segment display using LED? ›

The basic thing is you have to connect all the different LEDs of each segments a, b, c, d..., ... , .. g together. Doing this, you will get seven + seven total common/base points (7 cathodes & 7 anodes).

How can we display a 2 digit output on a 7 segment display? ›

Since a seven-segment display can only show one decimal or hex digit at a time, we must multiplex the two-digit number so that the digits display sequentially.

How do you make a 7 segment display work in tinkerCad? ›

You have to change this setting when you will be working on tinkerCad just click on the 7 segment display and choose common cathode option to run. You can also choose common anode for that you have connect the centre common pin of display to 5v and you have to give opposite commands in the code also.

References

Top Articles
Latest Posts
Article information

Author: Carlyn Walter

Last Updated:

Views: 6559

Rating: 5 / 5 (50 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Carlyn Walter

Birthday: 1996-01-03

Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

Phone: +8501809515404

Job: Manufacturing Technician

Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.