Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

3D LED Cube (4x4x4)

By Prasoon November 13, 2020

The basic aim is to create a 3D LED cube which is capable of showing pre-defined animations.
A Typical 3D LED Display is a collection of LEDs, somehow connected and arranged in a 3D pattern and controlled so that the LEDs can be made to turn on and off in a controlled manner, thus creating interesting and pleasant patterns of light.
Probably the most common type of 3D LED display is the LED cube. The 3D matrix is constructed either by soldering the legs of the LEDs directly together or by constructing a matrix of wires which form a frame that the LEDs are connected to. There are also many different ways to control a 3D LED display which vary in complexity, the simplest is probably a single micro-controller, with more complicated methods using special LED Driver ICs or even direct PC control.

Prototype of AVR ATMega16 controlled LED Cube

Fig. 1: Prototype of AVR ATMega16 controlled LED Cube

Working:

The LED cube has 64 LEDs (4x4x4). Each LED is dedicated to an IO port in a microcontroller. LED cube relies on optical phenomenon called Persistence of Vision. If you flash an LED really fast it will remain in your retina for some time even after LED is switched off. By flashing each layer of cube very fast after one another it gives the feeling of 3D.
With this setup we will need only 16(anode) + 4(layers) IO ports to control each  LED.
LED has two legs one positive and one negative .The positive end is connected to the pillars of LED cube which acts as anode while the negative one is connected to the layer. Hence, to switch on a particular LED we have to give current to the corresponding pillar and ground the layer.

Block Diagram:

Block Diagram of AVR ATMega16 controlled LED Cube

 Fig. 2: Block Diagram of AVR ATMega16 controlled LED Cube

Power Supply:  We have used 5V regulated power supply using 7805 voltage regulator and 9V battery, for our project.

Micro Controller:

It is the heart of the project which is used to control LED Cube by generating predefined animations. The input/ output ports of the microcontroller are used for this purpose. We have used Atmega 16 Micro controller in our Project.

Pin Diagram of AVR ATMega16

Fig. 3: Pin Diagram of AVR ATMega16

Prototype of AVR ATMega16 based LED Cube Control Circuitry

Fig. 4: Prototype of AVR ATMega16 based LED Cube Control Circuitry

LED Cube:

The connection of LED cube is in the following manner. All the anodes of a layer are connected as a pillar of the cube and cathodes are shorted around the layer. Thus we have 4 pins of cathode in a 4 layers of cube, and 16 Pins of cathode as pillars of Cube.

Representation Image of LED Cube

Fig. 5: Representation Image of LED Cube

Prototype of LED Cube controlled by AVR ATMega16

Fig. 6: Prototype of LED Cube controlled by AVR ATMega16

Circuit :

{Check the circuit diagram tab for complete circuit for 3D LED Cube (4x4x4)}

Programming :

Programming is done under Eclipse IDE in Embedded C. The code is attached with this document.
I have Created 4 patterns of Animations in each ‘for loop’.

You may also like:


  • What are different types of industrial robots?

  • What is LoRa and LoRaWAN?

  • What are LoRa gateways and what types are available?

  • How does LoRa modulation enable long-range communication?

  • What are the different types of EV charging connectors?

  • What types of motors are used in electric vehicles?

Project Source Code

###


#include

#include

 

void main()

{

 

DDRA=0xff;

DDRB=0xff;

DDRD=0xff;

int i,j,k,l,m;

while(1)

{

      for(i=0;i<6;i++)

      {

PORTD=~1;

PORTA=0b00010001;

PORTB=0b00010001;

_delay_ms(200);

 

PORTD=~2;

PORTA=0b00010001;

PORTB=0b00010001;

_delay_ms(200);

 

PORTD=~4;

PORTA=0b00010001;

PORTB=0b00010001;

_delay_ms(200);

 

PORTD=~8;

PORTA=0b00010001;

PORTB=0b00010001;

_delay_ms(200);

 

PORTD=~4;

PORTA=0b00100010;

PORTB=0b00100010;

_delay_ms(200);

 

PORTD=~2;

PORTA=0b01000100;

PORTB=0b01000100;

_delay_ms(200);

 

PORTD=~1;

PORTA=0b10001000;

PORTB=0b10001000;

_delay_ms(200);

 

PORTD=~2;

PORTA=0b10001000;

PORTB=0b10001000;

_delay_ms(200);

 

PORTD=~4;

PORTA=0b10001000;

PORTB=0b10001000;

_delay_ms(200);

 

PORTD=~8;

PORTA=0b10001000;

PORTB=0b10001000;

_delay_ms(200);

 

PORTD=~4;

PORTA=0b01000100;

PORTB=0b01000100;

_delay_ms(200);

 

PORTD=~2;

PORTA=0b00100010;

PORTB=0b00100010;

_delay_ms(200);

 

}

      for(j=0;j<6;j++)

      {

PORTD=~8;

PORTA=0b10011111;

PORTB=0b11111001;

_delay_ms(200);

 

PORTD=~4;

PORTA=0b10011111;

PORTB=0b11111001;

_delay_ms(200);

 

PORTD=~2;

PORTA=0b10011111;

PORTB=0b11111001;

_delay_ms(200);

 

PORTD=~1;

PORTA=0b10011111;

PORTB=0b11111001;

_delay_ms(200);

 

      }

 

      for(k=0;k<6;k++)

            {

 

            PORTD=~1;

            PORTA=~0b10011111;

            PORTB=~0b11111001;

            _delay_ms(200);

 

            PORTD=~2;

                        PORTA=~0b10011111;

                        PORTB=~0b11111001;

                        _delay_ms(200);

 

                        PORTD=~4;

                                    PORTA=~0b10011111;

                                    PORTB=~0b11111001;

                                    _delay_ms(200);

 

                                    PORTD=~8;

                                                PORTA=~0b10011111;

                                                PORTB=~0b11111001;

                                                _delay_ms(200);

 

 

            PORTD=~8;

            PORTA=0b10011111;

            PORTB=0b11111001;

            _delay_ms(200);

 

            PORTD=~4;

            PORTA=0b10011111;

            PORTB=0b11111001;

            _delay_ms(200);

 

            PORTD=~2;

            PORTA=0b10011111;

            PORTB=0b11111001;

            _delay_ms(200);

 

            PORTD=~1;

            PORTA=0b10011111;

            PORTB=0b11111001;

            _delay_ms(200);

 

 

            }

 

      for(l=0;l<6;l++)

                  {

PORTD=~1;

PORTA=1;_delay_ms(100);

PORTD=~2;

PORTA=0b00100000;_delay_ms(100);PORTA=0;

PORTD=~4;

PORTB=0b00000100;_delay_ms(100);

PORTD=~8;

PORTB=0b10000000;_delay_ms(100);

PORTD=~4;

PORTB=0b00001000;_delay_ms(100);PORTB=0;

PORTD=~2;

PORTA=0b10000000;_delay_ms(100);

PORTD=~1;

PORTA=0b00001000;_delay_ms(100);

PORTD=~2;

PORTA=0b01000000;_delay_ms(100);PORTA=0;

PORTD=~4;

PORTB=0b00000010;_delay_ms(100);

PORTD=~8;

PORTB=0b00010000;_delay_ms(100);

PORTD=~4;

PORTB=0b00000001;_delay_ms(100);PORTB=0;

PORTD=~2;

PORTA=0b00010000;_delay_ms(100);

 

                  }

 

      for(m=0;m<10000;m++)

                        {

PORTD=~1;

PORTA=0b10011111;

PORTB=0b11111001;

_delay_us(100);

PORTD=~2;

PORTA=0b00001001;

PORTB=0b10010000;

_delay_us(100);

PORTD=~4;

PORTA=0b00001001;

PORTB=0b10010000;

_delay_us(100);

PORTD=~8;

PORTA=0b10011111;

PORTB=0b11111001;

_delay_us(100);

 

 

 

 

 

                        }

}

}

###

 


Circuit Diagrams

Circuit-Diagram-AVR-ATMega16-LED-Cube


Filed Under: Electronic Projects

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Transistor circuit in audio
  • MCU identification?
  • GanFet power switch starts burning after 20 sec
  • problem identifying pin purpose on PMA5-83-2WC+ amplifier
  • AC amplifier, transistor with bias network

RSS Electro-Tech-Online.com Discussions

  • stud mount Schottky diodes
  • LED circuit for 1/6 scale diorama
  • Can I use this charger in every country?
  • Electronic board faulty?!?
  • using a RTC in SF basic

Featured – Designing of Audio Amplifiers part 9 series

  • Basics of Audio Amplifier – 1/9
  • Designing 250 Milli Watt Audio Power Amplifier – 2/9
  • Designing 1 Watt Audio Power Amplifier – 3/9
  • Designing a Bass Boost Amplifier – 4/9
  • Designing a 6 Watt Car Audio Amplifier – 5/9
  • Design a low power amplifier for headphones- 6/9

Recent Articles

  • Fischer connector system adds ratchet locking system designed for 300g shock resistance
  • Littelfuse introduces tactile switch with enhanced bracket peg design for mounting strength
  • Infineon releases GaN switch with monolithic bidirectional design
  • Sienna Semiconductor data converters feature sample rates from 20 to 250 Msps
  • Delta’s 5,500 W power supplies achieve 97.5% energy efficiency for AI servers

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronics Projects and Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe