5 LED CUBE Controller for PIC16F688
The LED cube is made up from 125 LEDs arranged into 5 layers of 25 LEDs each. The display itself is multiplexed so instead of requiring 125 connections it requires one to each of the five layers and 25 to each LED in a layer making a total of 30. The cube is refreshed by a software interrupt routine with each layer active for 2ms, so the entire cube is refreshed every 10mS (100Hz). This results in a display with no visible flicker.
Only 8 I/O lines are needed to control the LED drivers for the cube which allows a tiny 14 pin PIC 16F688 microcontroller to control the whole cube. This micro has an internal 8Mhz clock and 4Kwords of program memory.
Each of the LED layers is arranged in a 5 x 5 matrix and controlled by a transistor in an emitter follower configuration connected to the LED anodes. When the respective layer control output from the PIC goes high the base of the transistor is held at +5V and the emitter sits approximately 0.7 volts below this. The transistors used are BC637 NPN transistors, if an alternative is used it should be of similar specification, have an Ic rating of at least 1 amp and check the pin out.
The cathodes of the LEDs are connected to IC2 & IC3. These are CAT4016 low voltage 16-bit constant current sink drivers. The LED current is set by a single resistor connected to the RSET input of the IC (pin 23). The 1K8 resistor (R1 & R2) set the LED current to ~33mA; this resistor can be altered to vary the current supplied to the LEDs. (consult the datasheet CAT4016 before altering the value of this resistor).
LED Cube kits after 10-March-2012 ship with the STP16DP05 driver IC. This is functionally equivalent to the CAT4016 but requires 620R resistors for the current setting since it uses a different ratio in the current mirror circuit. (Datasheet for STP16DP05)
Only change the resistor to reduce LED current, the circuit design shown may not work at higher LED currents and components may be damaged.
The advantage of using a constant current sink driver IC’s is that almost any LED can be used and the supply current remains constant regardless of the LED forward voltage. If the output current does need to be altered, it only requires the two current setting resistor to be changed.
The outputs of the current sink drivers (IC2/IC3) are controlled by the LED data loaded into by the PIC microcontroller. The driver ICs each contain 16 shift registers and an output latch. The PIC presents 1-bit of LED data to the serial input of IC2 (SIN). The PIC then generates a pulse on the CLOCK input of both driver ICs to shift the data into them. The two driver ICs are cascaded (SOUT of IC2 feeds SIN of IC3) so the PIC simply clocks in 25 bits of data. Once all 25 data bits have been sent to the driver ICs the LATCH signal is pulsed to place the data on the current sink outputs. The PIC then sets the respective layer drive transistor output high which turns on the required LEDs in one layer.
Signal Timing Detail for the LED Cube
made with a Saleae USB 8 channel logic analyzer for mac, PC or linux
The three timing diagrams below are taken from an operating LED Cube using an 8-channel logic capture tool. This information is provided to show the actual signals generated by the PIC microcontroller that control the LED cube. Hopefully this clears up any ambiguity about how the hardware works.
(You don’t need to know about this to construct a working cube, it’s just for the techy ones out there)
The six capacitors C1 – C6 (3 x 100nF & 3 x 3.3uF)) provide power supply decoupling. C4 and C5 in particular are important and should be tantalum bead (or low ESR electrolytic) types located close to the Vdd power pin of the two driver ICs.
Original design used 10uF capacitors for C4/C5/C6. The value of these capacitors has now be changed to 3.3uF
If you are building the LED Cube from the schematic place a 3.3uF and 100nF capacitor close to the Vdd power pin of each of the three IC’s in the circuit. You have then used all six capacitors shown on the schematic and placed them where they are needed.
JP1 & D1
The JP1 (ICSP header) allows in-circuit programming of the PIC microcontroller. It will work with the genuine Microchip PICKit2 programmer and I’ve also tested with several clone versions of the PICkit2. I don’t test with any other types of programmer.
Diode D1 allows the PIC programmer when attached to J1 (ICSP header) to detect power on the target board while preventing it from actually powering the target. Depending on your particular programmer this diode may be omitted altogether, but if in doubt fit it. If you don’t intend to program the PIC in-circuit you don’t need the diode. This diode is not needed when using the Microchip PICkit2 programmer
For more detail: 5 LED CUBE Controller for PIC16F688
For All Your PCB Need, One-stop PCB Solution Services Appear:
EasyEDA: free PCB design tool, 200,000+ engineers are using
PCBs: 10pcs 2-layer 10x10cm only $8.21, on-time global shipping
Components: save 50% on cost, save on freight if shipped with ordered PCBs
Current Project / Post can also be found using:
- pin diagram of lc 688
- ccs cpic16f877a cube led
- complete circuit of 5*5*5 led cube pdf
- led küp 5*5*5 data sheet