Introduction: Functional Weasley Clock (IOT Location Tracker)
Christmas is approaching quickly, and now it's time to get on those gifts! For my Mom, an avid Harry Potter fan, I decided to create the ultimate fantasy paraphernalia item: A functional Weasley clock! For those readers who aren't as familiar with the series, this clock has a hand for each family member which points to their location. It most notably appeared during the second wizarding war, when each Weasely was located at their "Mortal Peril." While this project is heavily documented on the internet, I wanted to make my own version with a cheaper and simpler design. I was first inspired to pursue this project after looking slightlygreen's adaption of a location clock. However, he didn't describe in detail how to provide accurate GPS data for the clock to use. To solve this problem, I decided to use my phone as a tracking system! The final product turned out really well, and my Mom loved it!
How It Works
The Weasley clock is powered by an Arduino MKR1000. This chip creates a basic HTML website with six links. Each link rotates the servo to a different position/location. Then, an Iphone with the IFTTT app makes a web request whenever it enters a certain geographical area. This web request will activate the link corresponding to the current location of the phone.
Keep reading for in depth instructions on how to make this "magic" clock!
Step 1: Materials and Tools
- Arduino MKR1000 (If you're a nifty maker you could easily substitute this for an Arduino Uno + Wifi Shield or a Particle Photon.)
- Sail Winch Servo (See the note below before you purchase this.)
- jumper wires
- 1/2x8x8in piece of plywood
- Access to a 3d printer
- Access to a laser cutter
- a 2d printer
- a drill
- a stable wifi connection
- an account on the IFTTT site
- an Iphone or Android with the IFTTT app
- a wall to hang the damn thing on!
Continuous rotation/360 degree servos VS. Sailwinch/720 degree servos
You may be wondering what this thing called a sail winch servo is and why a normal old 360 degree micro servo from Adafruit just won't do the trick. Think of a continuous rotation servo as a normal DC motor, but with an easy way to finely control the speed and direction. However, this sort of motor is not able to turn to a specific position and stop like a normal 180 degree servo using the servo.write() arduino command. These servos are often called 360 degree servos even though they have a very different function. Sail winch servos, on the other hand, are made for remote control boats and behave just like a normal 180 degree servo, (you can pinpoint a position), with a larger number of possible of degrees of rotations. This is usually around 720 degrees. This makes sail winch servos ideal for a location based clock! For more information check out this article: https://www.raspberrypi.org/forums/viewtopic.php?f=32&t=56929
Step 2: Laser Cut and Prepare the Clock Body
The original Weasley Clock from the movie includes 10 locations on the face. However, some of these categories would be nearly impossible to detect, such as the difference between house and bedroom. My final edited down list of toponyms is this:
Mortal Peril (Set this to your greatest fear. . .)
I designed the body in Fusion 360 and then exported the sketch as a .dfx file. If you are curious how to make or customize your own check out the time lapse above of me designing it. For the rest, the file is attached at the bottom of this step.
First, import the .dfx file onto your preferred laser cutting program, I used Corel Draw. Then program your machine to these settings: (Reference the above picture to see which lines are set to each color)
LAYER MODE SPEED POWER
BLACK CUT 200.0 20.0
RED CUT 17.0 72.0
GREEN SCAN 250.0 20.0
The entire process to around a half an hour and turned out really well!
However, after I laser cut the product I realized that I had omitted a central hole for the servo shaft! To deal with this I found the center of the "circle" with a couple rulers, and then drilled a hole. Congratulations! You have finished the clock body!
Step 3: 3d Print and Finish the Clock Hand
I based my hand on the movie's depiction. First, I 3d modeled the hand in fusion 360 with a space at the rear for a small photograph. However, when I first tried to 3d print it horizontally, the end of the needle collapsed and the rest of the body badly warped. To solve these issues, I split the arrow into two parts and printed both vertically. Finally, it worked! I have attached these files above. Next, I superglued the pieces together with a third hand for support. After it dries, follow these steps to personalize it:
1. Find a picture of yourself either on your phone or computer
2. Crop it so there is nothing else in the background.
3. Before you press print, scale the photo down to a very small size.
4. Print the photo, cut it out, and attempt to insert it into the clock hand.
5. Repeat steps 3 and 4 until the picture fits snugly.
6. Use a small dab of double-sided tape to secure the photograph on the inside of the clock hand.
Step 4: Program and Connect the Arduino
The Arduino sketch I used is largely based off of this MKR1000 introduction tutorial by Charif Mahmoudi. It essentially sets up a basic HTML web page with six links. When each link is pressed, a servo rotates to a different position corresponding with a location on the laser cut clock. I also included lots of comments in the code that should give you an idea of how it works. We will later set up the IFTTT service to make automatic web requests when ever your Iphone enters a certain geographical area. The .ino file is available to download below. To upload the sketch to your arduino follow these steps:
1. Download the Arduino IDE from arduino.com.
2. Open the .ino file I attached.
3. Go to tools>board>board manager and install the "Arduino SAMD Boards (32-Bits ARM Cortex-MO+)" package.
4. Go to sketch>include library>manage libraries and install the "Wifi 101" library.
5. Physically plug the USB side of a micro-usb cord into your computer and the other into the Arduino MKR1000.
6. Go to tools>ports and select the com input that says "ARDUINO/GENIUNO/MKR1000" or something similar to that.
7. Go to tools/boards and select "Arduino/Genuino MKR1000."
8. Change lines 8-9 of the code to your own Wifi network and password.
9. If you have different locations than mine on your clock you'll want to edit the IF statements appropriately.
10. Upload the code!
11. Open the serial monitor under tools.
12. Write down or take a picture of the website URL.
13. Unplug the Arduino if everything went smoothly!
As for hardware connections, simply follow the basic circuit diagram attached. It is very simple considering there are only three wires to deal with.
Before anything else, make sure the library and board above have been installed and chosen in the tools menu.
If you still have trouble, their is one main problem that occurred with me. NOT ALL MICRO-USB CORDS ARE CREATED EQUALLY. Make sure your cable supports the transferring of data. When I first attempted to play with my Arduino MKR1000, I used a charging cord from a bluetooth speaker. This cord plugged into everything fine, but simply didn't pop-up in the port selection.
Step 5: Set Up IFTTT
IFTTT stands for "If This Then That." It is a service which fires an action if some criteria is achieved or "triggered." In this case, if my phone enters a certain location IFTTT will send a web request to the specified URL. Follow the pictures above and these steps to set this up:
1. Open the IFTTT app.
2. Tap on My Applets in the bottom tab bar.
3. Touch the plus icon in the top right corner.
4. Touch the highlighted this link and search for the "location" service.
5. Make the trigger You enter an area and specify that area to your home address.
6. Touch the highlighted that link and search for the "maker" service. The only possible action is Make a web request. Select that.
7. Now it input these settings for the details:
URL: The ip address of your Arduino MKR1000. We took note of this in the last step.
CONTENT TYPE: text/plain
BODY: /H (This is what is returned in the arduino code for activating the home link.)
8. Press the Finish button. Ta Da! The applet is complete!
9. Repeat steps 2-8 for the rest of the locations. The only things that should be changed are the specified area in step five and the body of the web request in step seven. If you are confused, the body of each web request is a forward slash and then the first letter of the location. For example Home = /H, School = /S, Prison = /P, etc. Have some fun with it too! Figure out the address of closest prison to you and set MORTAL PERIL to your greatest fear!! My clock ticks to it whenever I'm near the ocean; I'm not a fan of swimming!!
Step 6: 3d Print and Assemble the Electronics/Motor Housing
The servo motor and Arduino MKR1000 will be housed in a container that I designed in Fusion 360 the files are available for download below. Follow these steps to prepare the housing:
1. 3d print the "electroMount.stl" file. Remove the raft and supports.
2. Thread the servo wires through the hole in the 3d printed part. Then push the servo down into the bottom of the container.
3. Get a rubber band or hair tie and make a quick knot though the holes. See the pictures above for futher clarification.
4. Push the Arduino under the rubber band into its spot.
5. Find a screw that fits in the hole next to the servo. Screw it in until the motor is snug. Repeat this process for the three other holes.
Step 7: Attach the Electronics to the Clock
Time to glue everything together! First 3d print the "servoAttach.stl" file included below. Next, use a powerful super glue or epoxy to secure the clock frame onto the top of the servo. The spindle should now be sticking about half-way through the hole in the center. Now grab the 3d printed servo attachment and stick it through the center of the clock tightly onto the top of the servo. Finally, use more super glue to bind the center of the clock hand and the attachment together.
Step 8: Finish It Up!
The only thing left to do is add a power source and nail the whole body to the wall! While this project could be easily modified to support a battery pack, I chose to plug the micro-usb cord directly into a AC-USB adapter in the wall. Just plug the other end of the cord into any old phone charger! Then find a nail that fits in the hole above the servo, and pound it in.
I put a lot of time and effort into this project so I would appreciate if you would vote for me in the IOT and Sci-fi Contests! Also, I would love to hear any questions or concerns in the comment section below!
Also, I want to give a shout out to Zposner! Since I don't have a laser cutter he was kind enough to let me borrow his! Thanks Ziven!
Third Prize in the
IoT Builders Contest
We have a be nice policy.
Please be positive and constructive.