2023-02-13

Time Marches On

This has been posted without my usual proofreading and editing. Expect their to be misstakes. 😉

Laptop Time

Sunday night. I grabbed the MacBook and headed to bed.

It read 27% on the battery indication. That's nice, I thought, when did I last use it? Turns out it was two weeks ago, when I used it to write a blog post in bed. As I wrote back then, it was at 50% when I started that text, and I did spend some hours writing. And then two weeks of sleep with no charging. Pretty good battery life, yes.

Anyway, I have plugged the charger in now.

Time Moves Slowly When You're Sick

Haven't written anything in a week now. I will at least partially blame that on being sick.

Don't worry, It's Not Lupus. Most likely just a normal cold. I have also swab-tested my nose three times in the last five days just to be sure.

It started already on Wednesday with a pretty sore throat. It was worse by Thursday morning, gradually worsening further during the day. I could still sit at my desk and work (I work from home) without too much difficulty, but needless to say I cancelled a meeting I had that afternoon. As evening rolled around my nose was not happy at all, though.

Friday was much worse, the cough started and my nose was constantly dripping and generally non functional for all the usual things a nose should do. I decided to not get any work done.

Package in Time

The FedEx-driver called me around 11:30, saying they had a package for me. Hearing my voice they asked me if I was sick and quickly agreed to go up the stairs and just leave the package outside my apartment door. Very kind of them.

It was the Sensor Watch board I had ordered on CrowdSupply a week prio. CrowdSupply is a crowd funding site, except it's good. It's focused on electronic boards and things for makers and the like, and they help the creators to make sure projects are actually realistic and can ship. They also take care of distribution and things like that. Many neat project there.

Sensing Time

The Sensor Watch project was launched already a year ago, and shipped to the backers at the end of last year. The really neat thing about CrowdSupply though is that once a project ships they will usually stock the product and you can just order it and know you will get it right away.

The Sensor Watch is in stock right now. I ordered Friday a week ago, and exactly one week later the package arrived.

The Sensor Watch board is a replacement circuit board that goes inside a Casio F-91W or A158W watch. The F-91W is a classic watch that has been in production for over 30 years. It's compact, stylish, durable and reasonably priced. Do be aware of fakes though.

I do happen to have an F-91W, which I do use. It's awesome. With the Sensor Watch board inside though, it's even more awesome.

Everything else is kept original, including the watch display. It's impossible to see that anything is different with the watch. That is, until you start pushing the mode button.

Firmware Time

The Sensor Watch board contains an ARM Cortex M0+ microcontroller. It has 256 kB flash memory and 32 kB of RAM, as well as 8 kB EEPROM storage. It can run at up to 32 MHz. It's also very low power, and the watch will achieve battery life of over one year on the CR2016 coin cell.

The specs might not sound like that much, but it's still very decent for anything you would want a watch to do. It even has full speed USB-connection, even though you need to disassemble the watch to plug it in.

And plug it in you want to do. The main strength of the watch is that you can adapt it to do whatever you like. There are a few ready made firmware images that can be easily programmed to it, but it's after you git clone the GitHub repository and start compiling your own firmware that it really shines.

It's relatively easy to get going, even if you don't know too much about about programming. If you can find the terminal / command prompt on your computer, edit files and follow instructions you can probably get it working …

… is what I would write if the instructions were a bit more complete. As it is right now you still need to figure some things out. There are also no instructions for Windows, only Linux and macOS. But everything is currently being very actively developed, and things will improve.

(Future Niclas here, not feeling as sick any more: I realise that what I wrote here about the documentation might sound a bit negative, but that was not really my intention. There is actually a lot of good information on the docs site. It's just a bit sparse, for now, about compiling the firmware. It's definitely enough to figure it out, but I'm sure there will be more detailed step by step instructions in the future. As I said, it's still very much in active development, with code being pushd to the repository every single day.)

There is also a Discord server (I'm sure this link will stop working any time) where you can get help.

By the way, am I the only one who things Discords are a less than ideal way for documenting things? It's good for chat and sharing things now, but relying on it for things that should be available later has always seemed like a bad idea to me. "Just scroll up to find it" it is not really optimal. But, anyway, it's mostly chat between a lot of people developing parts of the firmware, so once things settle down I'm sure proper documentation will be written for all parts of it.

(Future Niclas again: This is not a dig at this project specifically. Yes, for now some things are a bit hidden in the threads of the Discord, but that's mostly because they are just not 100% ready yet. They are litterally working on the code as I write this, so it's quite understandable that a lot of things will be in the developer discussions and not yet documentet. I did not mean anything negative about the Sensor Watch developers here.)

In Time

Anyway, yes, it's pretty neat. The "operating system" for the Watch is called Movement, and it has a large collection of faces that can be selected from and put in order to be cycled through with the mode button.

You can have as many or as few as you like. There is plenty of storage in the watch for them.

It's also relatively simple to make your own faces using the included template, there are even instructions. Or clone one of the existing ones and make changes to it.

For testing there is a simulator. Basically the firmware is compiled with Emscripten to code that will run in a web browser.

On Time

Flashing (programming) the board is very easy. Step one is to completely disassemble the watch. Ok, maybe not that easy then, but once the board is out and free (battery must be removed) you just plug it into a usb micro cable.

It's quite neat really, how the actual circuit board slots right into the connector on the cable.

Double-tap the small reset button. The LED on the board will pulse and the computer will see a mass storage device, a normal "USB-memory". To flash a firmware, just drag the watch.uf2 file that you just compiled or one that you downloaded to it.

After happily blinking for a few seconds the board will reset itself, rudely breaking the USB-connection as it does so. Your computer will get annoyed by this and scold you for not properly ejecting the disk before unplugging it. Please pay no attention to this message. It's not your fault, and it's also, in this instance, completely safe.

Then it's just a matter of putting the board back in the plastic frame, putting the battery on the board (there should be a small piece of double sided tape on the battery helping it say in place), snapping the metal part back over it all, and finally be able to see the display spring to life to test it.

If it works, the module can be placed back inside the watch case (make sure the buttons are not pushed in) and the rubber sealing be carefully re-positioned, before the case back is screwed on again.

Make sure you turn the screws backwards until you feel them fall down into their groove, before you screw them in. They fasten with basically no resistance. Do not over tighten.

Flex Time

Oh, I almost forgot. The reason it's called Sensor Watch is actually because the board have a small connector made for plugging in a flexible PCB (printed circuit board) with any sensor components you would like (and can fit). The idea is that anyone should be able to make a sensor board of their own if they want.

Currently a temperature sensor is available. That board also have some test points for other signals, I2C, SPI, GPIO, that can be used to developing other sensors. Possible sensors include accelerometers and gyros for motion detection, barometers for altitude, magnetometers for compass and things similar to that.

Space is very limited though, so it will be difficult to fit much more than one at a time.

Future Time

Anyway, all this was in the future, as I was there, feeling rather ill, holding package of shiny new toy. But runny nose be damned I was going to try it out as soon as possible.

As afternoon rolled around I had gathered strength and blown my nose enough that I was ready to do it. It was a bit fiddly, and being sick did not make it easier, but it worked out all right. I flashed the board with a stock firmware with temperature sensor support and proceeded to take the watch apart. I even posted photos on Mastodon.

I was quite happy with it, then I left the watch on my desk and went to bed. My cold got worse, pain in my nose and face, headache, constant coughing, blocked nose, and I was not able to sleep much during the night.

Saturday was the worst, though I did manage to sleep for a few hours before noon.

And the night between Saturday and Sunday? That was also the worst.

The next few hours on early Sunday morning I didn't like at all.

Then I actually managed to sleep some more, and was actually starting to feel better.

Gradually things improved and by Sunday evening I could actually sit at the desk properly without having to go wash my nose every 10 minutes. I managed to read up enough to build a new firmware with the features I wanted, took the watch apart again and flashed it.

Exact Time

One of the things I added to the firmware was a rather new development for setting the time more precisely.

You set the time as usual, then go into a special settings face where you can adjust the time plus/minus in increments of 25 ms until the seconds tick exactly in sync with a more accurate clock, like time.is. When they are in sync, the correction is set.

The idea now is that eventually the watch will drift away a little, as the crystal (a vibrating quartz crystal is used to keep the time, yes, I'm aware that sounds just like magic) is not perfect. When that happens, you go back and make the adjustment again. This time, the watch knows how long it has been since the first correction, and it will calculate a drift to adjust the timing with. Thus it will correct for the inaccuracy in the crystal.

Just repeat this once more a few months later and you will have a hideously exact watch. I do believe I read something about using the temperature sensor for doing temperature compensation on the crystal too.

I like to keep all my clocks in sync 😄.

Back in Time

Anyway, I'm back where I began this entry. In bed, with laptop, now at 100% charge. The time is approaching 3 AM again. My nose is actually relatively clear and I can mostly breathe through it.

The end of this week did not turn out how it was planned at all, but you know, it could be worse. It could be raining.

I usually spend way to much time proof reading and correcting these things. I don't feel like doing that now. So if anything seems weird, or you know, more weird than usual, or the spelling is of, that's entirely my fault.

Good night.