Sports scoreboard – Learning path project 8

Our Learning Path is an itinerary designed to teach all the foundaments and a little more about electronics, coding and robotics.

When you complete all the projects you will be able to develop almost any project you can imagine. In each chapter new concepts are introduced. You will learn by doing in a funny way.

See how include 7-segment displays to your projects building a fantastic scoreboard.

Project 8
SPORTS SCOREBOARD

Use our 7 segment display to show any four digits number

BEFORE TO START

DIFFICULTY LEVEL: Intermediate
DURATION OF THE ACTIVITY: 40 min.

MATERIALS:
4in1 board
Buzzer
Battery holder & wires
Battery holder & wires
Battery holder & wires

1 - Build&Code 4in1 board
1 - 7 segment 4 digits display
1 - Switch button module
1 - Any analog sensor

Battery holder, USB cable and wires.

8. Seven-segment display counter

The LED screen with 4 digits and 7 segments has 7 LEDs that make the shape of an “8.” By controlling when each LED turns on and off, you will be able to display the letter or number that you need.

Seven-segment display are used many time ago to show any number easily, and not only with LEDS, fore example there are mechanical ones also. Perhaps you have seen them in some airport. Also exists alphanumeric displays, with more segment, but we don't use it.

All possiblities lighting different segments

8. Seven-segment Display - Circuit

Seven-segment display has 4 pins, needs 4 wires. Two for power it, as habitual, and two more connected to digital pins to control segments states.

Connect wires from 4in1 board to components:
- DIO3to CLK pin of display
- DIO2 to DIO pin of display
- A2 to Analog sensor

8.1 Seven-segment display - Show your birth year

To program easily the display, we need to use TM1637 library for Arduino IDE. Download here the arduino library for TM1637. In MBlocks is not possible to use this element, but soon will be a library for it!
In this exercise you will see how to write any 4 digit number in the segment display. 3... 2... 1... GO!!

Arduino Coding
#include <TM1637.h>   //Librería necesaria para el display de 7 segmentos con integrado TM1637 

#define CLK 3     // definir CLK  
#define DIO 2     // definir DIO

TM1637 tm1637(CLK,DIO);
void setup()
{
tm1637.init(); // Inicializa modulo
tm1637.set(3); // Brillo, 0 (minimo) a 7 (maximo)
tm1637.point(POINT_OFF); // Apaga los puntos, POINT_ON para encenderlos
}


void loop()
{
int day[]={0,8};      // day de aniversario, por ejemplo el day 8
int month[]={0,1};      //month de aniversario, por ejemplo enero

tm1637.display(0, day[0]); // Digito 0 => 0
tm1637.display(1, day[1]); // Digito 1 => 8
tm1637.display(2, month[0]); // Digito 2 => 0
tm1637.display(3, month[1]); // Digito 3 => 1
}
8.2 Analog output on display

Read the analog sensor value and show it on the 7 segment display. Remember you just have 4 digits!

Arduino code
#include <TM1637.h>       //Librería necesaria para el display de 7 segmentos con integrado TM1637 

#define CLK 3         // Definir CLK  
#define DIO 2         // Definir DIO


TM1637 tm1637(CLK,DIO);
void setup()
{
 
tm1637.init();            // Inicializa modulo
tm1637.set(3);            // Brillo, 0 (minimo) a 7 (maximo)
tm1637.point(POINT_OFF); // Apaga los puntos, POINT_ON para encenderlos
}


void loop()
{
int value= analogRead(2);   //lee valor del sensor analógico, generalmente como máximo será un valor de 4 cifras

int number1= value/1000;             // dividiendo entre 1000 obtenemos el valor del primer número del sensor
int number2= (value%1000)/100;      // dividiendo entre 100 el resto del valor entre 1000 obtenemos el segundo número 
int number3= (value%100)/10;       //  dividiendo entre 10 el resto del valor entre 100 obtenemos el tercer número 
int number4= value%10;            // el resto del valor entre 10 nos proporciona el cuarto número del sensor


tm1637.display(0, number1); // Digito 0 => primer valor del sensor
tm1637.display(1, number2); // Digito 1 => segundo valor del sensor
tm1637.display(2, number3); // Digito 2 => tercer valor del sensor
tm1637.display(3, number4); // Digito 3 => cuarto valor del sensor
}
Final project - Sports scoreboard

Seven-segment display is perfect to show clearly match puntuation. We propose you to make a typical sports scoreboard. Here cardboard template

Arduino code
#include <TM1637.h>       //Librería necesaria para el display de 7 segmentos con integrado TM1637 
#define CLK 3         // Definir CLK  
#define DIO 2         // Definir DIO
TM1637 tm1637(CLK,DIO);
void setup()
  { 
    tm1637.init();            // Inicializa modulo
    tm1637.set(3);            // Brillo, 0 (minimo) a 7 (maximo)
    tm1637.point(POINT_OFF); // Apaga los puntos, POINT_ON para encenderlos
  }
void loop()
  {
    int value= map(analogRead(A2), 0, 1023, 0, 9999);  //lee valor del sensor analógico, generalmente como máximo será un valor de 4 cifras
    int number1= value/1000;             // dividiendo entre 1000 obtenemos el valor del primer número del sensor
    int number2= (value%1000)/100;      // dividiendo entre 100 el resto del valor entre 1000 obtenemos el segundo número 
    int number3= (value%100)/10;       //  dividiendo entre 10 el resto del valor entre 100 obtenemos el tercer número 
    int number4= value%10;            // el resto del valor entre 10 nos proporciona el cuarto número del sensor
    tm1637.display(0, number1); // Digito 0 => primer valor del sensor
    tm1637.display(1, number2); // Digito 1 => segundo valor del sensor
    tm1637.display(2, number3); // Digito 2 => tercer valor del sensor
    tm1637.display(3, number4); // Digito 3 => cuarto valor del sensor
    delay(200);
  }
previous arrow
next arrow
Slider

The Mega Maker Kit fits perfectly with the Learning Path, you can build all projects with it, but if you have other kits, you can also follow the entire itinerary and finish some projects, or buy the missing components. You can check in our Learning Path page.

0 0

0