Introduction: LED Gyro Sphere - Arduino
Build this unique, cool interactive free-standing LED Sphere with multiple sensors that can be used to provide a fun platform for further development - interaction, lighting or games.
The unit is 3D printed and uses an Arduino Board, Gyro Board, Audio Mic sensors controlling 130 independently controlled colored LEDs. There are two buttons for adding effects and menus for this unique gadget - the possibilities for effects can be endless.
The current code provided uses the Gyro output to change the color based on the rotation or attitude of the sphere which gives a unique effect as seen in the Youtube clip. I am progressively releasing example effects over the next few days that can be accessed through menus and displayed on the LED Gyro Sphere.
Step 1: Gather the Materials
- 1 x Teensy3.6 - Do not apply more than 3.3V to any signal pin.
- MPU 6050 6 axis controller
- WS2812 LEDs x 130 (Purchased in bulk from Ali Express)
- Access to a 3D Printer
- Micro Slide Switch
- 2 x 6mm SPST Micro Tactile Switch
- Microphone Input Sound Module Freetronics
- 4400mha USB Rechargeable Power Bank
- USB Cable - suitable to be modified
- Single core hookup wire
- Hot Glue Gun
- 15cmx5cm Vero Board
Initially, I used an Arduino Nano for the build however as the size of the code grew with new features which resulted in three issues - Power supply limitations, Speed & Memory issues. Therefore I have reworked the circuit to use a Teensy3.6, which features a 32 bit 180 MHz ARM Cortex-M4 processor with a floating point unit. Apart from the performance improvements, all of the digital and analog pins are 3.3 volts. The teensy has a voltage regulator on board on the Vin pin, however, care must be taken as all other pins operate at 3.3v and are easily damaged. The SCL and SDA serial lines require pull-up resistors to operate correctly so these have been added. Additionally, the Teensy3.6 has an analog ground pin which means that there is less audio interference likely to occur. This enabled very stable and low noise audio detection. The Freetronics Microphone unit proved very sensitive and stable for audio detection LED effects.
Step 2: 3D Print Case
The Sphere is 110mm in diameter with a wall thickness of approx 3mm using Black PLA filament. There are 130 LEDs to connect in the unit so it was more practical to print the unit in four components to make it easier to access the inside of the sphere with a soldering iron.
The files can be found on Thingiverse here
I used a Robo C2 printer which performed well for the print. By splitting the build into 4 units and printing two small pieces at the same time reduces the print time significantly.
Step 3: Build the LED Array
Preparing the Case For Assembly
Once the case has been printed in four pieces remove all excess plastic. This can be done using a pair of pliers and side cutters. I did use a lot of 3D model supports, so this will take some time and should be done carefully so as not to damage the case.
Tip: Use a Hot Glue Gun tip to melt some of the rough edges off on the inside of the case to reduce the effort involved and make it easier to smooth.
My LEDs needed a 7mm Diameter Hole to be able to fit snuggly into the case. Test one of your LEDs fit correctly and use a 7mm Drill Bit to clean out any excess plastic.
Fix the LEDs into the case
Starting at the bottom of the case push an LED into position. Use a blob of hot glue to hold into place and move onto the next hole. Ensure that the 5v contacts oriented in vertically and in a consistent manner as per the photographs.
Once one section is complete go over the LEDs again and put another blob of Hot Glue on the other side of the hole inside the unit so that at least two blobs of glue fasten each LED. Take care not to get the glue on the electrical contacts of LED. However, the Glue will burn off with the soldering iron if there is some spillage.
Preparing the LEDs
Once the LEDs are in place then using your soldering iron gently "Tin" each of the contacts on the LED with solder. This makes soldering the wires onto the contacts the process much easier. This is a very delicate touch with the soldering iron, simultaneously adding a touch of solder to the tip of your soldering iron and then moving away. TOO MUCH HEAT WILL DAMAGE THE LEDs - so be careful.
Connecting Up the LEDs
The LEDs are connected together using single core bell telephone hookup wire. This may look daunting however when done methodically is actually not too difficult.
Start by stripping the insulation off the hookup wire and build a pile of 25cm lengths.
Starting at the top of the section run a wire along the 5v contacts of one circular row of LEDs. Solder the end onto the contacts then bend the wire into position in an arc across all other contacts. Systematically tin the wire at each intersection point prior to attempting to solder to the LED. Then gently touch the iron on the wire and contact with some solder. Practice makes perfect - and you're about to get a lot of practice!!
Once complete repeat for the earth connection.
For the Data connection its the same process, however, I found that the best way is to solder one wire across both contacts on each LED (given they are in the centre) and then once complete come back with a sharp pair of side cutters and cut out the section of wire between each Input/Output contact on each LED. This speeds up the process considerably and is perfectly safe to do.
Joining the Layers
This is done as per the photographs in a pattern that ensures the LEDs travel around the Sphere sequentially. Carefully connect earth, Positive and Data In and Out contacts to each layer. then apply lots of glue to insulate and avoid movement.
At the completion of each section of LEDs I recommend you load the test code into an Arduino Nano and run to ensure all LEDs are working. The test pattern will light up all LEDs sequentially and will identify any issues.
Step 4: Building and Testing the Circuit
A small piece of Vero board has been used to mount the Teensy3.6 on the top side of the power bank.
The Vero Board requires tracks to be cut under the Teensy Board so carefully do this as per diagram.
Helpful tip - When working with Vero Board use a 10mm diameter drill bit and twist manually by hand to remove enough track to ensure a good break. It's important to have a close look when done to ensure a fine connection of copper track or debris is not left in place.
The relatively simple wiring diagram in the Circuit Diagram shows the connection points on the board. The lions share of the effort is in the wiring of the LEDs which requires careful attention on polarity.
A Power Bank was added to the center of the unit with careful cutouts for charging. Hot glue was used for mounting all components.
For best results place the MPU6050 on top of the Teensy Board by gluing a piece of cardboard to the top of the CPU and then the MPU 5060 on top of this. The board should be in a horizontal position as per photo.
Teensyduino is a software add-on for the Arduino software. The instructions for loading Teensyduino can be found here and using the Arduino IDE.
Test programs have been included for each part of the build so you can check your LEDs are working.
The latest version of code includes 9 different effects accessible through the two buttons which increment and decrement through the menu.
Step 5: Putting It All Together
Once tested then combine the units and the load the code provided.
Fitting the unit together requires careful alignment of the top and bottom units and clearance of any hot glue or excess plastic.
Power is applied by use of the slide switch. Menu push buttons are used to select up to 9 different effects as follows
1. Gyro Color - Rotating sphere will change color of all LEDs
2. Gyro Puzzle - Three Bands of color set by X,Y,Z axis control of the Gyro. The objective is to rotate the ball until all bands are the same color.
3. Sound Meter - All LEDs (Great next to a Blue Tooth Speaker!!)
4. Sound Meter - Single VU Meter with 130 LEDs spiraling down
5. Dot Snakes Sound - 4 snakes run around sphere and change speed with sound
6. Dot on Top - Gyro keeps color dot on top of the sphere when sphere rolled on floor
7. Colorwash - Beautiful effect of all colors cycled through on sphere
8. Dot Snakes - 4 snakes run around sphere at constant speed
9. Gyrosnake - Sound changes color as LEDs spiral downward
Get creative and develop your own effects. Now go and enjoy your LED Gyro Sphere!