LED cube
Introduction

LED Cube is an application which uses the FastLED Arduino library to create cool lighting effects on the surfaces of a cube. It is available as an Android app on the Google Play Store and as a web app hosted on this server.



Build an LED cube

To build an LED cube you'll need a 3D printer or access to one of the many on-line 3D print services, an ESP32 microprocessor, (5) 8x8 WS2812b LED panels and other sundry electronic components.

  • I don't have a 3D printer, so I used Craftcloud to find an on-line 3D print shop to print the cube using this 87mm cube model. I had good luck printing several cubes using Craftcloud vendors. The cubes were good quality and I thought they were reasonably priced as long as you aren't in a hurry. Just FYI you don't have to go with the more expensive "translucent" PLA material, since the cube walls are only 2mm thick and the LEDs will shine right through regular white PLA.


  • Any ESP32 should work, but I recommend the ESP32 "D1 mini" variety, since they are small and very inexpensive if you buy them direct from vendors in China. Adding a 74HTC367 hex buffer chip is also a good idea to act as a level-shifter between the 3.3V ESP32 and the 5V WS2812. Some people have used ESP32s and WS2812s together without a level shifter and not had a problem, but I think it's a good idea.


  • 8x8 WS2812b LED panels (80mm x 80mm in size) are easy to find on-line, and again pretty reasonably priced if sourced from China.


To wire everything together you just need to connect a 5V power supply (I used an old cell phone charger) to all the components, and connect five of the ESP32's GPIO to drive each of the WS2812 panel's Din pin. I used the sixth 74HTC367 channel to drive a P-channel MOSFET, which controls power to the panels, but that's optional. I also included a tilt switch, which can be used to bring the ESP32 out of deep sleep mode by flipping the cube upside down. Or you can just use a momentary push-button switch for that function. The schematic for the circuit I built is here.

With all the wiring done and tested, glue the appropriate LED panel to each of the cube's five sides (on the inside, facing outward).



Setup
This section is TBD.


Network Configuration

This section gives a quick overview of the LED cube's network setup. Please see the User Guide for details.

By default when the LED cube is plugged in it runs a predefined sequence of patterns and color palettes. Each effect runs for 30 seconds and the cube will eventually go to sleep after 30 minutes. Wake the cube by flipping it upside down then right side up, and the process will start over again. If you're satisfied with this default behavior, you don't have to do anything more.

If, however, you'd like more customization or access to the cube's more advanced features, you'll need to go a bit further and connect it to your local WiFi network by telling it your networks SSID (i.e. the network's name) and password. The kicker is, since the cube has no keyboard for input, we can't just type the information into a configuration screen like you would with a computer or cell phone. Hmmm...what to do?

This is the "old" method of configuring the WiFi settings. It works, but it's kind of clunky, involving some network gymnastics that can be a bit overwhelming for a padawan learner. We'll use your cell phone to connect to a special private WiFi network that the cube creates, then enter your home WiFi credentials into a web app on your phone's web browser. Here's what to do:

  • Unplug the cube from the wall outlet and turn it upside-down. Then plug the cube in again (still upside down). When the green diagnostic finishes the cube will flash red three times, indicating the cube's firmware has been reset, and you should now flip the cube right-side-up. Now right-side-up, the cube will finish it's diagnostics and spin up a private network that your cell phone can connect to. The private network's SSID and browser URL will display on the cube's surface as scrolling text.
  • Whip out your cell phone and put it in airplane mode. Then turn WiFi on and your phone should detect a WiFi network called ledcube or something similar. Connect your phone to that network.
  • Once connected to the cube's private network, bring up your phone's browser and go to the web site http://ledcube.local. This should display the ESP Wi-Fi Manager screen like so:

    It's here that you should enter your home WiFi SSID and password, then click the "Submit" button.
  • The cube will reboot and connect to your home network using the name and password that you provided. You can close the browser window on your phone, since you're done with it. Then turn airplane mode off and your phone should be back to normal (and automatically reconnected to your normal home WiFI network).

Whew! That was a lot. Fortunately, the cube will remember your home WiFi credentials, so this is generally a one-time procedure. You won't need to go through this rigamarole again unless your home WiFi setup changes.

This is the "new" method of configuring the WiFi settings. It works, but is also kind of clunky, but less clunky than the captive access point method. We'll use a bluetooth terminal app to enter your home WiFi credentials. Here's what to do:

  • You'll need to install a Bluetooth Terminal app onto your Android phone or computer. Sadly, Apple has poor iOS support for the flavor of Bluetooth that the cube uses (so called Bluetooth "classic"), so you won't find any Bluetooth Terminal apps on the iPhone app store. Otherwise, there are many available for download on the internet. These are some free bluetooth terminal apps that I've used that work well:
  • Unplug the cube from the wall outlet and turn it upside-down. Then plug the cube in again (still upside down). The cube will flash blue, indicating the cube's firmware has been reset, and you should now flip the cube right-side-up. Now right-side-up, the cube will enter it's bluetooth setup mode and it's bluetooth device name will display on the cube's surface as scrolling text.
  • Pair the cube with your phone/computer as you normally would with any bluetooth peripheral. The cube's bluetooth device name should be ledcubeBT or something similar (see the scrolling text).
  • Fire up your bluetooth terminal app and select the cube as the device to communicate with. For example, on the Android Serial Bluetooth Terminal app you select a device by choosing the "Devices" menu item and selecting the cube from the list of paired devices.

  • Once connected to the cube, the terminal app will scan for all WiFi networks in the vicinity and display a list of networks to choose from. Choose your home WiFi from the list (just type the number from the list, you don't have to type the whole name), then touch the send button. It'll then ask for the WiFi password, so type that in and touch send again.

  • The cube will reboot and connect to your home network using the name and password that you provided, and start displaying the default sequence of lighting effects.

Whew! That was a lot. Fortunately, the cube will remember your home WiFi credentials, so this is generally a one-time procedure. You can delete the Bluetooth Terminal app from your phone/computer, since you won't need to go through this rigamarole again unless your home WiFi setup changes.

OK, OK, the two previous ways of configuring WiFi were muddled chaos. But in a good way. :) This is the "new new" method of configuring the WiFi settings that was introduced in LED Cube v2. No need for captive WiFi nonsense or bluetooth terminal apps. We'll just use the new "Settings" feature in the LED Cube app. Here's what to do:

  • Unplug the cube from the wall outlet and turn it upside-down. Then plug the cube in again (still upside down). The cube will flash blue, indicating the cube's firmware has been reset, and you should now flip the cube right-side-up. Now right-side-up, the cube will enter it's bluetooth setup mode and will display scrolling text showing the firmware name and version, as well as the cube's name.
  • Fire up the LED Cube app and select "Settings" from the menu.

  • From there type in your WiFi network's name and password, the name of your cube (refer to the scrolling text on the cube). If you want to use any of the cube's timed functions like "Wake at" and "Nightlight", enter your zip code too, so the cube knows which time zone you're in and when sunrise/sunset will occur at your location.
  • Press the Send button and the cube will reboot and connect to your home network using the name and password that you provided, and start displaying the default sequence of lighting effects.

Fortunately, the cube will remember your home WiFi credentials, so this is generally a one-time procedure. You won't need to go through this rigamarole again unless your home WiFi setup changes.


Once connected to your home network you can use the accompanying LED Cube Android/Web app to adjust the cube's behavior.



Using the LED Cube app

This section gives a quick (but rather old) overview of how to use the LED Cube app. Please see the official User Guide for the most up-to-date instructions.

Now that the cube is connected to your home network, you can use either the LED Cube web app or Android app to control it. You can install the Android app from the Google Play store or simply point your web browser here to use the web app. The app looks like this:



Domain
The network name for you cube. Typically it is ledcube.local, but may be personalized, like keithscube.local, if you're special :)
Zip Code
To use the timed features, like Wake at and Nightlight the cube needs to know where you are in the world. Enter your zip code so your cube knows what time it is and when sunrise/sunset will occur.
Play Mode
The cube has three play modes:
  • Ordered - the cube will cycle through a common list of the most interesting patterns and color palettes. This is the default mode.
  • Random - the cube will cycle through an ever changing combination of random patterns and color palettes. It's random, so sometimes you get something amazing and sometimes you get a dud.
  • Arrangements - you get full control over the combinations of patterns and palettes that are shown. See the Arrangements section below.
Switch After
The amount of time (in seconds) that each pattern/palette combination is shown before moving on to the next.
Awake for
The amount of time (in minutes) that the cube stays awake. It will automatically go to sleep after this many minutes.
Brightness
Sets the overall LED brightness.
Wake at
Sets the cube to automatically wake up at a particular time of day.
Nightlight
Sets the cube to automatically wake at sunset and go to sleep at sunrise. Note, since this keeps the cube on for a long time, the brightness is set very low and the effect is set to twinkle red/green/blue colors to try to minimize wear and tear on the LEDs.

Arrangements let you control the patterns and color palettes that are displayed. An arrangement is a combination of one pattern (the sequencing of the LEDs) and one palette (a set of colors). By default there is one arrangement already created for you, which is the Outward pattern paired with the Rainbow palette. You can add more arrangements by clicking the Add button.

After making changes in the app, you must click the Send button to modify the cube's configuration. This will send the app's current settings over the local WiFi network to update the cube.