DIY LED Juggling Balls
MIT License
Work in progress
This repository contains all the files and instructions for 3D printing and creating LED juggling balls that can be controlled via Bluetooth.
Watch a demo of the juggling balls on Youtube:
The following components are required to build a single juggling ball:
The juggling ball consists of an inner core and an outer shell. The models can be found in the models/
folder.
All files are also available on Thingiverse: https://www.thingiverse.com/thing:4969010
For printing the inner core which will hold all the components in place, use a transparent material. PLA+ or PETG are more sturdy, but PLA should also work. I have used the following parameters for printing the inner core with transparent PLA+:
The inner core and all components are protected by an outer shell printed with transparent TPU. The outer shell consists of two parts - a back and a front. The front will allow access to the switch and USB ports. I have used the following parameters for printing the shell:
The following diagram shows how the circuit for the LED juggling ball works:
For assembling and soldering the electronic components together, follow the circuit overview diagram above. As space is very limited inside the juggling ball, the components need to be sandwiched together:
The switch, battery charging module and accelerometer are put in between the lithium battery and ESP32 DEVKIT. The LEDs will be located on the battery and the ESP32. To ensure components stay in place, I printed some additional spacers using TPU and used some hot glue. The assembled bock of electronic components should not exceed 22mm in height as it would otherwise not fit into the inner core of the juggling ball. Ensure that the switch and the USB slots a properly aligned with the opening.
Once all the electronic components have been assembled, they can be place inside the inner core of the juggling ball. Each side of the inner core has holes for the LEDs to fit through. The two pieces for the inner core need to be glue together, either by using hot glue or Gorilla glue. Next, glue the two pieces of the outer shell onto the inner core using hot glue. Make sure that the piece of shell with the opening to access the switch and USB ports is properly aligned.
The code running on the ESP32 of each juggling ball is located in the ball-code
directory. The code can be loaded on to the ESP32 using Arduino IDE.
The code running on the juggling balls will allow devices to connect to it via BLE and send commands to change the color or get information about the battery voltage.
For specifying the LED behaviour the juggling ball can process messages that follow the following format:
set;<action>;<arg>|<action>;<arg>|...
The juggling ball behaviour can be defined in multiple steps. Each step is separated by |
. For each step an action
is specified, some action
s require additional arg
uments to be specified, such as setcolor
expects the RGB values for the two LEDs. Once an action has been completed, the juggling ball will move on to process the next defined step. Once the last step defined have been processed, the juggling ball will again go back to the first step.
Supported action
s are: wait
, thrown
, caught
and setcolor
. arg
is required when wait
and setcolor
is used. For wait
the millisecons how long the ball will wait until processing the next step needs to be specified. setcolor
requires the <r>,<g>,<b>;<r>,<g>,<b>
values of the two LEDs.
For setting the color of one LED to red and the other to blue the message would look as follows:
set;setcolor;255,0,0;0,0,255
To have the juggling ball switch between red and green every second the message would look like:
set;wait;1000|setcolor;255,0,0;0,0,255|wait;1000|setcolor;0,0,255;0,0,255
To change the color to blue when a ball is in the air and to red when it is caught:
set;caught|setcolor;255,0,0;255,0,0|thrown|setcolor;0,0,255;0,0,255
All messages need to be converted to HEX. So for the first example the following message would need to be sent to the juggling ball in order for it to correctly interpret it:
7365743b636f6c6f723b3b3235352c302c303b302c302c323535
The code for the iOS application is in the app/
directory, which makes connecting juggling balls, defining behaviours and collecting statistics very easy. The application is not part of the App Store, instead it can be loaded on to iOS devices via Xcode.
New juggling balls can be connected to via the "+" button. A list of available juggling balls will appear, balls can get selected and will appear under "Home".
Clicking on a juggling ball entry will show the configuration of the juggling ball. The juggling ball routine can be edited by deleting steps or adding new steps via the "+ Add Step" button.
When adding a new step, Set Color
is selected by default. This action allows to set the color for each LED.
Other actions, such as Caught
, Thrown
and Wait
can be selected by changing the "Event Type".
It is also possible to save routines and apply them to other juggling balls later. All saved routines can be found in the "Saved" tab. Saved routines can also be deleted and edited.
To apply a saved routine to a juggling ball, press the button with the palette icon which will list all available routines.