Gandalf's Magic Staff

by AaronHaras in Circuits > Arduino

36368 Views, 319 Favorites, 0 Comments

Gandalf's Magic Staff

Crystal_lit_2.jpg
Gandalf Staff Reveal
Gandalf_Staff_3.JPG
DSCF1546.JPG
DSCF1774.JPG

Who wouldn't want Gandalf's Magic Wizard Staff?

Turns out Gandalf had various staffs and either lost, broke or upgraded them frequently! This provides us with multiple staff designs and there are plenty of methods of constructing your own Magic Gandalf Staff depending upon your resources and skills.

In this Instructable, I will show you how I split the wood, made a removable extension, hid the electronics, and used FIMO clay to set the crystal onto the staff. A magic ring controls the audio and lighting of the staff as well as streaming audio to an external Bluetooth speaker for that ultimate crack of thunder !

What's in a Magic Staff like Gandalf's?

  • Crystal - Every good Magic Staff needs a big crystal. (though not all Gandalf's did)
  • Light - Like, serious light. A job for a NeoPixel something.
  • Sound - Kids said "YOU SHALL NOT PASS" and requested a thunder hack.
  • Magic - Only works in your hands! Control crystal's light with hidden switches.

The supplies for your Magic Staff will depend on a few things;

  • Which steps you want to complete,
  • which style of staff you use,
  • and which specific components you prefer.

For an overview of this Instructable, check out the List of Steps after Supplies below.

Supplies

Crystal - See "Choosing a Crystal" in step 2
Staff - See "Choosing a Staff" in step 3
FIMO Clay. - See Hardening Clay in step 4

Electronics

  • Basic Build Items
  • 6 x or more magnetic Reed switches to make the magic happen.
  • 2 x small Rare earth magnets - (1mm x 1mm) for power switch
  • 1 x medium rare earth Magnets (1mm x 5 mm) for the ring(s)
  • 1 x Pixel Ring to light up the crystal - 16 NeoPixel Ring.
  • 1 x Rechargeable battery - 3.7v Li-Poly battery.
  • 1 x Arduino compatible microcontroller - Pro Trinket 3 volt , (or Feather, Nano, Boron ).
  • 1 x Battery Charging system - Li-Poly Backpack - ( sometimes integrated in board above).
  • 3 x Transistors - 2N4401 NPN - (only 1 for basic build).
  • 2 x Relays - HK23f 5vdc 1A - (only 1 for basic build).
  • 4 x Resistors - (only 2 for basic build)
  • Advanced Build Items
  • 1 x LED Cluster (the insides of an LED flashlight)
  • 1 x MP3 Sound Device - MusicMaker Featherwing, mp3 device or Thor's Hammer.
  • 1 x Blue Tooth Module - I used this one.

Electrical Tools and Consumables:

  • Soldering Iron and solder
  • Wire cutter and/or stripper
  • Shrink tube for wire
  • Wire - some different colours is handy, Ribbon cable is tidy.
  • Needle nose pliers. (2 pairs is handy.)3rd and fourth hand. (Stand, magnifying and helper hands)
  • Glue gun and glue sticks

Shop Tools and Consumables: (depending on staff construction Step XYZ)

  • a vise, drill and drill bits
  • some carving tools for digging into the wood
  • Saws (hand and hacksaw)
  • 2 part epoxy (love this stuff)
  • propane soldering torch and solder- for staff extension
  • scraps of metal, brass or nail for staff extension(see section XYZ for more info on staff construction)

Software

  • Complete software is just below...

Steps in This Instructable ( Table of Contents )

Getting started - Some people may use different materials, or not want sounds in their Magic Staff. So I have included notes and diagrams to cover variations wherever I can.

  1. List of Steps
  2. Choose a Crystal
  3. Choose a Staff - Link to section.
  4. Make Fake Branches
  5. Make the Ring
  6. Electronics Overview
  7. Arduino Setup
  8. Magic Buttons and Software
  9. NeoPixel Lighting
  10. Relays and Transistors as switches
  11. Battery, Charging and On/Off Switch
  12. Center Light aka LED Array
  13. Prep and Place Music Player
  14. Bluetooth streaming device
  15. Staff Construction Part 1
  16. Staff Construction Part 2 - Extension
  17. Prepare and place relays
  18. Prepare and place switches
  19. Tie Up Loose Ends
  20. Final Software notes.

Choosing a Crystal

20190329_123047.jpg
20190329_123207.jpg
20190329_123152.jpg
20190329_123955.jpg
20190329_123238.jpg

There are a multitude of types of crystals, and looking around the house I had some rose quartz pieces that looked fantastic with a flashlight shining through them, but they seemed too small. I had a rock salt light that I figured I could hack, but my wife would not have been very happy about that. A quick internet search for crystals resulted in too much choice and no feel for size and availability.

Find a store.

At your search engine, Use keywords like gems, rocks or crystals. Also add your local city

I typed: rocks gems Vancouver, turned up a fantastic rock and gem store (images).

Choosing the Crystal

I took a small flashlight and the 16-pixel NeoPixel ring with me to the store. I wanted a crystal around 4 inches and would let the light through in a pleasing way.

The NeoPixel ring will be covered with Fimo Bake Clay so exact fit is not super important.

Choosing a Staff

DSCF1640.JPG
20190329_123250.jpg
20181022_151131.jpg
20181017_114654.jpg
DSCF1803.JPG
DSCF1805.JPG

Choosing a Staff | Back to List of Steps

I decided to find a natural stick/sapling and eventually found a good candidate. But there are numerous ways to make your own Magic Gandalf Staff.

Here are some different methods and materials to make your staff.

  • 3D print a Staff - Precise, detailed. ~~ But need a printer and drawing, size issues.
  • Hack an existing staff - Cheap, re-use is good. ~~ have to find it, .
  • Wrap a stick in foam/clay. - Easy to find/hide switches ~~ paint, artwork, durability.
  • Use plastic pvc pipe. - Easy to find, cheap ~~ needs covering/artwork.
  • Wooden Staff (stock lumber) - Cheap, easy to work, easy to split ~~ artwork, naturalization.
  • Wooden Staff (natural) - Could be sweet, free ~~ harder to split, have to find.

Things to keep in mind when choosing a material for Wizard Staff.

  • The staff needs a spot for light under your crystal.
  • The staff will need to hold/hide the electronics.
  • You will need to plug it in to recharge/reprogram it.
  • You will need to hide switches for making the magic.
  • Baking clay and 5 minute epoxy are your friend.
  • Choose a construction method based on your resources and skills.

Making Fake Branches to Fasten the Crystal and Electronics

_AYH2067.JPG
_AYH1953.JPG
CrystalSetInPlace.jpg
_AYH1944.JPG
_AYH1945.JPG
_AYH1947.JPG
_AYH1950.JPG
_AYH1951.JPG
_AYH1963.JPG
Crystal_In_Fake_Branch.jpg
_AYH1975.JPG
_AYH2022.JPG
_AYH2045.JPG
_AYH2020.JPG
_AYH2030.JPG
_AYH2038.JPG

I used FIMO baking clay to fashion fake branches to cradle the crystal and hold the lighting components underneath. Although I originally forgot to photograph this part, I put together some images of a side branch and a light tower to show how I did it.

The tricky part here is, the staff is too big to fit in the oven, and it's wood! There is also the impact of the heat on the crystal or electronics. To solve this, form the clay where needed, then carefully remove the clay, bake it separately , and epoxy it back into place. In the images, you will see how I made a mini crystal tower with an LED array and a pixel ring.

Once you have completed your electronics and staff preparation, some bake-able modeling clay will hold it all together.

Making fake wooden branches - look like peeled bark.

  • Use dark FIMO clay to fashion the interior(filler) of the fake branch
  • wrap that piece in a light colour,
  • wrap those two with a brown (bark) colour.
  • Then using a knife, carve away bits of the outer layer until it has the right look.
  • Fashion the clay piece to fit onto staff
  • Fashion the clay to hold the crystal
  • Carefully separate the clay branch from crystal and staff
  • Bake it at recommended temp and time
  • Epoxy the crystal onto fake branch and epoxy onto staff

Hiding the Electronics -

  • Follow above steps, and
  • Be sure you can separate clay from electronics for baking
  • Leave holes for pulling out wires before baking
  • I sliced my clay branch in half, wrapped the crystal and then formed it on top of the LED array.

The Magic Ring

Ring_Inside.JPG
Ring_Outside.JPG

The idea is to have a magnet under your hand so when you pass your hand over a hidden switch, something magical happens.

I went super easy route and used FIMO.

  • rolled out some FIMO
  • sandwiched the magnet between 2 layers.*
  • trimmed to width and length
  • joined the ends to make loop
  • baked at recommended settings.

* This is where we use a bigger magnet. It will need to trigger the reed switch through the wood.

There are lots of other great materials and methods to make your magic ring.

  1. Wood
  2. Metal
  3. Plastic (3D printed would be wicked)
  4. Under your skin ( like special effects skin)

Electronics - Overview

DSCF1545.JPG
DSCF1806.JPG
Gandalf_Magic_Staff.png
DSCF1698 - Labels_1f.jpg

Inside the staff we will have a 3.7 volt rechargeable battery connected to a charging and switching circuit (power On/Off) that will power the Pro Trinket. The Pro Trinket will respond to various click events from 4 hidden magnetic switches. The Pro Trinket will control the Neopixel ring, Flashlight LEDs, MP3 Sounds and the Bluetooth module.

Depending on the build you choose, testing and placing of components will likely occur differently. It is a good idea to rough wire and test components before permanently placing into your staff.

I have tried to break down the electronics parts of the build into sections, hoping to help everyone build their personal version of Gandalf's Magic Staff.

Basic Magic Staff (Steps 7-11 below)

  • Arduino controller to monitor inputs and control devices. (step 7)
  • Software Libraries Needed: NeoPixel, OneButton. (step 7)
  • Using switches - Multiple click events using OneButton. (step 8)
  • Reed Switches - The magic is in the magnetic switches. (step 8)
  • NeoPixel - Lights the crystal with thousands of colours. (step 9)
  • Relay, Transistor, flyback Diode - Isolates power from Arduino (step 10)
  • Battery with a charging system - Keeps the magic going. (step 11)

Uber Light (Step 12 below)

  • LED Array(flashlight),
  • Relay, Transistor, flyback Diode.

MP3 Sound (Step 13 below)

  • Featherwing, speaker
  • Libraries needed: MusicMaker

BlueTooth Sound Broadcasting (Step 14 below)

  • Bluetooth Module
  • Transistor

Arduino Setup

Gandalf_Staff_Libraries.png

Having some experience with the Arduino IDE and coding will make this easier. However, I have added as many links and references as I can.

Arduino Setup - If you are not already handy with the Arduino IDE,

Libraries/Examples - These are needed for the sparkles and magic of the Gandalf Staff..

Software samples

  • Test button Library see step ___
  • Test Neopixel - See Step ___
  • Test Musicmaker - See Step ___
  • The whole code is just below as a text file. Download, Open, Cut_and_Paste into Arduio IDE

Magic Is in the Buttons and the Software

Gandalf_Staff_Commands.png
Ring_Outside.JPG
Crystal_lit_2.jpg
Gandalf_Magic_Staff.png

Ultimately the Magic of my Gandalf Staff comes down to moving a magnet across hidden momentary switches(buttons) connected to a ProTrinket. The sound, LED array and NeoPixel are controlled by the ProTrinket depending on the current pattern, the button clicked and how it was clicked.

The software defines several "Patterns" and there are 4 buttons, each with various click events as illustrated in the diagram above.

Patterns

  • Solid Colour - This is one of thousands of colours at a certain brightness
  • Swirling Rainbow pattern - ROYGBIV across pixels
  • Larson Scanner - old school Cylon or Kitt style Larson Scanner
  • Flickering Stars - twinkly random lights
  • Fade - Al pixels one colour and fade through ROYGBIV
  • Detect Evil - Switch the crystals colour from red to blue magically
  • other

Examples - see chart above

  • Single-Click the Function button in ANY pattern, and code will activate the next pattern.
  • Hold the Increment button in Sparks pattern sends power the BlueTooth switch.
  • Hold the Increment button in a non-Sparks pattern switches Center Light Off.
  • Release the Toggle button in a Any pattern switches Cracks Thunder (code snippet below)
  • -
void btn_Toggle_longPressStop()   // Line 1078 of code
{
   // fire thunder
    musicPlayer.stopPlaying();
    musicPlayer.setVolume(1,1);                           // crank it up. 
    musicPlayer.startPlayingFile("/tundrBst.mp3"); 
   
} //

Below is the Full Source Code, Click Event Chart and Fritzing for my hardware build.

NeoPixel Lighting

PIxelRing.jpg
DSCF1801.JPG
_AYH1980.JPG
20181003_070625.jpg
20181003_070635.jpg
20181014_161142.jpg

Time to hook up and test the neopixel ring. As always, I like to make my wires extra long and trim them to fit later.

Solder the 3 wires to the Neopixel ring.

  • Red will go to power from battery
  • Black goes to common Ground
  • Yellow wire will be hooked to pin 10 on the ProTrinket
  • It is recommended to put a resistor on data line.

Code

  • There are plenty of simple sample all over the internet.
  • My complete code is listed just above

Relays and Transistors As Switches.

TransistorDiodeRelay_Switch_1600wborder.png
DSCF1528.JPG
DSCF1823.JPG
DSCF1530.JPG
DSCF1531.JPG
DSCF1532.JPG
DSCF1533.JPG
DSCF1534.JPG
DSCF1538.JPG
DSCF1539.JPG
DSCF1542.JPG
TransistorLastWire.jpg
Scientist tests LED Relay

Some devices draw too much power to be safely handled by a ProTrinket, Arduino or reed switch. In order to solve this, I used a Transistor as a switch and a low voltage Relay to do the heavy load switching. My build required 2 of these circuits, one for a hidden On/Off switch to the ProTrinket, and the other for the LED array.

The Fritzing illustration above shows the configuration for a Reed switch to signal the ProTrinket by pulling pin A0 to ground. The ProTrinket then indirectly powers the array of LEDs via the transistor and relay.

Note: Should be 3.7volt battery attached to rail in Fritzing.

If you are planning to use an LED array (flashlight) in your build, you will need 2 sets of these circuits.

If your design allows for more space, spread out !

  • Arrange and trim parts.
  • solder the 220 ohm resistor to the 2N4401 transistor. (signal from Arduino)
  • solder the black wire to the Transistor. (to common ground)
  • solder the orange wires to HK23f relay. (this is the LOAD we are switching)
  • solder transistor to the relay (bent lead).
  • Solder both sides of the Diode to the relay (watch the polarity).
  • Solder the red wire ( direct power from battery).

Once you have determined where and how these will fit into the staff we will finish connections in step___

Once again, I am no pro. Here are some references; Arduino button, Transistor as a Switch, Relays

Battery, Charging and Power Switch

BattCharging.jpg
Charger_Intact_Power_Connection.jpg
Charger_with_Broken_Connection.jpg
Charger_Power_SW_Wires.jpg
Charger_Installed.jpg
Relay_Circuit.png

In this section we will prepare the Lipoly backpack charger for a switch, add wires for switch, and attach to the ProTrinket.

First we need wires for a switch then to attach the charger.

  • Scrape away the metal between the contacts. (this breaks connection)
  • Solder the red and black wires for power switch (Red is closest to battery connector)
  • Solder the charger onto the Pro Trinket.

On/Off Circuit - final wiring in Step ___ placing Relays

  • The black wire will go to a common ground
  • The Red will go one of the orange wires from relay circuit

NOTE: If you are not using a Pro Trinket, You will need to look at the docs for your device and determine how to switch power while it is running on battery. For a Feather, a reed switch across GND and Enable pins would likely work.

Center Light - Aka LED Array

DSCF1547.JPG
DSCF1550.JPG
LED_Array_Wired2.jpg
LED_Array_Wired.jpg

After wiring up those Relay,Transistor, diode circuits, this will be a breeze.

  • Grab a cheap flashlight with multiple LEDs and carefully take it apart.
  • Use your 3.7volt rechargeable to test where to attach leads.
  • Then solder your extra long red and black wires.
  • Test it again

Connecting to the relay for switching

  • Attach the Black wire to common ground
  • Attach Red wire to the output power of the relay (orange)

Blue-tooth Audio Streaming

Scientist tests Gandalf Staff BT Streaming Hack
DSCF1580.JPG
DSCF1583.JPG
DSCF1596.JPG
DSCF1611.JPG
DSCF1617.JPG
DSCF1701.JPG
DSCF1625.JPG

No point to try and re-invent this. All I needed was to buy a device, provide a new power source and hack the power switch. Easy breezy.??

Criteria for the BT streaming device

  • something small enough to fit the staff
  • battery operated.
  • input jack that fit feather musicplayer
  • price
  • and preferably local so I could check it.

Test the new BT module before breaking

  • plug into your phone, amp, cassette player...
  • pair with the speaker
  • power on/off and connect to speaker

Typically, these devices have only one momentary bush button and has 2 functions as follows;

  1. Hold the button down for 3-5 seconds turns the device ON or OFF.
  2. Hold the button down for 8-10 seconds to enter pairing mode.

Dis-assemble the module

  • Carefully pry apart the plastic edges

Remove battery.

  • Cut the leads for the small battery in the blue-tooth module.
  • Tape off the wires for safety! You don't want that battery shorting out.
  • You also may want to use that little lipo some other day.

Hack the power switch

  • Determine which side of the switch is positive with multi-meter
  • Confirmed voltage (3.7 volts) across the switch.
  • Solder a wire to each side of the switch.
  • attach power for testing
  • Touch the wires together to test connections/function.
  • Next, I attached a transistor as a switch triggered by the Aurduino (Trinket).

Test the new Module

Prepare and Place - Music Player

DSCF1644.JPG
DSCF1650.JPG
DSCF1651.JPG
DSCF1634.JPG
DSCF1661.JPG
DSCF1679.JPG
DSCF1682.JPG
DSCF1681.JPG
DSCF1689.JPG
DSCF1690.JPG
DSCF1693.JPG
DSCF1698 - Labels_1f.jpg

As much as I would like people to follow in my footsteps, This section has a mountain of wiring that could be avoided if one used Adafruits Feather and stacked the Music Maker FeatherWing right on top. NO WIRES! well, hardly any.

  • In this section I selected a colour pattern for wiring and soldered on extra long wires from the MusicMaker.
  • Solder matching wires to the ProTrinket. This way I can solder connections easier.
  • Carve out space in the staff.
  • bend and place wiresto fit.
  • Connect speaker wires to the audio amplifier.

Follow details of the Fritzing diagram below

Downloads

Staff Construction Part 1

DSCF1769.JPG
20181010_111714.jpg
20181010_111725.jpg
20181010_115439.jpg
20181010_114108.jpg
20181017_115602.jpg
20181017_110250.jpg
20181017_110230.jpg
20181017_110121.jpg
20181017_110131.jpg
20181013_181426.jpg
DSCF1407.JPG
20181013_181415.jpg

Prep: Build gripper.
In order to hold the round wood while working, I cut a notch into some 2x4 scrap. Then I clamped notched pieces onto staff. I was then able to hold the piece while I cut, drilled and shaped the wood.

Step 1: Split the wood lengthwise.

OK, the risk of breaking the wood while splitting was too great. Out came the hacksaw! Be sure to have a good grip on the staff and watch both sides as you go. I cut 1/2 way then flipped it over, re-clamped, and cut upwards.

Tip: many hacksaw blades let you turn the blade to an angle and keeps the handle out of the way.

Step 2 Hollow Out areas for components.

This is the time to lay out your components and decide where everything is going to fit.

Arduino - It needs to have access to the USB to re-charge the battery and program the device.

Blue Tooth module - It should be near the top, not buried. prob best not next to ic, relay

Speaker - The sound is better if the air can move out through a hole.

Sound Device - Likely close to Bluetooth depending on wiring. LOTS of connections to Trinket

Battery - Can really go anywhere if you want to wire it, but don't be sticking a screw through it later.


I planned to use the knot I found under a branch for USB access. This will allow me to reprogram the Trinket and more importantly recharge the battery. Using a drill, I made a few holes close together and then chiseled out rough edges. I drilled out the knot just big enough for a USB cable and made sure the ProTrinket would line up.

I was lucky to find another knot in the wood and I drilled some holes through it for a speaker and chiseled out both sides to fit.

Staff Construction Part 2 - Extension

20181024_204822.jpg
20181024_121002.jpg
20181024_122132.jpg
20181024_122258.jpg
20181024_122253.jpg
20181024_122328.jpg
20181024_133853.jpg
20181024_135016.jpg
DSCF1411.JPG
20181024_181825.jpg
20181024_181805.jpg
20181024_182514.jpg
20181024_182847.jpg
20181024_190320.jpg
DSCF1413.JPG
20181024_204844.jpg

When extending the staff, I wanted it hollow, in case I needed to run wiring into the bottom of the staff. I opted for some brass plumbing fittings as connectors. A far easier, but not hollow, connecter would be a pool que connector.

Step 1: Make the bottom section.

From stock lumber 48" long, I ripped(cut lengthwise) 2 pieces to about 1" x 2" each. Together they form a rough square pole 2" x 2" and 48" long. I used some carving tools to hollow out each half a bit.

Step 2: Install Coupling into top of staff
First I cut off a small section of one half of the staff. This will be glued later. To stop the pieces from spinning inside the wood, I cut a notch into the coupling with a hacksaw and fashioned a key from a piece of brass to fit the notch. I drilled/chiseled matching notches into both halves of the staff to fit the key and coupling. I then soldered the key in place on the coupling and tested fit both halves of the staff top. Once happy, I glued that portion and clamped it.

Step 3: Install 5" threaded brass extension into bottom of staff.
The bottom portion is basically the same steps as the top except, I had to estimate how far the extension would stick into the bottom and set the key at that point.

Step 4: Finishing:
Once glue/epoxy is dry, thread the pieces together and use a file to make the connection match. To do this file away the high points that touch. To remove the square part of the wood, I sat out in the sun and used a hand plane. worked great. WATCH OUT for the screws! Afterwards some light staining of the bottom and top will bring the two pieces together.

Prepare and Place - Relays

DSCF1767.JPG
DSCF1779.JPG
DSCF1797.JPG
DSCF1818.JPG
DSCF1823.JPG
DSCF1843.JPG
DSCF1848.JPG
DSCF1859.JPG
DSCF1860.JPG
DSCF1862.JPG
DSCF1863.JPG
DSCF1864.JPG
DSCF1866.JPG
Gandalf_Magic_Staff.png

Time to install the 2 relay assemblies we made previously into the Magic Gandalf Staff. These can be placed anywhere convenient, but I would recommend not placing them too close to any reed switches as there is a slim chance of the magnetic coil in the relay effecting the Reed Switch. I was running out of space so I tried to get them tight together. Have a look at the images to see how I did it.

  • Tip: I cut a V groove into a piece of 2x4 to hold the curved side of the staff.
  • To pre-drill holes for Relays, I marked/taped the drill bit with depth of the relay.
  • I checked to ensure the bit would not go through the staff and drilled out some holes.
  • I aligned the 2 relays into decent position.
  • Then I hot glued them onto a piece of cardboard to keep them still
  • Next I soldered together common black wires. see Fritzing Diagram
  • Solder Common Red (power) wires.
  • For LED Relay, Solder 1 of orange wires to red.
  • For LED Relay, Solder a long Orange/Red wire to remaining orange wire.
  • Then I soldered on long color coded wires to the power relay's orange wires..
  • I bent and shaped the wires around the speaker to get spacing right
  • Lastly I conformed the wires to the staff and ran them close to the ProTrinket.
  • Once happy with positioning I hot glued it in place on electronics side of staff.

Downloads

Prepare and Place Switches

20181031_104115.jpg
20181031_104122.jpg
20181031_120149.jpg
20181031_120403.jpg
20181029_161151.jpg
DSCF1680.JPG

Placing switches

  • I chose some locations
  • carved out enough space to hold the reed switch

Wiring

  • I used ribbon cable and soldered every second wire to ProTrinket pins A!-A4.
  • I soldered every other wire to a common ground.
  • I then trimmed wires to reach the switches.
  • and finally solder the wires to switches.

Tie Up Loose Ends

DSCF1723.JPG
DSCF1698 - Labels_1f.jpg
Gandalf_Magic_Staff.png
Gandalf Staff Reveal
Gandalf Staff Rainbow

Time for all the final connections.

Carefully follow the Fritzing Diagram to connect all the last wires.

Downloads