Introduction: Metal Doctor Who Sonic Screwdriver With Arduino

How to machine / make a custom sonic screwdriver out of aluminum with Arduino inside.

This Instructable documents the creation of two custom Sonic Screwdrivers for two very special people in my life. They are huge  Doctor Whofans and I could not resist making this for them.

Please note this project made use of metal working machinery (Mill and Lathe).


Technical Specifications:
Material: 6061 aluminum, black delrin (acetal) and glass
Electronics: ATTiny85, custom PCB, 4 AG13 batteries, ear bud speakers, 2 SMD LEDs
Programming platform: Arduino

Here is a video


PLEASE NOTE: This instructable is ever evolving. I am making changes to it frequently to make it better. Please see STEP 2: "Update Tracker Page" to see what changes where made and when. And keep checking back often because I am still adding A LOT OF PICTURES. Thanks

Step 1: Fabrication

Most of the parts were machined using manual machining tools.  While a lot of these tools are very expensive and beyond the means of 99% of us (me included) there are tools out there for amatuers like us. The first lathe I ever used was one I purchased from Homier for $350.   I made 30+ lightsabers with that one before I sold it for the same price I purchased it for.



Places to look for machining tools:

Harbor Freight
http://www.harborfreight.com/7-inch-x-10-inch-precision-mini-lathe-93212.html

Grizzly Tools
http://www.grizzly.com/products/7-x-12-Mini-Metal-Lathe/G8688

Taig
http://www.taigtools.com/mlathe.html

Sherline
http://sherline.com/lathes.htm

Step 2: Update Tracker Page

Because I feel that there is more that I can add to this instructable I have added this page to track all the changes. This way everyone (including me) knows what changes happened and when.


UPDATE - 12/3/2013: Auction ended. No more sonics available to sell. I am out of material to make more.  Thanks Everyone for your interest.

***********************************************************

UPDATE- 5/2/13 : I do not feel that this instructable is yet complete. So, I am building TWO(2) more sonics and taking a lot more pictures. My goal is to explain how this was done in excruciating detail. I will even dissect the Arduino Sketch so everyone will know what to modify to customize the sound and lights to their liking. I will also be providing Eagle files and schematics as well as gerber files so as to reach more people. Please check back often.

UPDATE - 5/4/2013 : "May the Fourth Be With You"
Added "Step 2: Update Tracker"
Added "Step 5: Usign a Lathe" - This page will detail setting up the piece to be cut on a lathe, the actual turning of the piece, and even making custom tool bits to get the job done. Yes, a lot to cover on one page. there are lots of pictures.

UPDATE - 5/5/2013 : "Feliz Cinco de Mayo!"
10:00 am - Added three more pictures in Step 5.
Added one new picture in Step 8.
1:30 PM - Added "Step 6: Turning other parts" - This page has a lot of before and after pictures. I hope people like them.

UPDATE - 5/7/2013
Added Eagle gerber files and schematics to "Step 11 - Circuit Board". Added a second PCB design as well. Please check it out.
Added new Step. "Step 10 - Arduino Sketch picked apart."  the Arduino sketch (program) is dissected and each section is explained to make it easier for everyone to customize the sound and lights to their liking.


Minor UPDATE - 5/14/2013
Made minor change in text on Step 10. I am hoping that this instructables becomes a comunity project and modify the arduino code to make different sound effects.

Please comment if there is anything else that needs pictures or more explanation.

Minor UPDATE - 8/5/2013
Thank you everyone for looking at this instructable. I was a FINALIST for the Epilog Contest. I won a runner up prize pack. THANK YOU INSTRUCTABLES for this great website and for the contests.

UPDATE - 11/6/2013: I have made two more sonics screwdrivers. They have potential buyers already..  I have someone helping me make a few more with the materials I have left. I hope to have completed sonics for sale soon.

UPDATE - 11/11/2013:  Added more pictures.  Auction for one of three sonics starting November 14, 2013.

UPDATE - 11/25/2013:  Auction for my last fully built sonic screwdriver for sale is here.

http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=121223232551

UPDATE - 12/3/2013: Auction ended. No more sonics available to sell. I am out of material to make more.

Step 3: Materials and Tools

Materials:

I went shopping at OnlineMetals.com for most of my raw materials.

Assorted aluminum round tubes and rods
  For this build I purchased 12 or 24 inches of each:
  •  1” dia. solid round stock
  •  0.5” OD x 0.083” wall tube
  •  0.75” OD x 0.065” wall tube
  •  0.625” OD x 0.065” wall tube
Assorted solid plastic rods
  For this build I purchased 12 inches of each:
  •  1” dia. Black solid Acetal (delrin) round stock
  •  .75” Nylotron (nylon) round stock.
1 glass marble
1 Attiny85
breadboard
High intensity LEDs
Blank PCB
Solder
Wires
150 Ohm Resistor (I used this site http://ledcalculator.net/)
Very small speakers (got mine from broken ear buds)
1 tactile button, low profile
Screws
1 ball bearing
A small piece of semi-rigid plastic (water bottle?)
Superglue (cyanoacrylate)
5 minute epoxy
Shrink tubing
Electric tape


Tools:

Computer with Arduino installed
Lathe (sorry if you don’t have this)
Mill (sorry if you don’t have this either)
Drill press
Chop saw or hack saw
PCB etching kit (chemical or mechanical)
Assorted drill bits
Assorted screw taps
Assorted end mills
Assorted lathe tools
Rotary tool or grinder
Dial indicator and magnetic base
Digitial Caliper
a good ruler
Safety glasses (Safety first)


Raw materials were purchased from: http://www.onlinemetals.com/

Step 4: Crude Assembly and Test Fitting

Cut lengths of aluminum to make up the main body, the inner sleeve, neck and emitter end.

One of the Sonic Screwdrivers cut dimensions:
  • 0.75" OD tube cut to 5.5 inches length for the main body.
  • 0.625" OD tube cut to 2 inches length for the inner sleeve
  • 0.5" OD tube cut to 2 inches length for the neck
  • 1" solid bar cut to 1.25" for the emitter
  • 1" solid Delrin cut to 1.25" length for the end cap

Do whatever is necessary to make the parts fit together.  In my case, I had to reduce the outside diameter (OD) of the .625” tube to slide freely inside the .75” OD tube. I then had to reduce the OD of the .5” tube a quarter inch from the tip so it would fit snugly into the .625” tube. I bore a hole in a section of 1” round stock so the other end of the .5” tube fits snugly into that.  All of the above gave me a crude sonic screwdriver shape. 

I am not sure any of the above could get done precisely without a lathe.

I will cover all of the above in more detail on the next page.

Step 5: Using a Lathe

Using a lathe is fairly straight forward: you clamp an object in a chuck; the chuck spins; a tool  is brought up to the spinning object and material is cut/scraped away.  There are a lot of online instructions to explain it all. Here are a few links. If planning on purchasing a lathe, read these.

http://www.sherline.com/latheins.htm (I like Sherline and wish I had the money to buy one).
http://team358.org/files/mechanical/HowToUseALathe.pdf
http://www.americanmachinetools.com/how_to_use_a_lathe.htm

On this step I will show through the images how I chucked a piece, centered it on the chuck, then made the cuts.  The longest process is the setup, which involves making sure the piece is centered and balanced, choosing the correct cutting tool, and making sure the cutting tool is the correct height. Choosing the right tool and setting the tool height is covered in a lot of tutorials and is often about user preference. But centering the piece to be cut is not open to interpretation. The piece is either centered and the end result looks good, or the piece is off center the the end product is ugly.

As part of the setup, I realized my cutters were to large to make the hole for the glass marble and I had to make a cutting tool (boring bar). I will provide links to show you how that is done too.

First piece to shape is the emitter head. I chucked a piece of 1 inch round rod. I tightened the chuck just enough to hold the piece firmly in place but not tight enough to actually start turning (cutting) it.  To help visualize how to center and balance it, i colored stock red and the other side blue. I attached my dial indicator to the magnetic base and put that on the slide.  I put the tip of the dial indicator probe a 1/4 inch from the tip of the piece on the chuck.  I started turning the chuck by hand slowly and watched the dial indicator needle swing wildly across the dial face. I made a mental note of the highest value and the lowest value.  I then rotated the chuck so that the dial needle was at its highest value.  I then took a large allen wrench and tapped the top of the work piece as I watched the dial needle move to a lower value with each tap.  I was trying to bring the dial needle to the middle of the highest value and the lowest value. Once I have it close (about 3-5 thousands of an inch) I rotated the chuck by hand again, making a mental note of the highest value and lowest value again. the second time rotating the chuck by hand the dial indicator was not moving as much. Again, I rotate the piece to the highest value on the dial indicator and tap the top of the workpiece to move the dial needle between the highest value and lowest value. Rotate by hand again and the needle should now either stay steady or only move one thousands of an inch. Tighten the chuck completely. This whole process used to take me anywhere from 10 to 15 minutes because i learned on my own and no one explained it to me. Now I can center an object in a chuck in about 2 minutes.  Remove the dial indicator.


The piece is now centered and is ready to be turned.

I rotated my tool holder to the 20 degree position and turned the top of the emitter. I then rotated the tool holder to  zero degrees and made my other cut.  I attached a drill chuck to the tail stock and put a 1/2 inch drill bit on. Using plenty of WD40, i bore a hole through the center of the emitter. Cutting oil or tapping oil works too.

The cutting tools I have are 1/2" cutters. they are way too big to fit inside the center hole. But I needed to make the hole bigger to make the marble fit. What I did was get a 1/8" square HSS tool blank and shaped it into a boring bar. I followed these two instructions.
http://www.sherline.com/grinding.htm
http://littlemachineshop.com/instructions/GrindingToolBits.pdf
It is a lot easier than it looks. Just make sure to have a cup of water nearby and cool the tool blank frequently.

Once the hole for the marble was done, i removed the piece from the chuck, rotated it end over end 180 degrees, and re-chucked it. I did the setup process again and turned the piece to its final shape.

The neck, inner sleeve, and main body followed the exact same process above. once all the pieces were turned. I did a crude test fit.

I hope everyone enjoys the pictures.

Step 6: Turning Other Parts

The emitter is done being turned on the lathe. It will get some milling work done.

The next piece to be turned on the lathe is the inner sleeve. The outside diameter is reduced so that is slides easily inside the main body tube. Something to remember when turning metal is that the amount removed is doubled. This is because I am taking material away from both sides as the material turns. So if I remove .25 inch of material I reduce the diameter by .50 inch. It makes a huge difference if I forget that fact. And unfortunately it is a whole lot easier to remove material than it is to add it back on.

The neck is next to be turned. 1/4" of the end is turned to reduce the diameter so that it would fit snugly into the inner sleeve. Then grooves are made for decorative reasons.

Finally the main body is turned on the lathe. This is done to clean up the ends. Grooves and cuts are made for decorative reasons.

The pieces are then put together for a crude fitting.

Step 7: The Details

Cut a slot along the top of the .75” tube. We will call the .75" tube the main body. This slot will contain the sliding switch to extend and retract the sonic screwdriver. The length of this slot should equal the length of the sonic screwdriver’s neck.

Cut, etch or dremel grooves and pattern onto the surface of the .75” tube. Get creative with your design. A laser etching device would have been great at this point. Imagine the fine details I could have created if I could have laser etched the metal. I could have made alien hieroglyphs, mystic patterns, or fine traces of circuitry. Make designs on the 0.5" diameter tube (the neck) too.

Shape the button going into the slot out of plastic, wood or aluminum. I went with aluminum. Drill a hole through it to hold a rod/stem that will push down on a tactile switch on the sonic screwdriver circuit board.

insert the inner sleeve inside the main mody. Attach the button you made above (we will call it the "switch assembly") to the inner sleeve inside the slot. Move the switch along the slot to make sure it is not binding. Remove the switch assembly and the inner sleeve.

Shape the emitter head as you see fit. Add grooves and slots to maximize the light coming out of the LED. Superglue or epoxy the marble in place. Shape the bottom plug as you see fit. Consider maybe drilling a small hole or several small holes for sound to come out. I made this part out of black delrin.

Test fit everything again. Perhaps now would be a good time to drill holes and tap them for the screws that will hold everything in place. I used 4-40 set screws to hold most of my pieces together. The only exceptions would be the brass screws holding the ball detent (more on that on the next page) and socket screws to hold the switch.

Step 8: The Locking Mechanism or Ball Detent

(Sorry, this will be the longest page.)

This part is really not necessary but adds fine detail to the sonic screwdriver. The ball detent mechanism basically locks the sonic screwdriver in the extended and retracted position. It also adds a satisfying “click” when sonic screwdriver is moved into those positions.

First cut a section .75” tube about 2” in length. Next cut out a “T” section that is about 2/3 of the circumference of the tube (on one of mine it looks more like an “L”). 

now take that T section and press it onto a section of .75” tube using a vise. This will mold the inside diameter of the T to be .75”.

Drill holes on the extremities of the T. Attach this T section of aluminum onto your sonic screwdriver main body about centered along the length of the slot. Temporarily secure with screws. Look inside the main body and see how much the screws protrude inside. Make a note of it. You will need to cut or grind down the screws so it is flush with the inside wall of the main body. 

Measure out a good spot under the T where you will drill a hole in the main body that is the same diameter as the ball bearing. Remove the T. Drill the hole for the ball bearing.

Put the inner sleeve back into the main body and attach the switch again. Get a Sharpie (permanent marker) and insert it into the bearing hole. Slide the switch all the way to the top of the slot and all the way to the bottom. Make sure the marker is marking the inner sleeve. Remove the switch then remove the inner sleeve from the main body.

Using you mill, make a slot on the inner sleeve along the marker line about 1/32” deep. On the ends of the slot use a drill bit to make a dimple 1/16” inch deep. The bearing will ride along this slot and will fall into the dimples to lock the sleeve in place.

On the inside of the T make a pocket 1/16” deep that lines up with the bearing hole in main body. Make the pocket twice as large as the bearing hole. Cut a piece of plastic twice as large as the pocket and super glue it over the pocket. This will act as the “spring” that will put downward pressure on the ball bearing. Put axle grease or lithium grease on the plastic.

Insert the inner sleeve into the main body, attach the switch, insert the ball bearing into the ball detent hole, and attach the T over the whole thing. Do not over-tighten the screws holding the T in place. Slide the switch along the slot to test for binding. Loosen the screws holding the T to remove any binding. Tighten the screws if the movement is too lose or does not lock. Movement should feel smooth and should snap or click at the ends of the slot.

Great! let's move on

Step 9: Arduino Sketch

I followed these directions to use Arduino on an ATTiny85:
http://hlt.media.mit.edu/?p=1695


Attached is the Arduino sketch I used to make the sound and lights. Feel free to modify the sketch so you get the pitch and modulation you want as well as the blink pattern you want. In the sketch I used two(2) output pins to control two LEDs.

I used an Arduino Uno to program the ATTiny85. Please follow the links above to find out how to program an ATTiny85 as an Arduino microcontroller.

I set up two breadboards. one breadboard is to program the chip. the other breadboard is to test the program.

The code build on the example code -
created 21 Jan 2010, modified 30 Aug 2011, by Tom Igoe
(I give credit where credit is due. If using my code, please do the same)

Here is the TONE TUTORIAL in Arduino

the sketch looks like this:

/*
* Sonic Screwdriver
* Version History
*
* Version M 2.5
* For ATTiny85 16Mhz
*/

#include "pitches.h"
int melody[] = {
  NOTE_F7, NOTE_G4, NOTE_A2};

int noteDurations[] = {
  9,12,7 };
int x = 0;

int led1 = 3;
int led2 = 2;

void setup() {

pinMode (led1, OUTPUT); 
pinMode (led2, OUTPUT);

}

void loop() {
   if ( x < 5){
    digitalWrite(led1, HIGH);
    digitalWrite(led2, LOW);
    x = x++;
  }
  else if (x < 7) {
    digitalWrite(led1, HIGH);
    digitalWrite(led2, HIGH);
    x = x++;
  }
  else if (x < 9){
    digitalWrite (led1, LOW);
    digitalWrite (led2, HIGH);
    x = x++;
  }
  else {
    x = 0;
  }
   for (int thisNote = 0; thisNote < 3; thisNote++) {
    int noteDuration = 1000/noteDurations[thisNote];
    tone(4, melody[thisNote],noteDuration);

    int pauseBetweenNotes = noteDuration * .14;
    delay(pauseBetweenNotes);
    noTone(4);
    }

}

On the next step will will look at the code above in more detail.

Step 10: Arduino Sketch Picked Apart

Here is how the code works and how to modify it.  Please play with the code below to get different sounds and share your results in the comment. If you are serious about buying a kit from me, then I expect you to be playing with this code and giving me feedback.

/*
* Version M 2.5
* For ATTiny85 16Mhz
*/

#include "pitches.h"

This line includes the pitch tab into the code. The pitch.h tab contains the different pitch - we will call them "NOTE" from now on.

int melody[] = {
  NOTE_F7, NOTE_G4, NOTE_A2};

This array “melody” holds the notes that will be played and the order they will be played in. I experimented with 2 to 5 notes. For my project i felt 3 notes made a good warble or chirping noise for the sonics i was making. I had a musician buddy analyze the real sound from the TV show and he told me the predominant note was in the G scale. Please mess with this array by adding and removing notes, changing the notes and arranging the order until you get the sound that you like.

int noteDurations[] = {  9,12,7 };

Note duration. Musical notes are typically full note, half note, quarter note, and 8th note. This is represented in the code as 1,2,4,8 meaning 1 second divided by 1,2,4, or 8. However, we are not making music. We are making a warbly, chirpy noise. So I played with non-conventional note durations like notes durations 1/15th of a second long or 1/6th or 1/12th. The array “noteDuration” below states that NOTE_F7 will be played at 1/9th duration, NOTE_G4 plays for 1/12th, and NOTE_A2 at 1/7th. A note duration must be specified for each note in the “melody” array. Play with noteDuration to get the right rhythm for your sonic.

int x = 0;

This is just a variable to be used as a counter

int led1 = 3;
int led2 = 2;
void setup() {
pinMode (led1, OUTPUT);
pinMode (led2, OUTPUT);
}

This two variables define the pin numbers for our LED output. If you really wanted to you can add two more LEDs since not all the pins on the ATTiny85 is being used. But I think two is enough.


void loop() {

Main loop. With each run through the main loop, only ONE note is played at the specified duration followed by a pause (more on pauses below).


 if ( x < 5){
    digitalWrite(led1, HIGH);
    digitalWrite(led2, LOW);
    x = x++;
  }
  else if (x < 7) {
    digitalWrite(led1, HIGH);
    digitalWrite(led2, HIGH);
    x = x++;
  }
  else if (x < 9){
    digitalWrite (led1, LOW);
    digitalWrite (led2, HIGH);
    x = x++;
  }
  else {
    x = 0;
  }

This section defines the LED blink pattern. Use any logic you like to make the blink pattern you like. Mine uses “x” as a counter with a range of 0-10. At the lower range LED1 is on and LED2 is off. Then in the middle range of “x” Both LEDs are on. At the upper range of “x” LED1 is OFF and LED2 is on.


   for (int thisNote = 0; thisNote < 3; thisNote++) {
    int noteDuration = 1000/noteDurations[thisNote];

The above code goes through and plays the notes in the melody array one note at a time. The part where it states “thisNote < 3” the value must equal the number of notes in the array. So if "melody" has four notes then "thisNote<4". The rest of the code figures out the note duration in milliseconds.



   tone(4, melody[thisNote],noteDuration); 

This is where the tone is actually outputed to the speaker. In this example the output is on pin 4.


   int pauseBetweenNotes = noteDuration * .14;
   delay(pauseBetweenNotes);
   noTone(4);


A pause between notes has to be inserted otherwise the notes run together and it sounds like a bad screeching noise. The pause duration cannot be a fixed amount of time (like 1/4 second between each note) but must be based on the note duration to sound right.  The code below sets the pause time as a percentage of the note duration.  Play with the decimal value to get a good pause time between notes. I found a value between .09-.21 to be a good amount of pause. The last line "noTone(4)" turns off the output to pin 4.


    }
}

END of code

Step 11: Circuit Board

Attached is the circuit board I made to hold the ATTiny85.

The file was made on CamBam. My PCBs where mechanically etched using an CNC router. Chemical etching would probably be easier.

Also attached is RAR file called "EagleFilesAndSchematics" which has the Eagle files and as well as the PDF for a two layer board layout ( BOARD2.pdf) and the schematics ( SCH2.pdf) pictured above.

Please download those if you are used to using Eagle for electronics design.

I had an electrical engineer with decades of experience look over my design and confirm it is sound. He designed the schematics for me on Eagle. He did make a change to my design in that the schematic has the switch attached to the POSITIVE terminal of the battery to complete the circuit to 8th leg of the ATTiny85 (VCC). Also his PCB design is double-sided. Both PCBs are 0.5 inch by 1.5 inch.

The PCB can be made to fit inside the inner sleeve. If the PCB design is too large, let me know and I can shrink it down some more. The only limitation is the size of the ATTiny85 itself.

Here is the Datasheet for the ATTiny85:
http://www.atmel.com/Images/Atmel-2586-AVR-8-bit-Microcontroller-ATtiny25-ATtiny45-ATtiny85_Datasheet.pdf

Please pay a lot of attention to the ATTiny85 datasheet "Pinout" diagram. The physical legs are NOT corresponding to the pinout numbers. That is PIN 2 is NOT LEG 2 on the DIP chip. The pinout mapping is as follows:

PIN1 = leg6
PIN2 = leg7
PIN3 = leg2
PIN4 = leg3

Leg 4 is GROUND
Leg 8 is VCC (positive to battery)

Here is a video of me making a PCB mechanically:



The PCB etching is mirrored because the chip and most of the components will be on the back side of the PCB. This is why the "1" is backwards.

Step 12: Solder the Components

Use a good soldering iron to solder all the components to the PCB. Save the LEDs for last. Perhaps, don’t solder the LED’s until you know their final position and know how you are going to route the wires.

Please do not linger on the ATTiny85 legs. Use a real hot iron and a solder that flows well. Touch on each leg as briefly as possible. It may even be a good idea to take a break after soldering 4 legs, let the chip cool down then solder the rest. It would be sad if you get the ATTiny85 all programmed and working on a breadboard only to burn it up once it is permanently soldered to the PCB.

Apply power and make sure you have lights and sound.

I could not figure out how to make a battery holder in such a confined space. My solution was to shrink wrap four batteries together and attach the wires to the end. The wires are held in place with tightly wrapped electric tape.

Test fit the PCB to make sure the tactile switch is underneath and centered on the sliding switch assembly. If you are sure about the fit and function of the PCB, apply a small amount of epoxy on the edge of the PCB and slide it into place inside the inner sleeve. Let the glue set.

Step 13: Final Assembly

Put everything together and take pictures. Enjoy saving worlds and history with your very own sonic screwdriver.

The two i made were given away as gifts. They were received with great joy and much surprise. The effort that went into this project was well worth it on seeing their reactions. I also made a gift box for it.

and now, another video:




Epilog Challenge V

Runner Up in the
Epilog Challenge V