Introduction: How to Make a LED 7-segment Display With Arduino

Picture of How to Make a LED 7-segment Display With Arduino

I'm going to show you how to make a 7 segment display with LEDS. Combine with Arduino to create countdown timers, simple text, and more. I like to make original projects. I searched the whole of instructables and didn't find one like this. In fact, I searched google, and did not find any results. I thought of this when I couldn't get my real 7-segment display to work! Enjoy!
It's amazing what you can accomplish with LEDs!

How the project works:
All the anodes of one row are connected together. There are 3 LEDs in one row. See picture. When you supply voltage to the row, the whole row lights up.
So, connecting all the cathodes together, I used Arduino to program each row to turn on and off. In the picture above, here are the rows that Arduino is turning on: Row 1, 2, 4, 5, 6, 7,

Remember, the way instrucables is set up, the pictures come first, then the explanation.

If you are interested in making this project, please read over this whole instrucable BEFORE you start and get confused! And, please, don't forget too look at ALL the pictures and the boxes for them.

Here is a video of my the display using numbers. The next is it displaying the word, ALPHA.

Clip #220 from AJ on Vimeo.

Clip #219 from AJ on Vimeo.



1. What did you make?
The idea started when I was getting frustrated because I couldn't get my 7 segment display to work with one of my ICs, so I decided upon making my own, so that I'd could control it in basically any way I wanted, including simple text.
2. How did you make it?
The very first thing I did was get out my sketchbook and draw down my ideas, and how I would connect them together.
I started working on this project at 11:30 pm, and kept on going until about 4:30 A.M.. I kept on running into obstacles, such accidentally soldering the negative and positive leads of 3 LEDs together! I made it with 27 LEDs, a small piece of perf board, some basic tools, wires, and most importantly my newly-bought Arduino. I did this project by myself.
3. Where did you make it?
Well. . . I made this project all in my room, on my makeshift desk,and downstairs in our office (for programming Arduino). The more I programmed, the more problems arose, so I had to keep on running back and forth between my soldering un upstairs and the computer down stairs! I wore a path through my carpet, down the creaking wooden stairs, across the tile, over the wooden floor in my office to the computer. How did the project connect to other activities in my life? I was able to count this for my schoolwork! I aslo used this project as a show-off to Bravo, (another group in my activities, I'm ALPHA)
4. What did you learn?

  • Where do I start? I learned that I should have used a resistor for each LED, instead of one resistor
  • The BIGGEST thing I learned was how to program my Arduino!
  • I learned some more techniques about soldering
  • I also learned a little bit more about LEDs themselves

If I could do anything differently i would have bought 27 resistors and soldered them to each LED!
What am I proudest of? My success! I would have never thought it woudbe such an interest with my friends!

Step 1: Ingredients:

Picture of Ingredients:

What you will need:

TOOLS:

1x Wire strippers & snipers
1x Solder
1x Soldering pencil
1x Wire strippers & snipers
1x Needle-nose pliers 
1x Solder
1x Soldering pencil
You may need some wire cutters other than the ones on the stripper. See step 5.
Something to cut perf board

PARTS:

1x  Perf Board (http://www.radioshack.com/product/index.jsp?productId=2104052)
1x Smaller strip of perf (not necessary, but recommended)

ELECTRONICS:

21x  White (or other color) LEDs
1x 50k pot (potentiometer)
1x Arduino &  USB cable & power (optional)
Various jumper wires, MAX, 9

Step 2: Getting Familiar With the Design

Picture of Getting Familiar With the Design

We need to insert 27 LEDs into the perf, but we need to do this in an ordinary fashion. Each segment will have 3 LEDs wired parallel with each other. All the grounds will be connected. See picture and schematic. 

Step 3: Prepping the Perf Board

Picture of Prepping the Perf Board

Now we will need a template of some sort to help us arrange the LEDs.  Get your perf and place the LEDS in the holes, like the picture. Then, taking them out, use a black marker to draw where the LEDs will go.  Now what I'm about to say is kinda hard to say with text, so bear with me. There is a specific reason why I put the LEDS in the manner that they are. You might be wondering, why didn't I put the LEDs sideways. Well the reason being is that The LEDs have a little notch on the cathode side. Since the LEDs are a tight fight, this little flat end on the cathode enables the other LED to push up right next to it. If they were laid out sideways, there would be no flat groove, and the LEDs would not sit all together flat on the board since they are too close to each other. Try it out, and you will see what I'm talking about. I HOPE you understand!

[1/21/13 UPDATE]

I added some photos of how the LEDs fit. The first picture is of them vertically, and the second is of them sideways(horizontally). 

Step 4: Putting in the First Set of LEDs

Picture of Putting in the First Set of LEDs

Well, I forgot to take a picture of the first set of LEDs, so ignore the right side of the picture. On the left side of the picture, you can see I used my finger to make sure all the LEDs are sitting flat on the perf. Then, I bent all the negative leads back towards my thumb, then all the positive LEDs toward the out side of the board. 

Step 5: Soldering the First Set

Picture of Soldering the First Set

THESE STEPS APPLY FOR ALL THE POSITIVES AND ONLY ONE NEGATIVE.

1. Now, this step might be a little tricky. Using some needle-nose pliers, bend the cathode lead at the end at a right angle, facing the other negative leads. See picture. 
2. Bend the other leads to form an X over a hole. Sorry, I forgot to take a picture of the first one (hey, I was trying to figure this out!). Just look at the second one. 
3. Take a 4-8 inch insulated jumper. Using needle-nose pliers, make a small 90 degree angle at the very tip. The key to this is to make sure the bend part is not bigger than the thickness of your pert, or else it will be sticking out the other end, and you don't want to see that. 
4. Now insert the pre-stripped insulated jumper wire into the hole you made an X over. Make sure the jumper goes under the X. 
5. Now fill with solder.
6. Trim the leads if necessary. 

[PLEASE NOTE, THIS ONLY APPLIES TO THE ANODE (positive) LEADS OF THE LEDs. YOU WILL ONLY NEED TO DO THIS WITH ONE CATHODE]

Step 6: Finish All the Soldering

Picture of Finish All the Soldering

Now basically your going to do that with all 27 LEDs. Keep on adding the rest of the rows. DO NOT forget to check each segment when done. Use some alligator clips to connect the negative rail to the positive rail. Theoretically, they should work. If not, run simple diagnostics, and fix it!

Step 7: The Out Wires

Picture of The Out Wires

Now, you need to organize all the positive outs. There are 7 red outs. When you connect ground to - volts, you should be able to touch + volts to each of the outs, and the corresponding row of LEDs should light up!
In the second photo, you can see that I cut  and stripped all the wires to about the same length. 

Step 8: Converting to Solid Core Wire

Picture of Converting to Solid Core Wire

This step may not be necessary. Since I didn't use solid core wires on the OUT wires, I need to solder them to some solid core wires. If you used long enough solid core wires, you may skip to step 9. Also, you could just solder some jumpers to the OUT wires, but, I like this. 
1. Cut a small piece of perf.
2. Bend a 45 degree angle at the end of a jumper.
3. Insert into perf.
4. Push the end of the angled part of the jumper into the whole behind it. See picture.
5. Repeat, until all 8 jumpers are done. 
6. Cover the backside in hot glue. 
7. Solder the wires onto the top.
8. Cover them in hot glue. 

Step 9: Reordering the Out Wires

Picture of Reordering the Out Wires

So, since I want to be able to know which wires go to each row, I need to reorder them. If you reordered them in step 8, you may skip to step 10.

Using some alligator clips, I tested each wire. Then, I put it in the correct order. You can see all the twists in the picture. 

Step 10: [UPDATE] Adding Resistors for the LEDs

Picture of [UPDATE] Adding Resistors for the LEDs

At the time I built this project I didn't know about the positive temperature coefficient with LEDs, but now that I know, it's time to fix it!

Instead of adding a resistor to each LED, I'll just add a resistor to each row. I'll use a 100 ohm resistor. (do that math, it equals to 83.33--)

See the drawing I made for where the resistors should go.


Step 11: Soldering the Potentiometer

Picture of Soldering the Potentiometer

You may skip this step, but I wanted to have an easy way to adjust the brightness without have to mess with the code. I'm an Arduino beginner!
Solder the ground wire to the far right terminal of the pot. Then solder a small jumper to the middle connection on the pot. This is the wire that will go into the Arduino.
Please note: This IS NOT the potentiometer I used. My pot was in the mail at the time. The one shown in the picture is for illustrational purposes. This type of pots don't seem to work well- get the guitar amp type. Sorry the picture is focused on the Arduino and not the pot. Dumb auto-focus!

Step 12: Hooking It Up!

Picture of Hooking It Up!

Now, this is where your Arduino comes in handy. Plug in all the jumpers into pins 1-7 and ground to GND on the Arduino, and start programming! Here's a link to the code for the 123456789 sequence.
https://dl.dropbox.com/u/22807091/Arduino/LED_7_segment_display.ino
Again, I am a Arduino beginner, but this code seems to be pretty good. This is probably the hardest thing I've done with my Arduino, so you can see where I'm at. Still stuck on digitalWrite, HIGH AND LOW! 
Now, if you don't have and Arduino, you can simply hook up each segment to a different on/off switch. Since I didn't have 7 switches, I couldn't do this. This would make your project more pocket-sized then with an Arduino, but, my stock of parts always seem to be limiting my projects!

Use the potentiometer to control the brightness of your sequence!

Step 13: Closing Thoughts

I hope you guys enjoyed my instructable, as this is my very first step by step instructable. I tried to complete, giving as many details I could think of! Please vote it as a winner for the Pocket-sized Contest, the Design Contest, and the Holiday Gift Contest! For a gift, mount the display in a nice box, and program the text to say, HAPPY HOLIDAY or HAPPY BDAY. Note: you are somewhat limited in what letters you can display, such as capital R, Z,W,X, and others. 
Modify the code so that it is a timer! Each number starting from 9 and lasts 10 seconds, and use it in your next game of Scattergories! Hit a reset button and go again!

Please! post your pics of your project! I'd love to see them!

If I made mistakes, please let me know!

Questions? Comment below or PM me!

Comments

MD MAMUNUR RASHID (author)2017-07-22

Code link does not work ... plz chk out

docman100 (author)2017-03-16

it says the vids don't exist...

deathofme (author)2016-03-29

what this segment work with a 4026 555 setup just wondering

HavocRC (author)deathofme2016-03-30

Yeah it's just like any other 7 segment display. Be careful about power consumption though.

deathofme (author)HavocRC2016-03-30

thanks just wanted to know so I.vould build my own

Jules Mario Flores (author)2016-02-29

sir can you help me about the code of this 7-segment led display?

by FoamboardRC

What do you need help with?

hi can i have some hints about the structure of the code of this 7 segment i need it for our project sorry for the late reply.

You are going to be a little more specific! I eplained how the code work and told you how to change numbers. What else do you want it to do?

Oh thank you i have seen it already thank you for everything ill chat you when i have finish this project

AstikG (author)2015-08-28

what ardruino we need can you plss elaborate?

Erfunden (author)2013-01-21

That is pretty sweet! Would it be possible to build a 16 segment display similarly? Could an arduino handle that?

HavocRC (author)Erfunden2013-01-21

Wow, I just got finished reading about using Arduino's analog pins yesterday!
Ok, here's what I found.
7 segment display = 7 pins. 16 segment display = 16 pins. The Arduino Uno only has 13 digital pins. But, you can set up Arduino's analog pins to work as digital pins. Arduino Uno has 5 analog pins, and making those work as digital, thats 13 + 5 = 18. Yes, you could make a 16 segment display. Interesting thought. I might have to try that!

Here's a link for more reading.
http://arduino.cc/en/Tutorial/AnalogInputPins

ray74 (author)HavocRC2013-01-29

Check out 74hc374 or 74hc164 or 74hc595 or similar chips. They can be used to expand your outputs.

HavocRC (author)ray742013-01-30

Oh yes, I have one of those chips, I just don't really know how to use it :D

HoneyL (author)HavocRC2015-01-27
HoneyL (author)2015-01-27
ingkiller (author)2014-10-07

im seeing an arduino allthough is says without arduino :o

marcmert (author)2014-09-20

Has anyone here tried using two digits instead of one?

HavocRC (author)marcmert2014-09-23

Yeah just replicate the first one, and hook them both up to a shift register for multiplexing.

steinie44 (author)2014-03-15

Where are the other 6 leds? 7 segments X 3 = 21 leds.

botgames (author)2013-11-11

Great instructable! Very informative, fun and easy to follow. Mine worked the first time! Thanks!

HavocRC (author)botgames2013-11-12

Awesome and thanks! Would you mind posting a picture of it?? Thanks!

botgames (author)HavocRC2013-11-12

Your welcome! Here's a picture of mine. I made more than one but this is the final one. It came out pretty good I think.

HavocRC (author)botgames2013-11-12

Love it! It sure did!

Raphango (author)2013-10-29

Whoa! Excellent instructable!
I liked specially the Step 1 photo, because it is quite elucidative with the materials positioned in a way that shows exactly wich thing goes where.
Congratulations!

HavocRC (author)Raphango2013-10-29

Haha after looking up the word elucidate thanks!

elink5319 (author)2013-07-28

Thanks so much for the tutorial, I am a 59 year old beginner myself, with no background in electronics, only what I read, and try and to build myself. Simple projects, it is a fun hobby.

Raphango (author)elink53192013-10-29

It's never too late to begin!
I admire your courage! I'm a beginner too.
It's quite a fun and healthy hobby indeed! ;)

Keep up the good work! =D

apollo the great (author)2013-06-16

can i use a bread board so i dont have to solder

HavocRC (author)apollo the great2013-06-19

Certainly

polkijain (author)2013-05-30

will the arduino not crash with the 9v battery input(i suppose the operation range is somewhere around 5v)

HavocRC (author)polkijain2013-05-31

5v-12v. 12v is a little overboard. 5v works just fine as well as 9v.

polkijain (author)2013-05-30

great project
-few ques?- what is the use of the 1x 50k pot (potentiometer)
- will the project work without that
- can i control the letters with the pot directly(i mean without avr)

HavocRC (author)polkijain2013-05-31

1. Watch the video.
2. Yes.
3. Yes. See https://www.instructables.com/id/LEDs-for-Beginners/. After you've learned the concepts you'll be able to not use an Arduino.

polkijain (author)2013-05-30

wat is the use of the resistors?

HavocRC (author)polkijain2013-05-31

In short, to keep the LEDs from burning out.

http://en.wikipedia.org/wiki/Resistor
https://www.instructables.com/id/LEDs-for-Beginners/

Read up!

WakeUpWolfgang (author)2013-03-25

I love it!! I am going to make a clock using this I have all of the LEDs soldered already I am just trying to decide how I want to control it. I don't know if I want to use an Arduino or a PIC or 74XX logic gates.

HavocRC (author)WakeUpWolfgang2013-03-25

Sweet! That's awesome! I'm glad you liked it. Be sure to post pictures of it when you are done!

faziefazie (author)2013-03-16

this is the picture of my LED 7-segment display, not so good as yours. and it still on my protoboard, I will change it to PCB printed soon :)

but, If I want to add a push button for the input and used for changing the characters, can you help me what the code should be add as an interrupt?
I'm sorry if I'm so greedy with the question, I'm just curious :|

HavocRC (author)faziefazie2013-03-17

Hey nice job promad! Ooh, umm, like I said, I'm no Arduino expert. I have no idea how to do that. What you should do is go to the forums and ask about that.

faziefazie (author)2013-02-16

wow thanks for the explanation, I'll be waiting for the update step from you about 'adding resistors'. Thank you very much :)

HavocRC (author)faziefazie2013-03-11

You're welcome! Oh, and I added the resistors, see step 10!

agm88 (author)2013-03-11

cool

HavocRC (author)agm882013-03-11

Thanks! Post your pictures of yours!

faziefazie (author)2013-02-15

Sorry if I ask too much. But is it okay for not using resistor for each led? and just solder a 100-300 ohm resistor in series with the potentiometer? Because my friends told me that the LED gonna be frying all at once if I didn't put a resistor for each row/led. I'm so confused.

HavocRC (author)faziefazie2013-02-15

Hmm, very good question. Your friends are pretty much correct. I had the same question you had. You can see it here https://www.instructables.com/answers/Why-waste-the-resistors/

This is from steveastrouk

". . . LEDs have what is called a positive temperature coefficient. If they get hotter, they pass more current. In a parallel chain, one will get hotter and steal current from the others,which will get cooler, and give more current to the hotter LED which will get hotter- and so on. . . "

If one (or worse, several) LED(s) are getting an too much current, it will die, leaving you sorry you wasted 27 LEDs and a bunch of soldering. At the time I didn't know this, but I'm going to be adding the resistor step here shortly. (so I don't look like a dumbo) :D

faziefazie (author)2013-02-10

Is it possible If I want to replace Arduino with IC micro controller, how can it be works? can you tell me please?

HavocRC (author)faziefazie2013-02-10

Proma, I'm really sorry, I have no clue about other micro controllers. What you can do is ask a question on instructables forum, and post a link to my instructable, and ask if you can do it.

About This Instructable

65,973views

183favorites

License:

Bio: 19 year old hobbyiest and future EE.
More by HavocRC:DIY FPV Antenna Protector CaseControl Your RC Plane With Your Phone's AcclerometerDIY Receiver Controlled Switch (Cheap and Easy)
Add instructable to: