Haslab Unicron Light and Sound Installation Complete

Posted by Chris Carpenter on

Got the sound and light installation for my Haslab Unicron complete.  You can read the first blog post here. The final install keeps most of the electronics inside Unicron with only the power bank and a USB cable exposed in the rear. 

The final setup has a seven segment WS2812B led strip, Circuit Playground Bluefruit (CPB), DFPlayer Mini, a 3" speaker and a compact power bank for the power.  The code relies on the existing Adafruit Bluetooth Lowe Engergy (BLE) libraries for Bluetooth control. This lets me control the sounds and lights from my iPhone or an Apple Watch.  I'm also using a Circuit Python library to control the DFPlayer via serial as opposed to hardwired switch inputs.  

The code for the Bluetooth control was pretty easy and I just reused the same routines I have for the Millennium Falcon.  The code uses the onboard microphone on the CPB to control the WS2812B strip. It causes them to in time to the sounds to simulate Unicron speaking.  I modified this code from one of the many CPB examples for sound sensitive lights.  The values needed some tweaking for sensitivity and I also need to modify the code for a single color on all lights.  I only really need the code to control the brightness. The original code use more of a color changing scale like a meter.  

The DFPlayer library is a life saver. I really didn't want to program the raw serial commands for controlling the DFPlayer mini.  With the library I can specify specific tracks and move forward or back through the tracks.  Each of these functions is assigned to a button in the Adafruit Bluefruit Connect app. The built in controller makes projects like this simple.

For the physical install, I wanted to the led strip to be as hidden as possible. There really is not a good place to install the strip inside Unicron. So, the strip is mounted inside his maw on the outside.  To further hide the strip, I resin printed a clear ring that the LED strip could sit in. I painted it orange and set the LED color to orange as well.  With the maw open you can still see the LEDs a bit but I think it blends pretty well. With the maw closed it looks great.

Clear resin ring for Unicron LED stripResin printed parts for Haslab Unicron Upgrade kit

Unicron LEDs installed

I 3D printed and installed the upgrade kit.  With the kit you can pull all of the planet kibble off of Unicron and separate the robot from the planet.  This gives you a two for one of planet and robot. Plus, it leaves the planet hollow, which great for installing electronics.  With the upgrade kit installed I had plenty of room to mount a speaker on the 3D printed frame. I also had room for the electronics to sit. I did have to disassemble the maw a bit to install the LED strip. This way I could keep all the wires hidden internally.  

Unicron Planet and Robot mode together!

The last part was to adjust the code sensitivity to having the speaker in the CPB in an enclosed space. Once that was done I closed up Unicron and let the show begin!

Unicron wiring.  Unicron battery pack

Here is a video of it in action:

 The DFPlayer is loaded up with about 10 lines from Unicron.  You can select six of them directly using the buttons in the controller app. The others you can scroll through by either going next or previous track.

Here is the code I used:

 

 


Share this post



← Older Post Newer Post →


Leave a comment

Please note, comments must be approved before they are published.