{"id":49077,"date":"2018-07-26T16:07:15","date_gmt":"2018-07-26T10:37:15","guid":{"rendered":"https:\/\/www.electronicsforu.com\/?p=49077"},"modified":"2023-06-01T12:28:38","modified_gmt":"2023-06-01T06:58:38","slug":"4x4x4-rgb-led-cube","status":"publish","type":"post","link":"https:\/\/www.electronicsforu.com\/electronics-projects\/prototypes\/4x4x4-rgb-led-cube","title":{"rendered":"4x4x4 RGB LED Cube"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-28229\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2016\/12\/Untested-Circuit.png\" alt=\"\" width=\"200\" height=\"76\" srcset=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2016\/12\/Untested-Circuit.png 736w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2016\/12\/Untested-Circuit-696x263.png 696w\" sizes=\"auto, (max-width: 200px) 100vw, 200px\" \/><\/p>\n<p>In this project, you will learn how to build a 4x4x4 RGB LED CUBE that is controlled by Arduino.<\/p>\n<h2><strong>RGB LED Cube Construction<\/strong><\/h2>\n<p>We need 64 common cathode RGB LEDs for our cube. Test all LEDs before soldering. Bend all the leads out 90 degrees apart as shown in Fig. 2.<\/p>\n<p>Now construct a jig as shown in Fig. 1. Insert LEDs into the jig, then solder all 4 red led anode leads then green, and then blue. Slowly remove this pile from the jig.<\/p>\n<p>We need 16 piles like this (Fig. 3). After that, take four piles from this. Connect cathodes of the first row then the second and so on. Create 4 planes like this.<\/p>\n<p>Next short first cathode rows of each plane then the second and so on. As shown in Fig. 4. Insert a cube in a wooden piece or cardboard box. Solder wires on each anode&#8217;s legs: fig. 5.<\/p>\n<div id='gallery-1' class='gallery galleryid-49077 gallery-columns-3 gallery-size-thumbnail'><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.electronicsforu.com\/electronics-projects\/prototypes\/4x4x4-rgb-led-cube\/attachment\/fig1-11'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig1-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"Wooden Box for RGB LED Cube\" aria-describedby=\"gallery-1-49084\" srcset=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig1-150x150.jpg 150w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig1-420x420.jpg 420w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig1.jpg 500w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/div>\n\t\t\t\t<figcaption class='wp-caption-text gallery-caption' id='gallery-1-49084'>\n\t\t\t\tFig. 1\n\t\t\t\t<\/figcaption><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.electronicsforu.com\/electronics-projects\/prototypes\/4x4x4-rgb-led-cube\/attachment\/fig2-10'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig2-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"Attaching LEDs into wooden box\" aria-describedby=\"gallery-1-49085\" srcset=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig2-150x150.jpg 150w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig2-420x420.jpg 420w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig2.jpg 500w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/div>\n\t\t\t\t<figcaption class='wp-caption-text gallery-caption' id='gallery-1-49085'>\n\t\t\t\tFig. 2\n\t\t\t\t<\/figcaption><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.electronicsforu.com\/electronics-projects\/prototypes\/4x4x4-rgb-led-cube\/attachment\/fig3-12'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig3-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"Soldering RGB LEDs\" aria-describedby=\"gallery-1-49086\" \/><\/a>\n\t\t\t<\/div>\n\t\t\t\t<figcaption class='wp-caption-text gallery-caption' id='gallery-1-49086'>\n\t\t\t\tFig. 3\n\t\t\t\t<\/figcaption><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.electronicsforu.com\/electronics-projects\/prototypes\/4x4x4-rgb-led-cube\/attachment\/fig4-8'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig4-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"Preparing RGB LED Cube\" aria-describedby=\"gallery-1-49087\" \/><\/a>\n\t\t\t<\/div>\n\t\t\t\t<figcaption class='wp-caption-text gallery-caption' id='gallery-1-49087'>\n\t\t\t\tFig. 4\n\t\t\t\t<\/figcaption><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.electronicsforu.com\/electronics-projects\/prototypes\/4x4x4-rgb-led-cube\/attachment\/fig5-7'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig5-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"RGB LED Cube construction\" aria-describedby=\"gallery-1-49088\" \/><\/a>\n\t\t\t<\/div>\n\t\t\t\t<figcaption class='wp-caption-text gallery-caption' id='gallery-1-49088'>\n\t\t\t\tFig. 5\n\t\t\t\t<\/figcaption><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/www.electronicsforu.com\/electronics-projects\/prototypes\/4x4x4-rgb-led-cube\/attachment\/fig6-5'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig6-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"4*4*4 RGB LED Cube\" aria-describedby=\"gallery-1-49089\" \/><\/a>\n\t\t\t<\/div>\n\t\t\t\t<figcaption class='wp-caption-text gallery-caption' id='gallery-1-49089'>\n\t\t\t\tFig. 6\n\t\t\t\t<\/figcaption><\/figure>\n\t\t<\/div>\n\n<h2><strong>RGB LED Cube Circuit Diagram<\/strong><\/h2>\n<p>The circuit diagram of RGB LED CUBE is shown in fig:7. We have 64 LEDs in this cube and need to control each color and each led individually. So for that, we need 64*3 pins, an Arduino board can&#8217;t do that alone. But this cube construction method will help us to control each led with shift registers.<\/p>\n<p>Now we need only 48+4=52 pins for controlling 64*3 LEDs, for that, we can use 7 shift registers each connected in series with Arduino. To Control each 48 LED column we can use 6nos of 74595 shift register ICs.IC 74595 is an 8-bit shift register.<\/p>\n<p>ICU7 is used for multiplexing 4 cathode layers with high-current handling transistors (2n2222). 22ohm resistor is used for current limiting. Now let&#8217;s look at how the led cube connects with our control board circuit. We have 4 vertical layers of red, green, and blue LEDs.<\/p>\n<p>Connect the first 4 bits of U6 with red layer 1 and the second 4 bits with red layer 2. Connect the first 4 bits of U5 with red layer 3 and the second 4 bits with red layer 4. Connect green and blue also as in the circuit diagram.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-49090 size-full\" src=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig7.jpeg\" alt=\"RGB LED Cube Circuit Diagram\" width=\"1200\" height=\"875\" srcset=\"https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig7.jpeg 1200w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig7-500x365.jpeg 500w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig7-1024x747.jpeg 1024w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig7-324x235.jpeg 324w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig7-696x508.jpeg 696w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig7-1068x779.jpeg 1068w, https:\/\/www.electronicsforu.com\/wp-contents\/uploads\/2018\/07\/fig7-576x420.jpeg 576w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<p><strong>Also Check:<\/strong> More such interesting <a href=\"https:\/\/www.electronicsforu.com\/mini-projects-ideas\">Mini Projects<\/a><\/p>\n<h2><strong>Program<\/strong><\/h2>\n<p>First, we need to include the SPI library that&#8217;s what&#8217;s used to shift out data to shift registers. And then we define the latch pin and the blank pin which can be any digital pins you want those go out to the shift registers.<\/p>\n<p>The data and clock pins pin 11 and 13 are used by the SPI library and those are Hardware specific pins. We want to run the clock as fast as possible for the SPI so the fastest it can be is to divide the system clock by 2, so 16 Meg divided by 2 now everything&#8217;s running at eight megahertz.<\/p>\n<p>We want to shift out 48+8-bit data at a time. I created a timer for multiplexing data. This timer interrupt will yank us out of the code every 124 microseconds. And this is our multiplexing frequency. It will update each cathode row data every 124 microseconds. Here BAM technique is used for controlling brightness.<\/p>\n<p>The brightness of the red green and blue components of that LED on a resolution base from 0 to 15 so it&#8217;s a 4-bit resolution. With all of this data, I wrote a function to control all individual LEDs.With this function, you can write animations on your logic.<\/p>\n<h4><strong>Download <a href=\"https:\/\/github.com\/anoopmm\/RGB_LED_CUBE\" target=\"_blank\" rel=\"noopener\">source code &amp; schematics<\/a><\/strong><\/h4>\n<h2>Video Tutorial<\/h2>\n<p><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/t2ld4nQV0Dc\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<hr \/>\n<p>This article was first published on 26 July 2018 and was updated on 31 August 2020.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this project, you will learn how to build a 4x4x4 RGB LED CUBE that is controlled by Arduino. RGB LED Cube Construction We need 64 common cathode RGB LEDs for our cube. Test all LEDs before soldering. Bend all the leads out 90 degrees apart as shown in Fig. 2. Now construct a jig [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":49089,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[776,23,22,6071,43,48],"tags":[95],"class_list":{"0":"post-49077","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-prototypes","8":"category-hardware-diy","9":"category-electronics-projects","10":"category-intermediate-projects","11":"category-led","12":"category-videos","13":"tag-led"},"_links":{"self":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts\/49077","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/comments?post=49077"}],"version-history":[{"count":1,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts\/49077\/revisions"}],"predecessor-version":[{"id":120317,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/posts\/49077\/revisions\/120317"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/media\/49089"}],"wp:attachment":[{"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/media?parent=49077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/categories?post=49077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.electronicsforu.com\/wp-json\/wp\/v2\/tags?post=49077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}