Interfacing of Seven Segment with Arduino in Proteus

Hello friends, today we are gonna have a look on how to interface Seven Segment with Arduino in Proteus. In my last post, I have posted an Arduino Library for Seven Segment Display, which is designed by our team and is quite basic in functionality. So, if you haven't checked that post then first of all check that one and download the Arduino Library for Seven Segment Display as I am gonna use that library in today's post. Moreover, in order to run this library you are also gonna need to download Arduino Library for Proteus, using this library you will be able to use Arduino board in Proteus so also read that post and download this library and install it in your Proteus.

Again I am mentioning that its the first library designed by our team so its in basic stages, it has few functions and will only display the numeric on the seven segment display which is normally required. I am planning on adding more examples in the library for future use, which will increase the functionality. Anyways that's a future talk, let's start today's post.

What is Seven Segment Display?

Let's first have a look at what is Seven Segment Display. Seven Segment display is nothing but an electronic device used for displaying the numeric data. It's a complex form of LED matrix and is normally used in clocks, LCD displays, calculators etc where there's a need to display the numeric data. It has total seven leds in it which you can also count from above image and by turning these LEDs ON or OFF we can display any numeric on it. For example, have a look at the below image. In this image I have shown numeric 0 on seven segment. Now in order to do so, I just simply turn OFF the centered LED and turn ON all the corner LEDs and it becomes 0.

How does Seven Segment Work?

Now, let's have look at how it works. So, we have seen that Seven Segment is named seven segment because it has total seven LEDs on it so now what we need to do is to control these seven LEDs, also named as segments, and then we can display any character on it. There are two types of seven segments available in the market and named as:

  • Common Cathode
  • Common Anode
They both work exactly the same and has only a slight difference. They both has total seven pins and each pin is used to control each led and they have an extra pin which is named as Common Pin. In Common Cathode you have to GND this Common Pin, while in common Anode, you have to give +5V to this Common Pin. Have a look at this below image, we have labelled leds with respect to the pins.

Interfacing of Seven Segment with Arduino in Proteus

  • Now we know all about Seven Segment Display and know how it works so let's interface Seven Segment with Arduino in Proteus.
  • Now, I am assuming that you have installed the Arduino Library for Proteus and have also installed the Arduino Library for Seven Segment display.
  • So, now open your Arduino Software and go to File>Examples>SevenSegment>Counting.
  • Open this example, in this example I have added a counter which will start counting from 0 to 9 and once it reached 9 then it will start counting again.
  • If you can't find this example then you must be making some mistake in installing the library, anyways the code is shown below.
Note:
/* Counting This Arduino example is for Seven Segent display. It will start the counter from 0 and will end up at 9 and will start again from 0. This example code is in the public domain. Created by Syed Zain Nasir at 14 March 2015. You can get the explanation and latest version of this library at: http://www.TheEngineeringProjects.com/ */ #include "SevenSegment.h" SevenSegment tep = SevenSegment(0,1,2,3,4,5,6); char arr [10] = {'0','1','2','3','4','5','6','7','8','9'}; int index; void setup(){ index = 0; } void loop(){ tep.display(arr[index++]); delay(1000); if(index == 11) index = 0; }
  • Now open you Proteus Software and design the circuit in it as shown in below figure, I have also attached the file for download at the end.
  • Now compile the code and gt the hex file and upload it in your Arduino Properties.
  • Now Run the Proteus software, and you will see the seven segment display will start counting, a glimpse of it is shown in the below figure:
  • Below is attached the Proteus file and the hex file for the counting example which you simply start and run but again I suggest that you should design it by yourself so that you get something out of it.

Download Proteus Simulation of Seven Segment with Arduino

  • One last thing, any kind of contribution to this library from the readers is highly appreciated, design your projects and share codes with us and we will post them on our blog for other readers to get knowledge as knowledge is all about sharing.
That's all for today, hope it will help you in some way. Take care and have fun. :)

Arduino Library for Seven Segment Display

In today's post, I am gonna share a new Arduino Library for Seven Segment Display. In my recent project, I got a chance to work on seven segment displays, I have worked on them using PIC microcontroller but haven't got a chance to use them with Arduino. So, now as usual when I started working on them, I started searching for Arduino Library but I kind of got disappointed after getting quite heavy libraries for seven segments, and after a lot of search I thought of designing my own Arduino library for seven segment display, which I am gonna share in this post. :)

It's not very advanced library as we know seven segment displays are not too complex, so its quite simple and using it you can quite easily display any numerical digit on the seven segment display. Moreover, I have also included an example with the library which will start the counter from zero on seven segment display and keep on incrementing till 9 and after that it will start again from zero. Moreover, I have also posted the example about Interfacing of Seven Segment Display with Arduino in Proteus using this library, it will help you in better understanding of How this library works. You can download the working Proteus Simulation as well as hex file from that post.

Download Arduino Library for Seven Segment Display

  • As I stated earlier, its a very simple Arduino Library for Seven Segment Display and it will only print the numeric on seven segment display, but I will work on it in future and will update it by adding more features in it.
  • So, first of all click the below button to download the Arduino library for seven segment display.

Download Arduino Library for Seven Segment Display

  • After downloading the library, place it in the libraries folder of your Arduino software.
  • Now close your Arduino software and open it again.
  • Go to File and then Examples and you will find SevenSegment in it and it will have an example which is named as Counting.

Functions in Arduino Library for Seven Segment Display

  • I have added quite few function in it which are very basic and are very easy to use.
  • The first function I have used is:
SevenSegment(int a,int b,int c,int d,int e,int f,int g);
  • In this function, you need to give the pins of Arduino with which you are attaching your seven segment display. It will called as shown below:
SevenSegment tep = SevenSegment(0,1,2,3,4,5,6);
  •  Now tep is our seven segment object and we are gonna use it in rest of the example.
  • The next function used in this arduino library for seven segment display is:
display(char c);
  • This function will display the numeric on seven segment display which you will provide it.
  • Moreover, it will automatically clear the screen before displaying any new character on the seven segment.
  • It is called in the example as shown below:
tep.display('1');
That's all for today, in this next post you can download the example of how to Interface Seven Segment Display Using Arduino in Proteus, it will help you in understanding of this library in detail.
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir