TechKnowTone_Text

- Project

Cube 8x8

STEM_Banner_Text

A light cube built from five 8x8 LED panels, that can provide an impressive assortment of animated lighting effects, including rotating spirals and scrolling text. I built this project for my grandson Ethan, who at 5 years of age is showing a strong interest in technology. Watch the video and become inspired to code your own colourful light shows.

Video_Slide

Project Overview
This project uses the powerful ESP32 dual-core micro to develop a wide range of animated light patterns on five faces of a cube, using WS2812B RGB LEDs configured as 8x8 panels. I’ve also built into this cube a 3-axis motion sensor, a microphone and an ambient light sensor, so that it can respond to changes in it’s environment. The code I have provided contains a library of graphics functions, which can be combined in interesting ways to develop a wide range of lighting effects. The cube can also be used as a desk lamp and to provide mood lighting of any colour you choose.

Watch the video on the right to see how they perform, and an insight into the technologies mentioned above.

Using the 3 button switches at the base of the cube you can simply switch it ON or OFF, or select a specific pattern. The code stores your latest choice so that it returns to that mode when it is switched ON again, or when power is resumed. Most of the patterns are animated in some way, mainly by sounds picked up via the microphone or the motion sensor.

Whilst we are driving 321 LEDs in this project, the data rate is high enough to support frame rates in excess of 30 fps, so good animation effects can be a achieved. You can also vary the frame rate dynamically, which in turn speeds up or slows down the animation.

The graphics library (Gfx) provided enables you to draw boxes and lines, copy side faces, rows and columns, rotate faces and even draw 8x8 characters at any point on a face, in any colour.

Both cores of the micro are used to good effect, with one core focusing purely on graphics and LED serial communications, whilst the second core samples all of the sensors and button switches in a multi-tasking environment. This means that the animation code simply uses the latest sensor values, which are read in the background continuously.

The ambient light sensor enables the cube to be dimmed down in low light conditions, so that it does not appear to be too bright, just like an LED alarm clock.

The DC offset analogue signal from the microphone is sampled at a high rate, then subjected to filtering to remove the offset, make it unipolar and apply squelch and peak detection functions.

The 3-axis motion sensor provides raw and filtered acceleration and gyroscopic rotation data.

The circuit diagram is shown here on the left, with the ESP32 micro connected to the microphone on the left, and the light and motion sensors at the top. The LED cube is connected to the micro through a multi-pin connector, which needs to carry the high current drawn when all of the LEDs are set to bright.

As the ESP32 module works are 3.3v and the LED cube works at 5v it is necessary to provide a level shifter circuit to interface the two. This is achieved in this design by using a single WS2812B LED running off a 4.4v rail developed from a diode connected to 5v. There are other ways of doing this if you don’t wish to use this solution.

The 3 button switches are connected to individual inputs, which are configured as pull-up resistors to reduce the component count. When you press a button switch the code in the micro produces a colour in the single LED as confirmation.

All of the 3-D models are provided as STL files, zipped together into one file. They can therefore be used with a slicing application of your choice, to create the G-code files for use with a 3-D printer. For my project I used PrusaSlicer, which is a free download from the internet, but there are many other free applications to choose from. I just think that PrusaSlicer is one of the best.

The cube is assembled from a series of plates, built around a central tower which houses the micro and sensor electronics. Whilst the LED panels are glued to mounting plates, the whole assembly is tide together using small screws, making it easy to build and disassemble if needed.

The cube is powered from an external DC wall adapter working at 5 volts. I chose a 3 Amp unit, which provides more than enough light from the LEDs, but for maximum brightness you would need a supply in the order of 10 Amps.

 

Design Files
The following files can be downloaded to help you complete this project. Each has a hyper-link and an associated description. Depending on how your web browser is configured the links will either open the files directly into the browser or offer them as downloads.

Circuit Diagram - a series of drawings, followed by assembly instructions.
Parts List - the things you will need and budget prices.
3-D Models - a zip file containing all of the STL files, which you can use with a slicer application - Updated 09/03/2024.
3-D Parts - a pdf file which identifies the 3-D parts, their critical features and how to prepare them for assembly.
Software Code - the all important ESP32 .ino files which contain the cubes code. See comments below on coding.
Functions Card - a drawing explaining the use of the 3 button switches.


Libraries
This project relies on the use of six libraries, Arduino.h, HardwareSerial.h, Wire.h, FastLED.h, BH1750FVI.h, EEPROM.h which need to be included in the IDE set-up. If you haven’t used an ESP32 before with the Arduino IDE, then you will need to install the board libraries too. There are several articles on the web that explain this process.

Design Notes:

The following notes will help you understand how the files in this project work or can be used in principle. Each note has a bold heading for quick reference and they are listed in alphabetical order.

.ino File - the .zip file contains the source folder, which in turn contains several .ino files. These are all to be extracted and retained within the same folder, of that name. If you are wondering why there are several .ino files, it is because I use the tabbed interface within the Arduino IDE, and for each tab there is a corresponding .ino file.
3-D Models - this design is based on the use of 3mm nylon countersink screws with niloc nuts as fasteners. This leads to a very clean solution as the length of each screw can be easily trimmed adjacent to the nut using wire cutters.
Serial Port
- is used in this design convey readings and commands over the Arduino IDE Serial Monitor, and for general debugging purposes. Being able to see the servo values being applied to each servo is very useful and essential to calibration.
STL Model Files - The forward drive arm has a hidden pocket where the plastic drive leaver from the servo motor is inserted. This is to make the part more printable, and this thin walled pocket can be easily opened up using a hobby knife.

Need more?
If you feel that I haven’t included enough information to allow you to tackle a project of this type then send me an email explaining what you need. Or if you just want to give me some general feedback on this site, or to suggest projects what I might include which would be interesting to you, I’d be pleased to hear from you.

Page updated: 09/03/2024