sensor watch

preamble

some time back I was browsing Crowd Supply when I came across the Sensor Watch project by Joey Castillo. I had wanted some kind of "hackable" watch for a while, and had looked at things like Watchy, but this project hit the sweet spot for me. I love my existing F91-W, and this project was a good combination of open source with community software support. one key feature that was important to me is battery life - the Sensor Watch battery life in an average usage scenario is so long that Joey's is still going strong!

I was excited to pick one up and start messing around with it, but the first issue I came across was availability - the delivery date for Crowd Supply orders was summer 2023 (I think they ended up being delivered sooner than this, not sure). on top of this, shipping and import fees made it pretty prohibitively expensive. I've always found this to be an issue with Crowd Supply as someone based in the UK, even some things designed in the UK are very expensive from Crowd Supply as they are assembled in/shipped from the US. so I decided to build one myself!

component acquisition

the first challenge was acquiring all the necessary parts to actually build one. I downloaded the PCB files and generated a BOM to figure out exactly what I needed to acquire. I'm sure in ordinary times this would be easy enough, but the current state of some electronics/silicon supply chains had other things to say. some parts are of course still easy to come across, e.g. 10pF 0402 caps and 10k 0603 resistors; most of the components of the Sensor Watch are this kind of commonplace part. what quickly became clear from some scouring of the internet was that my main problem was going to be two parts: the ATSAML22J18A-MUT (the processor driving the Sensor Watch), and the FH19C-9S-0.5SH(10) (the connector used to attach the extra sensor boards).

ATSAML22J18A-MUT

the former of these was a fairly well discussed shortage that had been ongoing for a while. it was the driving force of the Sensor Watch Crowd Supply delay. I spent quite a lot of time searching around the internet, looking at various sites on the English-speaking and Chinese-speaking web. sadly this part was clearly in very short supply, and prices could get pretty insane from vendors that did have some stock. I received quotes for unit prices that include the following (USD/GBP): $79.35, $6.56, $13.61, $6.83 (MOQ 4000), £6.45. I guess some people are desperate enough to pay $79.35 :(. I spent so long looking for them that they ended up randomly coming back in stock on MicrochipDirect. as of the time of writing this article, they are again out of stock. the unit price I bought them for was £3.92, shipping and handling was ~£12.

FH19C-9S-0.5SH(10)

this part was out of stock everywhere I initially looked (the usual contenders for parts). I searched around in a similar manner as the ATSAML22J18A-MUT, and found some similarly wild pricing. I ended up purchasing a small quantity at a unit price of £0.44 from a website called dacikeys. yes, the site is actually called this. yes, the unit price is cheaper than digikey and mouser. yes, I actually received all of my order, consisting of working parts. I was definitely shocked that this happened, but sometimes bravery pays off I guess. I still can't endorse this shop.

PCB and stencil

for the PCB I opted to go with JLCPCB. I simply uploaded the relevant gerbers, and adjusted the necessary settings. notably, the thickness should be 0.6mm - this does narrow the choice of manufacturer (for example, OSH Park doesn't go this thin). I haven't yet ordered any sensor board PCBs, but PCBWay seems to be the option there. The PCB turned out great, although the silkscreen is a little hard to read at this size due to lack of sharpness:

assembly

I decided to assemble myself. partially because the logistics of paying for assembly when I had to source parts from many different providers seemed like a headache, partially because I thought it would be a fun challenge and learning experience!

a few things were necessary to solder the components to this PCB. I'm sure someone talented could hand solder this with an iron, but I can name a lot of things I'd rather do than try to do that (especially the QFN SAML) - and that list includes unpleasant things. I opted to go with hotplate soldering, which is a cheaper way to access the ease of reflow soldering. for a PCB like the Sensor Watch, where almost all the components are on one side, it's ideal. the hotplate I have is the ever-popular MHP30, which I run IronOS on. I highly recommend it, it's great! my soldering iron is the iconic Pinecil (not the fancy new V2 though :[) which also runs IronOS. nice!

process

the assembly process is as follows:

  • apply solder paste to the PCB with the stencil. make sure the stencil is really flush and just kind of squeegee it on with a plastic card. I used tape to hold it in place. then carefully removed the stencil, avoiding smudging the paste in doing so.
  • place components on the PCB. this was by far the most painful part of the whole process. a steady hand is not something I was blessed with, and some of these parts are really small. I used a microscope from Amazon for this, the ample manouverable lighting was a big help. a lot of time and patience is required, but it's very first time doable with no prior experience! simply go through the parts one by one, or by area of the board - whatever you prefer. then pick up the respective part with some fine tweezers, and slowly put in place on the solder paste. thankfully, the paste will lightly stick the component in place once you've done this (it is not knock-proof though!).
  • carefully (really!) place the PCB onto the hotplate and heat up. keep on until everything seems to be melted, and the components have hopefully been pulled into place. that's the top side done! let it cool down, then move on to the bottom.
  • time for some hand soldering. the button is pretty small, and very fiddly to do. I found you don't need too much precision, but you have to be really careful with your iron as the plastic button will melt if you touch it. once that's in place, it's just a matter of removing the buzzer connector from your old PCB and soldering it onto the back of the Sensor Watch PCB. this will feel blissfully easy after the button! you also have to place the battery clip, but no soldering needed here :).

one area I found particularly difficult was the area with the oscillator crystal and the two 0402 capacitors, C7 and C8. things are a bit cramped here, so extra care was needed:

software

at this point the watch was assembled with all components in place. did it work? at this stage, no idea. hopefully yes, and I could progress to the more familiar world of embedded software.

bootloader

the next necessary step is to flash the bootloader, so that we can put the firmware in place. unfortunately this requires a little more real-world action. we need to access the SWD points on the board to write the bootloader. ideally you could do this with some kind of pogo pin jig - and if you were doing any number exceeding about 5 I'm sure this would be worth the time. however, I decided to just solder some jump wires (stripped on one end, solid tip female on the other) to the points on the board. they're all close, but it's easy enough to do (albeit ugly). then I connected these to my Adafruit Trinket M0 (PyRuler would also work). the pin mapping is as follows: SWD=0, SWC=1, RST=3, V+=3V, GND=GND.

I used the flasher from the sensor watch repo to flash the bootloader. note that you could build the bootloader yourself first and put the generated binary into bootloader.h - the source is located here. personally, I just used the prebuilt version from the repo. I had to change part of the Adafruit DAP library and add the SAM L22 DID to get this to work, I provided the diff of this change in a Sensor Watch GitHub issue (I just now am remembering I promised to upstream this, oops!). mercifully, I got the red blinky LED, and all was good! I unsoldered the wires from the board, and tried to clean up most of the solder blob to keep the board fairly flat.

movement

now the bootloader is in place, the main firmware can be installed! the community firmware, Movement is great, so this is what I installed. there are a bunch of different useful faces available, and more functionality is always being added.

flashing firmware was easy: I plugged the PCB into the end of a USB Micro B cable (plugged on the other end into my computer) and double tapped the reset button (I find this has to be done quite quickly, using my fingernail was the trick to doing this reliably on such a small button). done successfully, the LED on the board pulses and a new drive labelled "WATCHBOOT" appears on the computer. now a built UF2 firmware file can just be dragged onto the device to flash, thanks to the bootloader flashed earlier. for the initial test, I just used a prebuilt image to check everything was working. I flashed this, and the LED pulsed and turned off, signalling success.

from here I just assembled the watch with the Sensor Watch PCB, and it worked! I verified LED and buzzer function by playing around with various functionality. success!

developing on movement

one face I found particularly cool was the TOTP face. I use TOTP 2FA on various accounts, so having access to the codes on my wrist at all times was really appealing. at the time, the TOTP face only supported one key - so I decided to improve it.

thankfully, Sensor Watch has an emulator for development. without this, development would be pretty tiresome with the flashing and reassembling of the watch getting tiring if you needed to iterate on some code and test it on the watch. the emulator runs inside the browser and uses Emscripten. some minimal instructions on how to build this is available on the README. this allowed me to extend the TOTP face easily and allow for multiple keys. my PR was merged, and the functionality is now available for anyone to use. the keys are added at compile time, so they are baked into the firmware on flashing. for my purposes this is fine, as I never really change them. however, with the recent addition of a LittleFS filesystem, the community have added a version of the face which stores the keys on the filesystem. awesome!

some more details on using Sensor Watch for TOTP is available on this blog post (HN discussion, if you dare). it's even running my code :)!

epilogue

some summary thoughts:

  • shoutout to Joey Castillo. for creating the Sensor Watch as a beautifully open source project (the fact I could independently make my own is what it's all about!). for being so helpful and kind when I asked for help. for having such a positive attitude towards those in the community who are using Sensor Watch to learn about all kinds of things (seriously, check out the Oddly Specific Objects Discord to see how much this guy is giving to the community).
  • sometimes it's worth just trying things that are difficult. this is my first time successfully doing and small-scale soldering of this kind, and it worked out great with some patience. having the motivation from making something I thought was really cool was an important factor here I think.
  • if you have a Sensor Watch (or are planning to!) please go ahead and contribute to movement if you have a cool idea. I'm sure some reviews would be helpful to spot any issues on existing PRs before a maintainer gets to them to save some time.
  • the one issue I've had with using my Sensor Watch for TOTP is clock accuracy. the clock drifts over time, so I have to set the time once or twice a week to keep it nice and accurate for the TOTP functionality to be nice to use. but a community member is working on this, and it's going to get a lot better. check out the Discord channel to see some seriously cool engineering going into this calibration effort.



email me to have a conversation