Geek magazine hacker daily blog

1 year ago


Every year on the street, in transitions, in shops appears increasing advertizing LED panels on which the text runs both up, and down, and to the left, and to the right, and any multi-colored pictures are output. All this by itself draws attention of passersby and me including. And often I reflected as it is made and whether it is possible to repeat something similar in house conditions. And just in this semester we planned a term paper on Circuit engineering, and one of the offered subjects there was "An electronic creeping line". I thought: "You never can tell? I will try".

Search of necessary materials and first steps

Earlier somehow tried to play about with LEDs, more precisely with a LED tape, but it was the simple son of lumiere with use of one transistor. And here it is necessary somehow and to make a light emitting diode matrix, and somewhere to store the text, and somehow to output it. On "rassypukha" just like that not to make, at least with my experience.

My son of lumiere:

Heard that can be done on the Arduino platform. Heard earlier that there is such abrupt programmable payment that this project was the startup which raised considerable quantity of money, but did not go into details. And here it was necessary. Watched several video with examples of the projects implemented on Arduino it was pleasant, purchased.

In my work Arduino Uno R3, but not original, but the copy was used. As I esteemed, there is no special difference between the copy and the original. A payment Arduino has 14 digital inputs and outputs, 6 analog, inputs of an external power supply, outputs of +5 V, +3.3 B, GND. To the computer it is connected by means of USB. For programming of the microcontroller own IDE which is distributed for free on the official site of Arduino is used.

With Arduino it is clear, now it is necessary to decide how to make a light emitting diode matrix. Initially for a basis of development of the project article in which it was offered to use ready modules with light emitting diode matrixes and shift registers was selected. The scheme is submitted in figure 1. Use of ready modules, namely MAX7219, considerably would simplify development as only everything would be necessary correctly to connect and write the program for correct work and information output.


However there were difficulties with search according to this module in our country therefore it was decided to look for other method of implementation. And somehow just would be absolutely. Therefore decided that it is necessary to do a matrix most on LEDs, the benefit on the Internet is enough information as to make it.


The size of a matrix was selected by 8х10. It was initially going to use for the choice of a column of a matrix of LEDs a shift register 74HC595 which goes in a set with Arduino, and it has eight outputs. Here everyone was also responsible for a certain column. However in the course of the soldering the register leg which is responsible for Q0 output therefore it was necessary to refuse it was accidentally spoiled. In this scheme the register in fact could only reduce quantity of outputs of Arduino used for management of a matrix. At its use only three outputs would be involved, and so it was necessary to offer the 8th (with 2 on 9). The benefit that they are enough there.

Scheme of the register:


For the choice of a line of a matrix the scale-of-ten counter with the K176IE8 decoder was used. The choice fell on this chip because of its popularity, and also because it has 10 outputs, just for management of 10 lines of a matrix. The counter by means of the Arduino microcontroller through inputs of reset, the account and an output for 5 Century is controlled.

Outputs of the counter are connected to the block of transistors for management of a light emitting diode matrix. Connection will be considered in the block of transistors.

Scheme of the counter:


As a result the functional circuit turned out the following type:


Block of transistors

For management of LEDs except the signal given on anodes with 2 on 9 Arduino ports it is also necessary to give tension on cathodes of LEDs. It becomes by means of the block of transistors.

All cathodes of LEDs of every line are connected among themselves and connected to collectors of 10 transistors. Emitters of transistors are connected to "earth", and to base signals come from counter outputs.

In this project the bipolar transistors npn of type 2N3904 are used. As each transistor is connected to the line of a matrix, all in their scheme 10 pieces are used. The choice fell on this type of transistors because of their popularity, and also compliance to conditions of the developed scheme. This transistor is used in schemes with small tension. General view and UGO of this transistor:


Now it is possible to describe how there is a fire of a LED. From a certain port Arduino the signal on the LED anode is given. At the same time on the counter from a certain output the signal on base of the emitter is given. And from a collector of the transistor there is tension on cathodes of LEDs. As in a matrix anodes of LEDs of the next lines are connected consistently, and also cathodes of LEDs of the next columns are consistently connected, in at one time there is a fire of several LEDs of a matrix.

Important point! Arduino on an output issues about 5 V therefore for connection of anodes of LEDs to Arduino it is necessary to use resistors of 220 Ohms, and for connection of base of transistors to counter outputs – of 1 KOHM. It is possible to find these resistors, especially they go in starter kit of Arduino.

From thought to action, or from the scheme to implementation

As a result of the soldering it turned out the following device.


Program part

Now all this business needed to be connected to Arduino. The code by itself was written on C. First of all it is necessary to initialize ports of a payment Arduino are used. It becomes as setup () as follows:

void setup(){
int i;
for(i = 2; i < 10; i++)

clock and reset – ports 11 and 10 Arduino respectively.

First of all there is an instruction that ports with 2 on 9 are used as days off. It becomes in the scraper by means of the pinMode method (i, OUTPUT) where i – port number, OUTPUT – the flag specifying that this port output.

Further clock and reset ports are similarly initialized. By means of the digitalWrite function (reset, HIGH) giving of the high level of tension on reset port happens that thereby does counter reset. After 5 ms of a delay (delayMicroseconds(5)) on reset port the low level of tension moves.

After initialization of ports it is necessary to develop algorithm of inclusion of LEDs for an output of test information and simulation of their movement, i.e. to make algorithm of creeping line.

The separate display_symbol(int loops) function which accepts as argument value of a delay for simulation of the movement of the text was for this purpose created. It was by practical consideration established that everything is better information is perceived if value of a delay is in an interval from 15 to 25.

Let's consider internal implementation of the display_symbol(int loops) function.

void display_symbol(int loops)
  	for (int z=0;z<8;z++){ 
   		 for(int t=0;t<loops;t++){
     				byte temp = symbols[x][y]; 
     				byte temp_2=symbols[x+1][y];
   				byte val = (temp<<z)+(temp_2>>7-z);
     				for(int i =0; i<8; i++)
     					 digitalWrite(i+2, (val>>i)&B00000001;);

At first four nested loops are visible. The most outside cycle, passes on all elements of a byte array, i.e. on the displayed characters. Byte the array and its dimension is set by the developer manually looks like the following:

byte symbols[numsymbols][10]={C, X, E, M, O, T, E, X, H, I_RUS, K, A };
const int numsymbols = 13;

Each character is spread out to 10 bytes that corresponds to quantity of lines, and each byte, as we know, consists of 8 bits. Each bit is responsible for a certain LED on the scheme. An example of the character broken into bits:

#define I_RUS  {B00000000,B01000010,B01000010,B01000110,B01001010,B01010010,B01010010,B01100010,B01000010,B00000000}

For example, the 0 and 9 bytes look as B00000000, it means that in 1 and 10 lines LEDs will not burn. It is made for convenient reading information by the user. And here, for example, the 1st byte with B01000010 value specifies that in the second line for this character the 2 and 7 LEDs have to light up. Thus from all these bytes the character of a letter "I" is built.

Here that turned out as a result:

And where the promised management from the smartphone?

In principle I was with result satisfied, after all the first time soldered very much and everything earned at once. But a wish arose bigger, and I thought to add management with smartphone Android on Bluetooth. For Arduino there is a ready HC-06 module. The scheme of its connection to Arduino looks as follows:


Details of connection to Arduino and connections with the smartphone are described in this article: Bluetooth HC-06 module connection to Arduino. Connection with phone and computer
According to it the code was changed. Also decided to add the accelerated scrolling of the text, inverse ignition of LEDs and scrolling of the text with flicker. Links to a code for Android and Arduino will be below. As a result such piece turned out here:


At first, as for the developed course. The main advantage of the developed device is its universality. Thanks to a programmable payment of Arduino the project can be expanded with use different the sensor and writing of the corresponding firmwares. As a result except functionality of creeping line it is possible to add also functionality of an output of a status of weather, using respectively temperature sensors, humidity, atmospheric pressure. If to add some sensor of a sound, then it is possible to finish the scheme to a musical equalizer.

And the general outputs are that Arduino – really cool piece by means of which in house conditions it is possible to make a set of useful and just abrupt pieces which the people who devoted to electronics not one year could make earlier. Especially as there is a set of examples of different devices on Arduino on the Internet in open access. Already there is even a set of books across Arduino, one of which I precisely would advise for consideration as the manual for beginners and the advanced developers: Arduino CookBook.

Links to a code:
Scrolling Text
Part of Android

This article is a translation of the original post at
If you have any questions regarding the material covered in the article above, please, contact the original author of the post.
If you have any complaints about this article or you want this article to be deleted, please, drop an email here:

We believe that the knowledge, which is available at the most popular Russian IT blog, should be accessed by everyone, even though it is poorly translated.
Shared knowledge makes the world better.
Best wishes.