Location Tracking "Weasley Clock"

12,703

142

30

Introduction: Location Tracking "Weasley Clock"

As with so many other people, I've always been a massive Harry Potter fan. One of the coolest magical items in the series was almost certainly the Weasley family clock that had a hand for each family member, and moved to reflect their location. I had wanted to make my own version of the clock for a long time and there were lots of different designs online. Unfortunately, many of them were expensive to make, overcomplicated, or just not very effective. In the end, I made my own design and was really happy with how it turned out. You can use a laser engraver to create the background images but I present a way for adding the icons to the clock without the need for one as well!

As with any good coding experience, I ended up basing my design off of some previous work. This design was inspired by an awesome tutorial on Adafruit (https://learn.adafruit.com/gmailbox).

Supplies:

Supplies

1 x Plywood sheet (size depends on how large you want your final clock to be)

Matte gel medium (if you don't have access to a laser engraver)

1 x Wemos D1 mini (any other ESP8266 board would do but this one is cheap and widely available)

1 x SG90 micro servo (add an additional servo for every extra person you want to include on the clock)

1 x 5V DC power supply with 2.1 mm barrel jack

1 x 2.1 mm DC socket with screw terminals

Wire

3D printer filament

Tools

Soldering iron

3D printer

Laser printer

Drill

Hacksaw blade

Laser engraver (optional)

Step 1: Designing the Clock Face

First we'll design the board that everything attaches to. You can either cut your plywood to your desired size, or else lots of hardware stores will cut things to the size you want for a small fee when you buy the wood.

To design the icons for the clock face, I recommend using something straightforward like Powerpoint, or you can use a free online service like Canva.com. Either way, you can choose icons to represent all of the locations that you want to track and arrange in the order that they'll sit on the clock face. I have attached one of my designs as a guide but you'll obviously need to update the size and icons for your own preferences.

We want to print our design but we need to make sure the design is MIRRORED before we print it (see the uploaded file for an example). The reason is that we are going to transfer this design to our plywood and the design will transfer back-to-front. You also need to make sure that the design is printed on a laser printer. This technique will NOT work if you print the design using an inkjet printer. Most public libraries and big office supply stores tend to have laser printers that you can print from for cheap.

Once you print the design, cut away the blank space and liberally brush some of the matte gel medium onto the paper on the printed side. Press the paper onto the plywood with the design facing down. Make sure there are no wrinkles in the paper and that the design is in the right location. Wipe up any gel that spills out the side and leave the plywood to dry for 12 hours.

Once the gel has dried, use a damp cloth and lightly rub the paper. This should soak the paper and make it fall away, leaving the pattern affixed to the wood. Be careful not to rub too hard as you might rub off the design as well.

If you have access to a laser cutter, you could use that as an alternative to burn a design into your wood.

Step 2: 3D Printing

The pieces we want to 3D print are the arrow with a name on it, and the mounts for the electronics. If you want a slightly neater look, you can also print off the servo cover.The files for the electronic mounts and servo cover are attached, and a blank arrow is attached for you to customise with your name. If you aren't confident with 3D design, I recommend using Tinkercad online. It is very straightforward to use and you can simply import the blank arrow, add a text object with your name, and position the two however you want on top of each other so that the text pokes up above the arrow by about 3-5 mm.

When printing your arrow, you might want to have the name be a different colour as in my photos. If you don't have a fancy dual extruder printer, set your printer to pause when it starts printing the text, and change your filament out so that the text prints in a different colour. This pause can be set in Cura under "Extensions - Post Processing - Modify G-Code - Pause at Height".

Step 3: Wiring

The wiring here is pretty simple. Servos use a lot of current, which is why we are powering it straight from the 5V power supply as opposed to powering it from a pin on the Wemos board. Depending on whether you want one arrow or two on your clock, follow the relevant wiring diagram. The barrel jack is connected to our 5V power supply.

It's also important to note here that the pin numbers written on the board don't match up with the pin numbers that we reference in our Arduino code. The pin numbers that we'll use in the code match up with the GPIO numbers seen in the attached pinout diagram. In case you don't want to follow the diagram, the connections are as follows:

d1 mini GND -> GND/barrel jack -
d1 mini 5V -> 5V/barrel jack +
d1 mini D2 -> servo1 signal
d1 mini D4 -> servo2 signal
servos GND -> GND/barrel jack -
servos VCC -> 5V/barrel jack +

Step 4: Adafruit IO

The clock works by sending location information from your phone to a cloud service called Adafruit IO using the MQTT protocol. This means we need to create an account at https://io.adafruit.com/. Once you've signed up for an account, create a feed called "Locations". This should be fairly self explanatory and if not, there are some other great tutorials out there created by Adafruit.

Next, you'll need to write down your username, and your Adafruit IO Key. You can find this key by pressing the "Adafruit IO Key" button in the top right corner of your feed. We'll use this information in the next step.

Step 5: Modifying and Uploading Code

The good part of the Wemos mini board is that we can upload code to it from the Arduino IDE. The bad news is that there's a bit of setup to go through before we can get to that point. Fortunately, lots of other people have written guides for this so instead of echoing what they have said, you can read it for yourself HERE.

The only extra thing we'll need to add is the Adafruit IO library. When you're adding the "ESP8266 Microgear" library, also search for "Adafruit IO Arduino" and install the latest version (3.7.0 at the time of writing). It might tell you that there are other libraries that this library depends on so go ahead and let it install those too.

The code you need is attached here (the single user code is attached here, the two user code is attached in the next step). You'll need to save the two files in a folder with the same name as the .ino file and then you'll need to make some modifications:

  1. In config.h, use the information you wrote down in the previous step to update IO_USERNAME and IO_KEY with your Adafruit IO username and key respectively.
  2. A few lines below, update WIFI_SSID and WIFI_PASS with the name and password of your home wifi network.
  3. In the main code file, you will need to update the angles at which each of your icons occur. These angles are listed in the #define statements near the top of the code. If you have added any locations that are different to those in the code template, you'll also need to add those and define them with their own angles. If you add or remove any locations, you'll also need to update the "if else" statements at the bottom of the code to include those new locations. The pattern should be quite clear from the existing code. These angles won't necessarily be perfect but we can test them and refine them once everything is mounted in place.

With all of these changes made, you're ready to upload your code to the board. Follow the instructions in the linked tutorial if you want more info about this.

Step 6: Two Person Code

The code you need for two users is uploaded here. Follow the same steps as mentioned in the previous step to modify this code before uploading.

Step 7: Mounting the Components

Hold your servo in the position where you want the arrow to be and trace the outside of the servo with a pencil. Drill a hole in this rectangular region and use a hacksaw blade to cut out the rest of the rectangular region. If you have a jig saw, this step will go much quicker but it's not essential. Once you've made a rectangular hole, the servo should fit into it snugly and you can use the screws that should have come with your servo to hold it in place. If you printed the servo cover in the previous step, you can slip it over the front of the servo now.

Take one of the servo arm attachments that should have been included with your servo and glue it to the underside of your 3D printed arrow. Once the glue is dried, this arm should easily attach to the servo to keep the arrow in place.

Next, screw or glue the 3D printed electronics mounts onto the back of your plywood board and place the electronics in place so they can't fall out. Now that your code is uploaded and the arrow is attached, you can plug in the clock and test whether the angles in your code are correct. To test this, turn on your clock and open up your locations feed in Adafruit IO on your computer/phone. You can manually enter data to change your location by pressing the "add data" on your location feed and typing in the location you want to move the arrow to. Update the angles in your code as appropriate and reupload the code to confirm that all of your angles are correct.

Step 8: Setup Phone for Location Tracking

We now have a clock that can display a location based upon the value it reads from the Adafruit IO feed. What we still need to do is figure out how to update that location feed depending on where we are. I initially tried using the IFTTT app but found that their location trigger feature is not very reliable. Instead, I chose to use the Tasker app. The app costs about $5 in the Google Play Store but has heaps of awesome functionality. Install the Tasker app on your phone as well as the Tasker MQTT Plugin (also available for download from the Google Play Store).

Next, we need to set up tasks to update our location. This can be a little time consuming but once it's done, you won't need to change anything again. Open the Tasker app and go to the "Tasks" tab. Press the plus button and give your task a name. I suggest calling it "Home", "Work", etc. for extra clarity. Once you've created the task, hit the plus button in the bottom right corner and select "Plugin - MQTT Publisher". Click on the pencil button next to the "Configuration" bar and enter the following settings:

  • Server address: io.adafruit.com
  • Port: 8883
  • Client ID: Leave blank
  • SSL/TLS: Ticked
  • Username: Your Adafruit IO username
  • Password: Your Adafruit IO key
  • Topic: "Adafruit IO username"/f/Locations (replace "Locations" with the name of the feed you want to upload to if it is different)
  • Message: The name of a location (HOME, WORK, TRAVELLING, etc.)
  • QoS1 selected
  • Retain Flag: Not ticked

You'll need to make one of these profiles for each of the locations on your clock. Once all of these tasks are created, go back to the "Profiles" tab. Click the plus button to create a new profile and select the location option. Here, you can type in a location and define a radius in which a selected task will execute. As an example, put in the location of your home and make it execute the home task when this profile is activated. You can also add an exit task to your profiles which will execute when you leave the defined area.

Add a profile for each of your locations and ensure that the exit task for all of these locations is the "Travelling" task. This means that if you are ever in an area that hasn't been defined, the clock will show you as travelling. You can have different locations execute the same task as well. For example, I have multiple shopping centre locations as separate profiles but they all execute the "Shopping" task.

Once all of the profiles have been added to your phone, your clock will now be fully functional however I recommend updating some settings to prevent the app from draining too much of your battery life.

The Tasker app can drain a lot of battery depending on how often you tell it to check your location so we will tell it to check less often.

  1. Click on the three dots in the top right corner of the app and hit “Preferences”.
  2. Make sure you are on the “Monitor” tab, scroll to the “BT Scan Seconds” setting and change the value to 120 (if you later find you’re draining too much battery, you can make this and below values larger to check less often).
  3. Do the same with “Wifi Scan Seconds” (change to 120), “GPS Check Seconds” (change to 100), “Network Location Check Seconds” (change to 100), and “GPS Timeout Seconds” (90).
  4. Scroll to the “Display Off Monitoring” section and change “All Checks Seconds” to 200, with a Timeout of 20.
  5. In the “General Monitoring” section, change both timeouts to 5.

Tasker sets alarms to know when to check for location changes. This unfortunately means it will display in your notifications as though an alarm is set. To remove this, go to the top of the Monitor tab and change “Use Reliable Alarms” to “Never”.

The last thing to change is to make sure your phone doesn’t stop the app from working when the screen is turned off.

  1. Open your phone’s settings app and navigate to the apps menu (different for every phone but on mine it is “Apps and Notification”
  2. Go through and find Tasker in the list of apps
  3. Open the battery/power option (could be under “Advanced”) and look for something like “Battery optimization”.
  4. Ensure this is set to “Not optimized”. This stops the phone from closing the software when the screen is turned off
  5. While you’re here, you can also turn off all notifications for the app as you won’t need them.

Step 9: Conclusion

That's it! You should now have a working "Weasley Clock". This project is a combination of a lot of different skills, from 3D printing to wood photo transfers to electronics so I recommend it for people with some experience in microcontrollers.

If you come across any issues, or come up with any cool modifications, feel free to comment here or send me a message.

Happy making!

Microcontroller Contest

This is an entry in the
Microcontroller Contest

Be the First to Share

    Recommendations

    • Pi Day Speed Challenge

      Pi Day Speed Challenge
    • Trash to Treasure Contest

      Trash to Treasure Contest
    • Microcontroller Contest

      Microcontroller Contest

    30 Comments

    0
    craftisan
    craftisan

    7 days ago

    This is just incredible!

    0
    thagrol
    thagrol

    16 days ago on Step 9

    Am I the only one who finds these creepy, intrusive and privacy violating?

    0
    thagrol
    thagrol

    Reply 16 days ago

    If you trust your family members, why do you need a weasly clock?

    Yeah, superficially it seems cool, but it's a survailence tool with all that implies.

    1
    lmjd14
    lmjd14

    Reply 15 days ago

    I get if you don't like the idea and that's obviously fine. I guess I'll just add a few things:
    1. There's probably an important distinction between "need" and "want" here. If you need a way to track your family then yeah, that's not cool. If you want a quick way to figure out that your partner has gone to the shops/is working late and that's why they're not home when you get home, then I see no issue with it.
    2. The locations can be whatever you make them but they will generally have to be pretty generic. For example shopping might refer to 5 different locations like it does on my clock, and any location that you haven't already programmed into your phone will just appear as "traveling", which is super nonspecific.
    3. The person who's location is being recorded can always turn off the gps on their phone or just go into the app and manually change their location if they really don't want to be tracked. If you're reaching the point where you feel the need to hide your location however, you've likely got bigger problems to consider in your relationship.

    Anyway, I'm just a Harry Potter nerd who wanted to share a fun electronics project I made. You can make it or not, or hopefully you can at least take some part of the project and apply it to something different :)

    0
    thagrol
    thagrol

    Reply 14 days ago

    I apreciate where you're coming from. I guess as long as the person(s) being monitored consents it's likely to be OK though I'm concerned that it could also damage a relationship (too much time in "travelling" for example or "travelling" when it should be "work").

    The Weasley clock is one of several aspects of HP that I find troubling: racism (muggles and mud-bloods) and insitutional slavery (house elves) to name two.

    0
    lmjd14
    lmjd14

    Reply 15 days ago

    Hey friends. I don't think this discussion is going to go anywhere productive. I think it might be best if we just leave it here and end the discussion

    0
    spiritburner
    spiritburner

    16 days ago

    My kids would go spare if i put them on something like this!! I would expect most would, sometimes it´s a pity we don't all live in the wizarding world really, save a lot of trouble and strife. Even with he who must not be named.....Fun idea though.

    1
    taki2007
    taki2007

    Reply 15 days ago

    Can't understand why no-one at the Ministry of Magic thought of making a magical Weasley Clock with Voldy's name on it, pointing to very precise locations (like coordinates). But then again, we are talking about people who use birds to communicate even urgent stuff, when the muggle world invented the telephone...

    0
    lmjd14
    lmjd14

    Reply 15 days ago

    Time to bust out my Harry Potter nerd hat :P
    So it's mentioned somewhere that the presence of magic tends to mess with electronics. For example, you couldn't use a computer inside hogwarts because magic would interfere with it so I think you'd have trouble setting up your router to access your emails in the wizarding world.

    As for the clock, I always assumed you had to cast a spell on the person who you were going to track to link them to the clock so you couldn't just make one that tracked Ol' Voldy whenever you wanted to.

    Anyway, I've just brought much more Harry Potter nerdiness than is necessary to a comment on an electronics project.

    I'll see myself out...

    0
    taki2007
    taki2007

    Reply 15 days ago

    Yeah, "I read it in 'Hogwarts: A History'", thanks a lot, Hermione 😉
    On a more Potterhead-compatible note and even trying to stick to the in-universe logic, I really don't get why they did not have a widespread use of something as useful as the telephone (in a magical version, I mean). Of course they can use fireplaces as a Skype, but why does it seem so f'ing complex to use ? Maybe because Hogwarts is a strict kind of boarding school like the kind where kids are not supposed to phone home, in order to harden them a bit?

    Real life answer: JKR did not have her world building planned ahead that much, so some later things, meant to impress the Muggle reader, really are OP compared to earlier events in the books. Like apparating is OP compared to flying on a broomstick, or compared to the floo network, so she had to later ret-con restrictions about these things, and add rules in an unconvincing "A wizard did it"-way 😄. Or inversely like the Laws of Transfiguration (as in, laws of physics) telling that you cannot really create food (wonder why you could not roast an unanimated object you justtransformed into an animal... 😜) are there to nerf things that were set up in the earlier books, and that people pointed out that there should be no conflict in a world where you can conjure (almost) anything out of thin air

    1
    throbscottle
    throbscottle

    16 days ago

    Very clever, though part of the beauty of the Weasley clock (in the film at least, I can't remember how I saw it when reading the book) is the brasswork and complicated looking dial - it would be nice to emulate that.

    0
    lmjd14
    lmjd14

    Reply 15 days ago

    Yeah. That was a little beyond my skill level I'm afraid. If there's anyone out there who can replicate the look of the real clock as well as the functionality, I would love to see it but I think I'm personally stuck with 3D printed arrows at this stage.

    1
    KryssLB
    KryssLB

    15 days ago

    With transferring a laser-printed design to the wood, an alternate way to do it (again, with a reversed page printed on a laser printer, not ink jet--or photocopied; most copiers use heat-set toner, which is what you need) is to put the paper design-side down on the bare wood, and then just iron the paper with the highest setting on your iron (no steam). The heat of the iron melts the toner enough that if you press pretty hard, it'll transfer enough of the toner over to the wood that you can use it as a pattern to go over with properly with paint or a wood-burner or whatever. You can put a cotton towel over the paper so the iron presses more easily into all the grain dips if you find it isn't transferring well. Peel the paper back up again slowly so you can see if it needs more ironing before you shift the paper's position on the wood.

    You can use the technique on fabric as well, to transfer embroidery patterns on; but in that case you'll want to use the highest setting that works for your fabric (again with no steam). Doesn't work on linen, though.

    0
    lmjd14
    lmjd14

    Reply 15 days ago

    Awesome idea! Sounds way faster than my technique. I'll have to give it a try!

    1
    jmacuk
    jmacuk

    Question 16 days ago on Step 9

    Way cool! Can this work with a single servo driving nested spindles, like a second, minute and hour pointer?

    0
    throbscottle
    throbscottle

    Answer 16 days ago

    You could make your own nested spindles and connect each one to it's own servo using gears or pulleys. Fiddly but I imagine hugely rewarding. I'd take a guess you could do 4 or 5 before it got difficult. To do it with a single servo you would need a gearbox and actuator to make it drive the correct spindle at any time.

    0
    lmjd14
    lmjd14

    Answer 16 days ago

    When I started the project, j searched for something like that but could never find one and could never figure out a simple way to make my own. If such a thing can be bought or made them I can't think of any reason why it wouldn't work

    0
    themelispan
    themelispan

    18 days ago

    Really nice idea! I instantly clicked on it when I saw it [ potterhead over here :) ]