An Idea for a Weasley Clock

In Harry Potter, there was a magical item called a Weasley Clock which showed where everyone in the family was at  particular time. Tom from Australia wrote in, wanting to design one but not sure how to get started. He’s new to embedded but is a software developer. I was amused by the idea of such a clock and procrastinating about another project so I put together a response. Happily, Tom says you can read his mail so here it is.

“I heard you mention the mbed devices are a good next step from arduino but I find their website so vague as to getting in to where to start. As Lee mentioned there are so many resources and people on hackster using arduino, particle, pi etc but it seems like mbed have their info squirreled away!”

You know, that is a great point. The mbed website is a terrible place to look. Instead, you want an mbed-enabled board. But that doesn’t help you choose which one. Let’s see what features you need.

“I was hoping to have an analog component to the project where each family member has a servo with a clock hand which points to where they are location wise which I was going to drive with something like a PCA9685.”

That part is an I2C to many-channel PWM controller. Good choice. I was concerned as the datasheet says it is LEDs; motors draw more current but Adafruit used this for one of their boards. So I’m not going to dig further. Instead, we’ll put “needs I2C” in the list of things the microcontroller needs.

I am not mechanically inclined enough to know how to do multiple servos around a central face so I’m going to close my eyes to the engineering realities and say “I2C, cool.” Next feature:

“I was also hoping to have a digital component where each family member would have a small colour lcd. I was wondering if you knew of a hardware setup which might support say 5 small colour lcds (i.e. 1-2 inches in size) and could potentially render a bmp or jpg the user defines?”

Sure, what you want are watch faces for the ubiquitous smartwatches or tiny picture frames. The goal interface here is SPI. Next look with one that says “internal frame buffer” so that it maintains the picture on the screen without your code doing anything. That’s pretty important if you want to have a bunch of screens. These are going to be $10US or more each. OLED would be good but you’ll probably find something LCD-TFT that works.  This could be expensive. Adafruit has one ($15) but it is not in stock. Sparkfun’s $35 one is serial, not SPI so it doesn't work.

Serial communication takes a serial port on your processor and it is not easy to share those pins between multiple displays. SPI is designed to be shared between different peripherals (where peripherals = screens for you). So SPI is better for this application. And given this many LCDs, I’d say you want at least two SPI ports. SPI isn’t good for long distances so plan to keep this part of the clock face small… maybe plan for under ten centimeters, definitely not a meter.

Also, these have 128x128 pixels, 16 color. So one pictures is 128*128*16 = 262144 bits = 32kbytes. For five supported screens, you need 160kbytes of space for your images. And you didn’t mention it but I bet you’ll want to change the images without downloading new ones someday. So! 1Mbyte of space seems prudent.

But how are we going to get the pictures? Happily you’ve already considered this:

“I was hoping when the family member registers the first time they can supply their image through a mobile app and that image then gets used on the lcd screen when their status updates. I wasn't sure how that could/should work as I haven't seen an example where image data has been transferred over http and cached locally on storage etc and then rendered on screen.”

It all sounds so easy when you put it that way. Naw, really. This is the part where things got hard. You really want the update to be trivial or the family members are going to forget and that makes this whole thing more frustrating that useful. Trivially easy interactions with humans is really hard.

In the end, it means the device has to be on the internet. And that means it is not going to be easily battery powered (not impossible but not trivially). Since you didn’t say “has to hang on a wall with 2AAs”, I’m going to hope a wallwart is ok.

Given always-on Wifi and user-ease, I’d see if the family was willing to tweet at the family clock. Programmatically checking a twitter feed is easy-peasy. Emailing pics would probably be easy too. These are cloud services that are very well understood. But now you have WiFi and Internet. I hate to say it but you really need an operating system.

Oh, sure, you could go the Photon route or you could bolt on one of the many ESP8266 boards, you don’t need fast internet so those could very well do what you want. They both have enough features (they both would need additional storage space for the images but I bet you could stream them from a website if you wanted).

You did tell me that you’ve thought some about processor choices:

“I know Arduino doesn't really have the grunt. I was looking at the photon or electron for the advantage of not worrying about messaging through aws or azure using their built in pub/sub models online but I'm not too attracted to needing pull ups to interface with external components and I'm not sure it has the processing grunt to achieve what I'd like.”

Indeed, this is not a job for the Arduino UNO. Make Magazine recently said that if you are trying to decide whether to have an Arduino or a Raspberry Pi, you should explain your project. And if you need more than 2 “and”s, use a Raspberry Pi. This is really, really good advice.

In fact… this is going to be completely uncharacteristic of me… use a Raspberry Pi 3. It has WiFi, on board storage, and more processing power than you could possibly need. It is easy. The goal is for you to make this, not productize it. Don’t over constrain the problem or you are likely to get frustrated. The RPi3 will make this a fun project instead of a chore.

So, here’s how I’d do it.

Step 1. Train your family.

Use an RPi3 and a screen (any HDMI screen, this is a good excuse to upgrade your home monitor). Have the RPi3 display a clock face and the image your family sends you. This is all virtual and all software. I know, you wanted a hardware project but this is going to look pretty neat after a weekend or two of work. Plus, it will also help you work out the details with your family and determine project feasibility.

In your email, you mentioned developing a mobile app like it was no big deal. If that’s true, and if your family is ok with being tracked, maybe automatically send their location periodically. (Important note: ASK if this is ok! People who do not want to have their location sent over the internet at frequent intervals tend to be very, very rabid about this. I am one of those people.) But if you do auto-updates, then no one has to remember and your clock updates positions automatically (magically!). Of course, you wanted photos too so you can use this step to figure out if the family takes selfies often enough to satisfy going on to LCD screens.

You may end up having family email the photos or tweet them or upload them to a dropbox folder. There are lots of cloud options. Choose an easy one. And by easy, I mean easy for your family, not for you.

Step 2. Tiny screens.

Once you are getting regular (or automatic) updates from your family, ditch the HDMI monitor and switch to the tiny screens over SPI. The Raspberry Pi will have no trouble with this. The software will become more complex and you’ll start thinking about 3d printing an enclosure. This is normal, good even. But this shouldn’t be hard.

Well, there may be a few difficulties with the RPi not having quite enough SPI select pins (it has two, you need one for each screen). I bet you can get around this with GPIOs. That will make a bit more sense after you’ve gotten the two screens working. This is the sort of thing where I say “exercise left to the reader” and you read “small can of worms” but it is a small can of worms, not a barrel of snakes. It will be ok. Baby steps.

Step 3. Motorize the hands.

I don’t know how you’d do this. Multiple servos all coming out at one spot? That doesn’t seem right. A solenoid shifted gearing system? Now I’m just stringing mechanical engineering words together. You can see why I put this in the future. We’ll need to study up, my coauthor here Andrei has some information on his website. It is only two hands though. Anyway, but the RPi3 can do I2C so the the whole PWM thing will work fine. You may need 3.3V to 5V level shifters though. Really, you can’t have too many of those around anyway.

Or, actually, I might switch from motors to an RGB LED strips and assign family members colors and/or vertical places. Look at NeoPixels from Adafruit.

Oooh, look, someone did something like that on Instructables. They used a RPi for part and a Spark-now-Photon for their cloud connectivity. And as long as I’m searching google for “Raspberry Pi Weasley Clock”, I should point you to Alistair Barber’s tutorial as well. I think these are both interesting but time has passed and you can get more computing power for less so don’t feel constrained.

Step 4: Productize!

Naw, don’t do this. I mean, you could use a Cortex-M4F and a small WiFi module to make this power efficient, cheaper, and still very functional. It would be pretty neat. But this is a lot more work. It is neat work (don’t get me wrong, I quite enjoy what I do) but it is more work than might be prudent as a gift for an elderly friend. The RPi is a better stepping stone to getting it done.

Well, Tom, that is where my advice ends. Oh, a little more. You mentioned you are making this for your father-in-law who is getting some dementia and is always asking where people in the family are when they aren’t nearby. To that I say, this is a great idea. Make it easy to use, it won’t be useful unless it is easy for the recipient and the family. And also, check out the Hackaday Prize! Assistive technology is a category and this totally fits into that. Plus, it has huge potential to be adorable. Not that adorability is a judging criteria at all.

More importantly, the community is good for getting help with things like this. They are generally encouraging. Best of luck and I hope you enjoy the project.

Oh, look, Tom already setup a project page!

I wonder where everyone is.