Lumos the Christmas Tree

1.9K715

Intro: Lumos the Christmas Tree

My children and I built this project to bring a little bit of magic from Universal Studios home with us. We recently visited the theme park and bought wands from Ollivander's wand shop and had so much fun going around the park activating different spell stations. I am always curious as to how things work, so of course I got to googling how to recreate this at home. I found several wonderful Instructables re-creating the magic in their own special ways, but Christmas was right around the corner and I thought it would be amazing if I could merge the magic of Christmas and the magic of Hogwarts and maybe inspire some of the kids in my extended family to think about how programming and engineering is like performing magic in real life. Thus "Lumos the Christmas Tree" was born. This tree is programmed to read 8 different spells and perform light and sound animation that match the kind of spell that was "drawn".

STEP 1: Wiring

For this project I have used a tomato cage and some cardboard to construct my Christmas tree and keep my light arrangement fairly uniform. This isn't a requirement, although I think it makes the animation look nicer. The important part of this step is that the night vision camera must have a clear view of the wand-holder,and all the mechanics inside must have sufficient air flow. I used twist-ties to attach everything together. I have attached the tomato cage to the cardboard and the raspberry pi, speaker, and night vision camera are attached to the cardboard base. Garland is wound around the tomato cage to cover the insides, being mindful of keeping it out of the camera view, some trimming may be necessary to do this. I ended up using about 30 feet of garland to wrap my 33" tall, 12" diameter tomato cage tree.

STEP 2: Install Software

This project was tested with the latest version of Raspian Buster with desktop version:4.19. You can download the latest version at https://www.raspberrypi.org/downloads/raspbian/

1. OpenCV: Follow the instructions on this blog post to install OpenCv and a virtual environment: https://www.learnopencv.com/install-opencv-4-on-ra...

2. Processing: Follow the instructions in this blog post to install processing software on raspberry pi: https://www.raspberrypi.org/blog/now-available-for...

3. FadeCandy: Follow the directions on the fadecandy github readme https://github.com/scanlime/fadecandy to clone fadecandy and install a fadecandy server. You'll be ready to move on when you're able to control your lights by accessing the fcserver at http://localhost:7890/

4. Clone "Lumos the Christmas Tree" source from: https://github.com/terra819/lumos-the-christmas-tr...

5. Build the light animation executables: I have included the files necessary to create the processing light animations, but because the java executables are so large, you will need to compile them separately. Below are the commands to do so (replace /home/pi/repos/ to wherever you clone this project):

exec /usr/local/bin/processing-java --sketch=/home/pi/repos/lumos-the-christmas-tree/strip50_flames --output=/home/pi/repos/lumos-the-christmas-tree/incendio --platform=linux --export
exec /usr/local/bin/processing-java --sketch=/home/pi/repos/lumos-the-christmas-tree/strip50_water --output=/home/pi/repos/lumos-the-christmas-tree/aguamenti --platform=linux --export
exec /usr/local/bin/processing-java --sketch=/home/pi/repos/lumos-the-christmas-tree/strip50_light --output=/home/pi/repos/lumos-the-christmas-tree/lumos --platform=linux --export
exec /usr/local/bin/processing-java --sketch=/home/pi/repos/lumos-the-christmas-tree/strip50_spazzy --output=/home/pi/repos/lumos-the-christmas-tree/broken --platform=linux --export

STEP 3: Run the Program

The github source includes spell recognition for the spells listed on the flyer above. There are instructions on the github readme if you would like to try training your own spells. run lumos.py to start the program The spell recognition works best in low light, if you have trouble with the wandtracing image bouncing all over the screen, check the debug window to see if it is picking up any errant light sources, these will be shown with red circles on the screen.

13 Comments

Have been working on this off and on for a few months. Got everything working, but seem to have issues with spell tracing catching the light reflection in my glasses, etc. I'm strong with Linux but weak on coding... is there a setting on lumos.py that can adjust this for testing? Would I be better off with a more powerful camera?
This is so great, thank you so much for taking the time to put together the instructions! I ordered all of the parts and am writing to you from my new Rasp Pi :) I'm a programmer by profession, but new in this world. I was wondering if you could post a picture of how the Fadecandy is wired to the LED lights? And it looks like the LED lights might need a separate power supply, is that correct? If so, could you post a link to the power supply that is needed? Thank you so much!
Perfect, thank you! I have it up and running! I love what you built in to start, and am looking forward to customizing it further.

Question - have you noticed that the tracing jumps around more after a couple spells have been cast? If I then close the script and re-open, it appears to work better again.

I'm planning to create a couple of these setups as gifts, and will comment back here with any notes/ideas I come up with that may help anyone else get up and running.

Thanks again!
Great! I'm glad you got it running. I hadn't noticed that but if you get it working better please open a pull request on the GitHub repo. Thanks!
I think I've made a couple minor improvements, and I'm doing some more testing and playing around with it/learning more about OpenCV. Will definitely open a pull request if I can make improvements. Quick question (I think) - did you do something in the incendio spell to convert the orange color fire image to green (for Christmas, I'm assuming?) If so, where would I look for that code? I looked around a bit for this, but have yet to find it. Thanks!
Sounds great! Please do open a pr when you're ready. No I didn't convert it to green, it's orange to me?
Oh, that's weird - I just noticed that it's orange in one of the images in the instructable. For me, the LED lights glow green instead of orange with incendio - no idea how this happened.
Hmm. Might be a setting on fadecandy? Or maybe my set of LEDs are wired backwards. Some cheap strands are backwards.
Good ideas - I'll check those out. Thanks!
Turns out I had to setup the fadecandy config file to map to "grb" (instead of "rgb".) I got a second set of the "ALITOVE" lights from Amazon and they had the same issue, where red and green were swapped... sounds like this is a relatively common issue.

I made some other tweaks and added an animation in a fork of your Github repo. I'll make a couple more changes and modify the readme before doing a pull request. I had trouble training a new spell, so I ended up using the "reparo" pattern for the new animation (with "broken" disabled because it was driving me nuts ;) .)

Last thing, I tried to get the program to start up automatically when the Pi is turned on, but was unsuccessful. I tried every method for autostarting on linux that I could find, and ended up just added a shortcut to the desktop. Were you able to auto-start the program? If so, how?
This is an awesome idea! I also have a wand from Universal kicking around, definitely favoriting this to hopefully try later!
Thanks! Loved making it, need some way to use those wands, they are too cool to just collect dust.