LED cube 5x5x5 on a pic controller. LED cube

The cube described on this page uses a 5 x 5 x 5 matrix with a single LED color. This is a good size for an experiment, but the number of LEDs required is 125, which adds to the cost. Power - up to 1 amp current and 5V voltage i.e. 5W (simple arithmetic).

The entire cube is updated every 10ms (100Hz). This does not result in any visible flicker.

Each of the LED layers are arranged in a 5 x 5 matrix and are controlled by transistors connected to the LED anodes. With appropriate control of the layer, a high level of the transistor base comes out of the PIC, +5 V and the emitter is about 0.7 volts. Transistors used are BC637 NPN if alternatives used must be of similar specification.

The LED cathodes are connected to IC2 AND IC3. These STP16CP05 16-bit constant current driver for LEDs. The 680R resistor gives the LED current ~28mA; the value of this resistor can be changed to fit different LEDs (different LEDs have different ratings).

One cube layer:

One column of LEDs in a cube:

Capacitors provide power... C4 and C5 in particular are important and should be tantalum, located near the ICs.

As for LEDs, you can use almost any 5mm or 3mm LEDs you want.

In my opinion, cubes with 3mm LEDs have more space inside the cube, which makes it more visually beautiful.


Rice. 3


Fig.4


Fig.5


Rice. 6


Fig.7


Rice. 9



Fig.10

Rice. 12

Fig 1. The anode must be bent at an angle of 90°.

Figure 2. Connect the anodes together, and the cathodes should be perpendicular to the anodes.

Figure 3. Using a 5 volt power supply and a resistor (from 120 to 330 ohms), you need to check and visually make sure that everything is soldered correctly. Apply "+" to the anode and "-" to the cathode and the LED should light up. Resistance is necessary to limit the current! Don't forget when checking!

Attention. If you skip this test and get the LEDs assembled in a cube, it will be very difficult to find the LED that is not working!

Fig 4,5,6. Install the LEDs in the next row and solder their anodes together.

Figure 7. Continue installing LEDs in each of the rows, soldering and testing as you go.

Fig 8. With all five rows completed, solder the wires in all rows and place them in a layer into the mold. This wire also serves as electrical connections. Note which wires go above and below the LED anode leads.

Repeat the previous steps for each of the five layers.

Figure 9-12. These photos show the general layout of the cube LEDs.

The cube described in this article uses a 5 x 5 x 5 matrix with one LED color. This is a good size for an experiment, but the number of LEDs required is 125, which adds to the cost. Power - up to 1 amp current and 5V voltage i.e. 5W (simple arithmetic).

The entire cube is updated every 10ms (100Hz). This does not result in any visible flicker. Each of the LED layers are arranged in a 5 x 5 matrix and are controlled by transistors connected to the LED anodes. With appropriate control of the layer, a high level of the transistor base comes out of the PIC, +5 V and the emitter is about 0.7 volts. Transistors used are NPN if alternatives used must be of a similar specification.

The LED cathodes are connected to IC2 AND IC3. These are 16-bit constant current driver for LEDs. The 680R resistor gives the LED current ~28mA; The value of this resistor can be changed to accommodate different LEDs (different LEDs have different ratings).

Capacitors provide power... C4 and C5 in particular are important and should be tantalum, located near the ICs. As for LEDs, you can use almost any 5mm or 3mm LEDs you want. In my opinion, cubes with 3mm LEDs have more space inside the cube, which makes it more visually beautiful.


The most important thing: LED assembly! First, you need to make a breadboard for the LEDs so that everything is smooth and beautiful - the archive contains the file LED_jig_template.pdf, specially designed for this purpose.

The anode must be bent at an angle of 90°. Connect the anodes together, and the cathodes should be perpendicular to the anodes.

Using a 5 volt power supply and a resistor (120 to 330 ohms), you need to check and visually verify that everything is soldered correctly. Apply "+" to the anode and "-" to the cathode and the LED should light up. Resistance is necessary to limit the current! Don't forget when checking!

Attention. If you skip this test and get the LEDs assembled in a cube, it will be very difficult to find the LED that is not working!

Install the LEDs in the next row and solder their anodes together.

Continue installing LEDs in each row, soldering and testing.


The schematic in PDF format, PCB layout, source code and firmware of the microcontroller pic16f628a

Based on materials from the site: www.picprojects.org.uk


This diagram is also often viewed:

Cube development and materials:

I've seen a lot of LED cube projects and the main problem is driving a lot of LEDs with a small number of pins. Many projects have used shift registers for this purpose. Their main problem is the time required to shift all the bits and the problems that arise because of it. I didn't like it, and I decided to draw my own diagram.

I use 5 decoders of 3-8 lines each (also known as demultiplexers) to convert the binary signal from a 5-bit parallel input to a 25-bit parallel output that drives the LEDs. A special feature of these decoders is that the signal level can be high on only one of the 25 lines at a time. If there are five pins of the Arduino 01010 (10 in the binary system), the decoders receive this signal and output it to their 10th pin. There are 25 of them in total with numbers 0-24.

The circuit also uses NPN transistors at the cathodes of each plane of the cube. The cube is assembled on a special printed circuit board manufactured at the factory, which avoided more wires. The entire project cost $100.

First make sure that your decoders give a high signal level to one of the pins and a low signal to all the others, because There are microcircuits that give a low signal level to one pin and a high signal to all others. In the figure below you can see preliminary sketches of the diagram and table:

Cube assembly:

The first step is making a cube from LEDs. I bought cheap LEDs with very short leads and had to use extra wire.

When all 5 layers are ready, they need to be combined. The distance between layers should be 2.5 cm so that the cube is not flattened or stretched. From the cathode of each layer, lead down the cube along a wire, which will then be soldered into the board. In total, such a cube has about 300 soldering points.

Circuit layout:

To connect the cube, I used a CAT5 cable, because... it is cheap and available. I assembled the circuit on a breadboard. Select the corner of the cube that will be considered the starting point of the report and connect pin 0 of the decoder to its anode. The next anode is considered to be the closest anode on the X axis, and when they run out, use the anodes on the Y axis. I used 150 ohm resistors between the decoder and the column.



An NPN transistor is used to connect the cathodes. Use a resistor between the base of the transistor and the Arduino. Connect 1 pin of the transistor to GND, 2 to the Arduino, 3 to the cathode.

Program for Arduino:

Once the cube is connected to the prototype circuit, a program needs to be written.

The code is divided into 4 main parts:

  • LEDs.h: Contains the numbers of all pins and arrays.
  • DisplayBasics.pde: Contains several basic "shapes" in a cube, for use in the model.
  • Patterns.pde: Contains sample display programs that can be seen in the video at the beginning of the article.
  • LEDCubePCB.pde: This is the final version of my code.

The number of the program being executed changes depending on the position of the potentiometer.

Expansion of functionality:

In order for the LED cube to be even better, it is necessary to change the display program without reflashing the microcontroller. I decided to use jumpers to switch programs, and a potentiometer to change the program duration. But I forgot that when using jumpers, a pull-up voltage is required. This can be achieved by using pull-up resistors.

Printed circuit board:

I designed this circuit and PCB in Eagle. The article is accompanied by source files in Eagle format, which can be edited. When designing a PCB, pay attention to the size of the holes, paying special attention to the wires.

Editor's note: Attention! In Eagle, the diagram shows 74138! Must use 74238.

The board was made to order at the factory. If you cannot make the board in a factory, you can make it using LUT or photoresist.

PCB manufacturing and assembly

To submit a project for production, a drill file and Gerber files are required. I don't know how to make them, but following instructions on the Internet I was able to make them. These files are attached to the article. Note that the jumpers are now connected to GND and are powered by the Arduino's internal pull-up resistors.



Start the assembly with resistors and sockets, and solder the cube itself last. All components are used in a conventional output housing, so installation is fairly straightforward. Solder the board with a clean tip, maintain temperature conditions and do not overheat the components. I used connectors for all chips.
Ready!

After assembling the board, load the program into the Arduino and test it. If the circuit does not work correctly, double-check that the cube is connected and assembled correctly.

The software archive contains Eagle, Gerber files and software sources.

The cube described on this page uses a 5 x 5 x 5 matrix with a single LED color. This is a good size for an experiment, but the number of LEDs required is 125, which adds to the cost. Power - up to 1 amp current and 5V voltage i.e. 5W (simple arithmetic).

The entire cube is updated every 10ms (100Hz). This does not result in any visible flicker.

Each of the LED layers are arranged in a 5 x 5 matrix and are controlled by transistors connected to the LED anodes. With appropriate control of the layer, a high level of the transistor base comes out of the PIC, +5 V and the emitter is about 0.7 volts. Transistors used are BC637 NPN if alternatives used must be of similar specification.

The LED cathodes are connected to IC2 AND IC3. These STP16CP05 16-bit constant current driver for LEDs. The 680R resistor gives the LED current ~28mA; the value of this resistor can be changed to fit different LEDs (different LEDs have different ratings).

One cube layer:

One column of LEDs in a cube:

Capacitors provide power... C4 and C5 in particular are important and should be tantalum, located near the ICs.

As for LEDs, you can use almost any 5mm or 3mm LEDs you want.

In my opinion, cubes with 3mm LEDs have more space inside the cube, which makes it more visually beautiful.

Rice. 3


Fig.4


Fig.5


Rice. 6


Fig.7


Rice. 9



Fig.10

Rice. 12

Fig 1. The anode must be bent at an angle of 90°.

Figure 2. Connect the anodes together, and the cathodes should be perpendicular to the anodes.

Figure 3. Using a 5 volt power supply and a resistor (from 120 to 330 ohms), you need to check and visually make sure that everything is soldered correctly. Apply "+" to the anode and "-" to the cathode and the LED should light up. Resistance is necessary to limit the current! Don't forget when checking!

Attention. If you skip this test and get the LEDs assembled in a cube, it will be very difficult to find the LED that is not working!

Fig 4,5,6. Install the LEDs in the next row and solder their anodes together.

Figure 7. Continue installing LEDs in each of the rows, soldering and testing as you go.

Fig 8. With all five rows completed, solder the wires in all rows and place them in a layer into the mold. This wire also serves as electrical connections. Note which wires go above and below the LED anode leads.

Repeat the previous steps for each of the five layers.

Figure 9-12. These photos show the general layout of the cube LEDs.

How does LED decorative sculpture work? Is it possible to assemble it yourself? How many LEDs do you need and what do you need besides them? You will find the answer to all these questions in this article.

Led cube - what you need for self-assembly

If you are into DIY projects or like to tinker with electronic circuits, try assembling an LED cube with your own hands. First you need to decide on the sizes. Once you understand how the device works, you can upgrade the circuit with either more LEDs or fewer LEDs.

LED cube with faces for 8 diodes

Let's look at how this works using the example of a cube with a side of 8 LEDs. This cube can be intimidating for beginners, but if you are careful when studying the materials, you will easily master it.

To assemble the led cube 8x8x8 you will need:

  • 512 LEDs (for example 5mm);
  • shift registers STP16CPS05MTR – 5 pcs.;
  • microcontroller for control, see Arduino Uno or any other board;
  • computer for system programming;

Operating principle of the circuit

Small 5mm type LEDs draw a negligible current of 20mA, but you are going to be lighting quite a lot of them. A 12V and 2A power supply is perfect for this.

You will not be able to connect all 512 LEDs individually because you are unlikely to find a microcontroller (MK) with so many pins. Most often, there are models in cases with a number of legs from 8 to 64. Naturally, you can find options with a large number of legs.

How to connect so many LEDs? Elementary! A shift register is a chip that can convert information from parallel to serial and vice versa - from serial to parallel. By converting serial to parallel, you will get 8 or more signal pins from one signal pin, depending on the register capacity.

Below is a diagram illustrating the working principle of a shift register.

When you supply a bit value, namely zero or one, to the serial Data input, it is transmitted along the edge of the Clock clock signal to parallel output number 0 (do not forget that in digital electronics the numbering starts from zero).

If at the first moment of time there was one, and then within three clock pulses you set the input to zero potential, as a result of this you will get the input state “0001”. You can see this in the diagram on lines Q0-Q3 - these are four bits of parallel output.

How to apply this knowledge in building an LED cube? The fact is that you can use a not quite ordinary shift register, but a specialized driver for LED screens - STP16CPS05MTR. It works on the same principle.

How to connect LEDs?

Of course, using a driver will not completely solve the problems associated with connecting a large number of LEDs. To connect 512 LEDs, you will need 32 such drivers, and even more control legs from the microcontroller.

So we'll go the other way and combine the LEDs into rows and columns, so we get a two-dimensional matrix. The ice cube occupies all three axes. Having finalized the idea of ​​​​combining an 8x8x8 LED cube in which the LEDs are combined into groups, we can come to the following conclusion:

Combine layers of LEDs (floors) into circuits with a common anode (cathode), and columns into circuits with a common cathode (or anode, if cathodes were combined on floors).

To control such a design you need 8 x 8 = 16 control pins per columns, and one for each floor, there are also 8 floors in total. In total, you need 24 control channels.

The input block receives a signal from three pins of the microcontroller.

To light the required LED, for example, located on the first floor, the third in the first row, you need to apply a minus to column number 3, and a plus to floor number 1. This is true if you have assembled floors with a common anode, and the columns - a cathode. If it is the other way around, the control voltages must be inverted accordingly.

In order to make it convenient for you to solder a cube of LEDs, you need:

For the cube of LEDs to work correctly, you need to assemble it in layers with a common cathode, and the columns with an anode. Connect to the Arduino pins what is indicated in the diagram as input in the following sequence:

Arduino pin no. Chain name
2 L.E.
3 SDI
5 CLK

What if I don’t have such skills?

If you are not confident in your abilities and knowledge of electronics, but want such a decoration for your desktop, you can buy a ready-made cube. For those who like to make simple electronic crafts, there are excellent simpler options with 4x4x4 edges.


Cube with face size 4 diodes

Ready-made kits for assembly can be purchased in stores with radio components, as well as a huge selection on Aliexpress.

Assembling such a cube will develop the novice radio amateur's soldering skills, accuracy, correctness and quality of connections. Skills in working with microcontrollers will be useful for further projects, and with the help of Arduino you can learn to program simple toys, as well as automation tools for everyday life and production.

Unfortunately, due to the peculiarities of the Arduino programming language - sketch, there are some limitations in terms of performance, but believe me, when you hit the ceiling of the capabilities of this platform, most likely mastering the work with “pure” MKs will not cause you any significant difficulties.