This repository contains some example code and documentation for the LumiCube:
- https://www.kickstarter.com/projects/1202256831/lumicube-an-led-cube-kit-for-the-raspberry-pi
- https://www.indiegogo.com/projects/lumicube-an-led-cube-kit-for-the-raspberry-pi
More detailed information can be found in our project booklet:
For getting started head to our resources page:
(Note: the only supported operating system at the moment is the full 32bit Raspberry Pi OS.)
The source code for the software running on the Raspberry Pi, including our web-based IDE, is available in a separate project:
Documentation:
Scripts:
It is also possible to run some of these examples projects using our online simulator:
The “examples” folder contains a number of example projects, some of which we used in our Kickstarter and Indiegogo video:
Use the button to switch the cube’s colour between red and blue.
Play a randomly generated tune.
Display some Raspberry Pi stats on the screen: CPU temperature, disk usage, etc.
Continually change the cube's colour.
Every 10 seconds scroll the time across the LEDs.
Basic voice recognition and text-to-speech.
Autumn animation (leaves falling from a pixel-art tree).
A simple binary clock (see https://en.wikipedia.org/wiki/Binary_clock).
Run Conway’s Game of Life on the LEDs (see https://en.wikipedia.org/wiki/Conway's_Game_of_Life).
Colourful equaliser using the microphone.
Several computer players randomly walk the LED grid, colouring squares until they get stuck.
Use OpenSimplex noise to generate a lava lamp like effect (see https://en.wikipedia.org/wiki/Simplex_noise).
Rain animation.
Random circular ripple animation.
Ripple animation which responds to tapping or moving the cube.
Virtual water-level effect which responds to the cube's orientation.
Blow at the back of the cube to make the windmill animation turn.
See the LumiCube manual for a detailed explanation of the modules, methods and fields:
A brief summary of the API is also given here:
The API is broken down into:
- modules (e.g. speaker, microphone, screen)
- methods (e.g. play_tone(), draw_rectangle())
- fields (e.g. volume, brightness)
All of the modules, methods, and fields in the Python API (see the product manual, linked above) also exist in the REST API.
[GET/POST] http://<IP_ADDRESS>/api/v1/modules/<MODULE_NAME>/fields/<FIELD_NAME> { "value": <VALUE> }
For example, to set the brightness of the display to 50%:
curl -X POST -H "Content-Type: application/json" -d '{"value": 50}' http://<IP_ADDRESS>/api/v1/modules/display/fields/brightness
[POST] http://<IP_ADDRESS>/api/v1/modules/<MODULE_NAME>/methods/<METHOD_NAME> { "arguments": <ARGUMENTS_LIST> }
For example, to set one LED at x=1, y=0 to colour=255 (blue, #0000ff in hex):
curl -X POST -H "Content-Type: application/json" -d '{"arguments": [1, 0, 255]}' http://<IP_ADDRESS>/api/v1/modules/display/methods/set_led
[POST] http://<IP_ADDRESS>/api/v1/scripts/main/methods/start { "body": "<YOUR_CODE>" }
For example, to set all the LEDs to red using a Python script:
curl -X POST -H "Content-Type: application/json" -d '{"body": "display.set_all(red)"}' http://<IP_ADDRESS>/api/v1/scripts/main/methods/start
set_leds(), set_3d()
In Python these methods take a dictionary mapping coordinates to colours, where the coordinates are a tuple of (x, y) or (x, y, z) values. JSON doesn't support tuples, so instead coordinates are represented as a comma-separated string.
For example, to set the LED at (0,0) to 0x000080 and the LED at (1,1) to 0x0000FF:
curl -X POST -H "Content-Type: application/json" -d '{"arguments": [{"0,0": 128, "1,1": 255}]}' http://<IP_ADDRESS>/api/v1/modules/display/methods/set_leds