Sunday, February 17, 2008

RUNNING DISPLAY WITH 224 LEDs- A review..

RUNNING DISPLAY

Little projects with LEDs are always interesting. The most interesting thing about these is that the core idea behind all of these is the same, whether the work be a chaser or display and it’s the very principle which was explored by the inventors of movies. That means when we are about to do something like this chasers or any kind of displays what we have to do is mere exploring of the simple principle behind the chaser properly till it can give us a frame sufficient enough to have our work done. And the principle is nothing but switching a set of LEDs one by one ON in a sequence and of course in a timely manner. As an example lets consider the parallel port of a pc which has 8 output pins in a port (port no: 0x378) which can be controlled independently now lets assume these to be 8 switches which we can control and each is being in series with an LED. If we can operate these switches one by one faster enough, we can have a chaser with 8 LEDs controlled by our hand, which can be very easily done in a computer, having speed in range of GHz.

When it comes to control more and more objects (say LEDs) the easiest way for someone who is fresh to the digital electronics field is using decoders which enables us to control up to 2^n objects with n inputs. But the decoder is having a great barrier for us on our way from experiments to experiments that the decoder are capable of selecting only one output at a time. It is sure that the way towards success may not be so easy ever, it will be having walls of different heights, but the mind which is thirsty of success will never stop. On this behavior of the decoder we have the great speed of a computer or micro-controller which can mask the inability of selecting multiple outputs at a time. That is if we want to select some n outputs simultaneously through a decoder (or to light up some n number of LEDs at a time) let us select these one by one in short span of time in between (say in micro seconds, its possible to be even faster ) and continue selecting them one by one for some time. In this case the viewers even the very ones who know what is being done actually can not measure or see the time gap between these outputs (the human eye can see two things separately if there is a time gap of at least 1/16th of a second which can not be even compared with the speed of computers ). This is the very idea (principle) which is being exploited in our running display. Let us see in detail how the idea is being explored at some points of our journey towards the success of the running display.

The first thing to be done for the work of display was to decide the dimensions of the LED matrix that can represent all the letters numbers and special characters in the ASCII character set. An array of 7*5 came sufficient for this case. It’s not convenient to have each word and sentence get coded for our display or in other words we should have a general table which is having the display representations for each and every character, which we can define by our own. That is here we are going to define a special behavior for each character in a new standard table parallel to the ASCII character set.

The given picture in the 7*5 array of LEDs represents the letter H. To save such picture for each character is not so simple, converting these pictures to lows and highs in the output pins also raise questions towards easiness. The easiest way that can be adopted here is to consider each columns as 7 bit binary and let us code to be an array of such values succeeded by a zero indicating the end of the character ( this will help us to generate the length of the meassages dynamically and ease our job later on).

Ie let us consider the H as, here as per our method of coding each vertical column is considered as a 7 bit binary and this can be considered as an array-{127,8,8,8,127,0} where the last 0 represent the end of the character and each other numbers represent the respective vertical column converted to decimal. As it is H the place of LSB or MSB doesn’t make any change but in general the bottom bit is taken as the LSB. Thus the entire ASCII set can be coded to this coding method. With this new character set of numbers instead of characters we can simply make any message into its corresponding integer array which will be a long array of integer where each character is replaced by its code and as each character is ending with zero there will be a single line in between each character (ie if the message is HELLO the corresponding display array is-{127,8,8,8,127,0,127,73,73,73,73,0,127,1,1,1,0,127,….}).


Now what all needed is a circuit that can display our messages.

Here one thing is sure that how ever we may design the display, it should have height of atleast 7 LED. The length is taken as 32 as the vertical lines can be controlled by 5 bits through a decoder. Now we have a display board of 7*32 in size, which is controlled by vertical and hirizontal lines. The parallel port of a computer can provide a total of 12 outputs through two ports (8 from port-0x378 and 7 control outputs from port-0x37a ) exploiting this we can take 7 these outputs to control our 7 horizontal lines of the display board, the rest 5 pins can be used to controlled the vertical line as we have said earlier.

Consider the two simple for loops given below ,

for(i=0;i<32+length;i++)

for(l=0,j=i;j>=0;j--,l++)

if(j<32)

if(l

board[j]=message[l];

else

board[j]=0;

in which meassage [] is the array that contains the coded meassage(say the message is HELLO then meassge[]={127,8,8,8,127,0,127,1,1,1,0,127,1,1,1,0,…..}), length be the length of the array- message[], and board be an array of size 32 which is initialised to all zeros. In this loop the array board gets changed and it changes as,


and so on…

Let us call each of these boards as different clips now what we have to do is to show these clips at rate not slower than 16 clips per second.

Here its very easy to display the first clip, only one vertical line has to be selected so it is enough to pass a value = 0 to the 5 pins, controlling the vertical lines and a value = 127 to the 7 pins, controlling the horizontal line thus the 0th vertical line is selected and it will show 127 (binary for 127 is 1111111 ie all the 7 LEDs are lighted up ) . Now second clip should be shown, but it is not as simple as the first clip at the first sight as here we have to show two vertical lines simultaneously, one with value 127 and another with 8. And in the 3rd clip there are 3 vertical lines to be activated and so the number of lines to be activated simultaneously increases with the value of I in the above loop also in some message for some value of this I there may be some state that all the 32 lines should activated simultaneously with a decoder controlling the vertical lines !!!. Here comes the need for the principle of showing the individual lines one by one in short time and repeating it to a certain time (through which we have gone at the top). That is values 0 to 31 is passed to the 5 pins one after the other repeatedly for some time and each time if the value ‘n’ is passed to the 5 pins then the value corresponding to the column ( board[n]) is passed to the 7 pins that controls the rows. Thus it will appear that all the 32 lines are activated with their values simultaneously. Now the matter is only to change the clips just in a time equal to the persistent of vision so that the clips will appear to have a flow. This can be done by adjusting the time to show each clip.

INTER FACING THE PARALLEL PORT

Interfacing of parallel port in the circuit is very simple as all the pins are going to different points in the circuit and none of the pin is multiplexed. But there is one thing which is to be considered with a little care that here in the display board we are using 12 output pins in which 4 are the control outputs in which the 3rd pin alone is active high and the rest 3 are active low. This can be cleared by just adjusting our code, passing ‘n^11’ instead of n to the 5 vertical controlling pins will fix this issue.

INTER FACE WITH MICRO CONTROLLER

Adding a micro controller interface to the circuit made it more compact and convenient. The ATMega16 micro controller which have 4 i/o ports is used here in which port A controls the rows, port C controls the vertical columns through the decoder. We have added something more to the circuit here we have included a decimal to binary priority encoder to the circuit whose inputs are controlled by 9 switches in the board and its outputs are passed to the port D of the micro controller. The addition of input to the micro controller opened the door way to save 10 messages in it at a time and each of which can be selected using the switches which are connected to the inputs of the encoder whose output controls the micro controllers input.

Here is the sorce code



3 comments:

Ramakrishnan said...

great one da...

the post is really an inspiring one.
explains every aspect...now i am also thinking of writing a techie post.

the reply is late coz i had a problem with net connectivity yesterday.

PS: The array for hello doesnt spell HELLO but HLL...(its a minor mistake but facts presented in the technical post must be perfect)

regards

Rohith Rajesh said...

da very good explanation... I hope to see the circuit diagram as well... you can very well send it to Electronics for You magazine... there is no chance they wont print it.. its simply too good

ranju. said...

Hi ramakrishnan and rohith thanks for both of u for reading the blog and noticing me the mistakes i have tried to fix those . Please tell me if there is still any short come.