Arduino Mega with 16 Segment Display

Arduino Mega with 16 Segment Display

LED displays come in many shapes and variations. We witness these versatile displays in action every day in many different scenarios. Things such as digital clocks, elevator numbers, street signs, home appliances, digital compasses or any device that needs to display letters or numbers may use one of these expanded LED displays.

In previous tutorials we introduced the 7 segment display, this time around we will be using something a bit more adaptable. This tutorial will introduce you to a 16 segment display, and show you how to display letters, numbers, or symbols. By adding more LED partitions with a 16 segment LED display, we will have a bigger range of shapes to create and thus more letters and symbols.

 

7 Segment at 16 Segment Displays

 7 Segment at 16 Segment Displays

 

For this tutorial we will be using basic items to program the LED display, but remember that you can always get creative and expand or modify projects. 

 

Materials Needed for Project

Materials Needed for Project

 

Hardware

For this tutorial we will be using basic items to program the LED display, but remember that you can always get creative and expand or modify projects.  

 

 

 

Software

Arduino IDE software

Getting started

The concept behind the LED displays is basically the same no matter the quantities of segments. It is the wiring and programming of these individual segments that is responsible for the diversity of the displays.

If you feel that you need to review or identify the different parts of an LED display, you can take a look at our previous tutorial “How a 7 Segment Display Works”.

 

16 Segment Close up Picture

 

16 Segment Close up Picture

 

It can be confusing working with electronic devices that include several pins, so here we will show you how to identify and set up the device. Begin by checking the back side of the display, and you will notice 18 pins. In order to do the wiring properly we must assign each pin and the Gnd (ground). This information is found on the technical specifications sheet, also known as the "data sheet". When using Jaycon’s product, you can locate the data sheet in the product details pageof the 16 segment display.

 

16 Segment Mapping Diagram

16 Segment Mapping Diagram

 

 PIN1 is located in the top left corner when facing the LED with the dot segment on the bottom right corner.

Insert the 16 segment display into the breadboard (be sure to allow room for your jumper wires). The pins in this LED display are located in the left and right sides of the part, so make sure that you place each pin in independent lines in the breadboard.

 

16 Segment in Breadboard

16 segment in breadboard

 

 

Due to the amount of segments in the display, we will be requiring several digital pins (17). This is the reasoning behind selecting the Arduino MEGA instead of other arduino variations, but feel free to use any that you have. Select any digital pin on your Arduino (we started on pin 22), and assign it to PIN1 (Letter A1) on the segment.

 

Close up Connection

Close up Connection

 

Continue until all pins on the 16 segment are connected to their respected pins. If you aren’t using all of the segments, feel free to save some pins and wires off to the side. We went for it and decided to connect them all.

We started on pin 22 and completed the pinning on pin 51. On the Arduino MEGA, the even digital pins are all aligned in the left row on the digital section, so we decided to follow the line to keep the wires clean. Since the even row was full, odd pins 47 and 49 were used.

When it comes to your projects you can use any digital pin configurations that you are comfortable with.

 

Completed Project

Completed Project 

 

Remember that pin 11 is ground. Forgetting this might cause you to think that something is wrong, but don’t panic! Your display will not light up until the ground pin is connected and the circuit is complete. Connect the Arduino to the computer, using the A to B USB cable and open the Arduino IDE software.

Go to Tools > Serial Port and make sure you have selected the proper serial port.  (Ex. COM3)

Go to Tools > Board and make sure you have selected the Arduino Mega 2560 or any Arduino board you are using.

Entering the Code

Now it's time to enter the code. You can copy the code I've developed below (feel free to play with and edit this code). If you prefer, go ahead and enter your own code. We acknowledge that there are several ways to achieve results, if you have any suggestions or ideas please let us know in the comment section.

//Declare a 21 size array to hold the location of the pins that will be used in the board
//I started at pin 21 and finished at 58, they can be modified and adapted to any pins

 

int pinArr[21] = {22,24,26,28,30,32,34,36,38,40,42,44,46,47,48,50,51,52,54,56,58};

int duration = 1000; //Interval in between letters

 

// Set up which segments have to be turned on or off for each letter or symbol

//you can identify the neccesary pattern using the data sheet map

 

int letJ[21] ={1,0,0,0,0,0,0,1,1,1,0,1,0,0,0,1,1,0,0,0,0};

int letA[21] ={1,0,0,1,1,0,0,1,0,0,0,1,0,1,0,1,1,0,0,0,0};

int letY[21] ={0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0};

int letC[21] ={1,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,1,0,0,0,0};

int letO[21] ={1,0,0,1,0,0,0,1,1,1,0,1,0,0,0,1,1,0,0,0,0};

int letN[21] ={0,0,1,1,0,0,0,1,0,0,0,1,1,0,0,1,0,0,0,0,0};

int let_[21] ={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

 

void setup()

{   

 

//For loop to declare all pins as an output

//in this case because I used an uno my values were from 22 to 58

int Pin =0; //declared the pin var

 

 for (int Pin = 22; Pin <= 58; Pin++) {

   pinMode(Pin, OUTPUT);

 }

}

// this is the function that will light up the dislpay depending on which array(letter) is passed

void segmentPrint(int array[])

{

for(int i =0; i<21; i++ )

digitalWrite (pinArr[i], array[i]);

 

}

// this is the main loop where you can pass any desired array(letter or pattern) that is already defined

void loop()

{

segmentPrint(letJ); delay(duration);

segmentPrint(letA); delay(duration);

segmentPrint(letY); delay(duration);

segmentPrint(letC); delay(duration);

segmentPrint(letO); delay(duration);

segmentPrint(letN); delay(duration);

segmentPrint(let_); delay(duration);





}
//End of Code




 

Notes about the project: This is the Map of the pin segments in the display. You can create any character or letter design using the map and graphic in the data sheet.