I saw this awesome design for a binary wrist watch https://www.instructables.com/The-Ultim ... ary-Watch/ and instantly wanted to have one. But I thought I could have a go designing it myself. Not a fan of external programming jigs like on the original and I wanted to keep the new part count as low as possible. So no fancy switching regulator or funny business. What I wanted was a USB-C programmable watch that would use ideally an internal RTC. I thought this could be a good opportunity for having a go with STM32 chips so thats what I went with, choosing an STM32F103CBT6. Its a pretty common one but I wasn't about to go crazy on my first try and I wanted as much support as I could get. Luckily for me this chip supports flashing over an internal usb peripheral and features an internal RTC. Also available for this chip are some pre-compiled binary files for a USB bootloader which will come in handy later.
Next comes the led's, I chose to go with some 2mm WS2812B's. Which are meant for 5v operation but their effective voltage range is conveniently similar to a lipo battery. Looking at the logic high/low voltages they should have no problem with 3.3v logic when dealing with 3.6-4.2V power. This means I can power the leds directly from the battery, effectively sidestepping any boost converters. This greatly simplifies the power circuitry, with only a 3.3v LDO needed from the microcontroller. I also added a MOSFET to switch power to the leds as the standby current is exceptionally high per led (0.5ma), saving me 8ma in sleep mode which is quite significant. I will say if you choose to power your leds like this be careful because your charger ic will be powering the leds if you don't have a battery installed. The charging isn't really affected in my case though because the leds are all off and sleeping by default.
Just as some extra features I popped on a i2c light sensor and voltage divider to read the battery. There is also a pushbutton of course for turning the watch on.
Heres a pic of the board in the 3d viewer, not my finest work since it was less then a day of design because I was very busy but im still quite happy with it overall. 4 layer board, 1.6mm with blue silkscreen. 1.6mm seems like a weird choice as it gives worse performance since all the layers are seperated but it would have cost much more to do thinner and blue soldermask. If you cant tell I really wanted to try out the blue soldermask.
So I receive the boards and assemble them. Pretty standard 0402 stuff. Time to upload the bootloader, I use STM32 cube programmer to connect to the chips over the serial wire debug interface and flash the pre compiled bootloader files. Those pre compiled files were an absolute lifesaver, not sure how I would have done without them. Not that it was easy to get them on there though, it took a couple hours to figure out how to get the stlink programmer to connect and im still not quite sure how to get it to reliably connect. But once its on you never have to deal with it again. The bootloader im using is the maple 2.0 bootloader which is an upgraded version of the original maple bootloader, this allows for use with the Arduino IDE like any other board. Ive also got to give thanks to people from the STM32duino project, really great stuff, makes it fairly straightforward to get the boards playing nice with Arduino. If I had to describe the process id say its quite hard to get over that initial flashing step. You have to get the bootloader on the chips and make sure all your drivers are right on the computer. After the initial bootloader flash the board appears as a serial port and can be programmed, after this first programming the com port changes but then it will remain the same after that. On that first usb flash you need to make sure the usb serial is enabled otherwise you lose the com port forever and need to reflash the bootloader. I also had issues with doing this flash with the generic stm32f103cbt6 board profile but these issues went away with the stm32f103cbt6 bluepill board profile. Perks of using the common chip I suppose.
Now I did run into another problem near the start after assembly, which was the usb was unresponsive. Completely. No signs of life at all. Double and triple checked all the component values and everything was right. Dug into the application notes and found that series termination resistors were unnecessary for this chip. But that didn't seem like it could be the problem, after all I had a blue pill board infront of me with them on there working like magic. I ended up swapping a chip over and it worked fine on the bluepill board. Turns out the esd diodes were messing with the usb signals, after removing them I had no further issues with the usb.
Armed with two working boards me and a friend sat down for an afternoon and coded some basic functionality. Time is set over serial monitor and when you press the button on the side it simply displays the time for 5 seconds and then goes back to sleep. Current active current is ~26ma and about 0.5ma in sleep. Could be optimised much more in software of course. Planning to add auto brightness, date, battery and flashlight functions in future, just testing the timekeeping right now. It hasn't drifted so far over the past 2 hours, though I can only tell to the minute. Overall very happy with it right now and excited to give it a wear tomorrow.
Tell us about your projects. Update us regularly.
1 post • Page 1 of 1