GitHub repository: watch
This project aims to produce a low power, C programmable smart watch with a small rechargeable battery, an ePaper display, an intuitive user interface, and a USB jack for easy reconfiguration of the system. The project was selected by a friend and I a few years ago, but after failing to get a first prototype working, we gave up. This project is now finding new life as my time and energy starts to free up, having completed my thesis last semester.
After speaking with a friend for a while, an ATMEGA32U4 was chosen as the microprocessor. This is because it contains a USB 2.0 interface inbuilt, saving on limited PCB space. A rechargeable LR2032 was chosen as the battery for it's small size and ready availability, and a SHARP 96x96 pixel Memory Display was chosen as the screen for it's low power consumption and interesting visual aesthetic.
Some thought went into the design of an interesting user interface. To reduce the number of moving parts, and create the possibility of a waterproof case, an accelerometer will be used to control the watch. Tap and double-tap will be used for selection and 'back', and roatation of the watch will change the selection.
The SoC calculation will be done using battery voltage. It has yet to be decided how to measure battery voltage. Using high value resistors in a voltage divider, it would be possible to reduce current consumption, though the accuracy of the ADC may be compromised. Using lower value resistors and a transistor would increase ADC accuracy, but also increase circuit complexity (perhaps unecessarily).
The battery charger and regulator is required to charge the battery and provide a constant voltage source for the microcontroller and all internal circuitry. An MCP73811 was chosen for it's low price, ready availability, and large body of documented use. The TC1186 was chosen for it's low dropout voltage, and the 'error' and 'shutdown' features which will help to increase safety and convenience.
The USB connector was designed according to the documentation.
The ADXL345 accelerometer was chosen for it's price and large body of documented use.
The speaker and buzzer circuit may not be included in version 1.0, though it would be nice to have some kind of feedback other than just the screen.
The RTC was chosen for it's price and large body of documentation. It is capable of producing a 1Hz square wave for reducing DC bias in the screen, as well as interrupting the uC.
Work has started on a schematic circuit design in KiCad (version 1.0 above). To finish the schematic, a few parts choices have to be finalised, various features need to be implemented, and it must be checked over by experts. Then, the board layout can be designed, and the board and parts ordered for the first prototype.
The draft for the schematic circuit (V1.2) is now complete. A few changes were made in order to simplify the circuit, and to make it work properly.
From now, the next real challenge is to create all the pad layouts. This will be a job for the weekend.
In terms of future learning, I think I am doing it on the fly. I have learned a lot about regulators and ging circuits, and power management in general. The most interesting thing I've learned is that the microcontroller can actually shut down the regulator by itself by pulling the shutdown pin on the voltage regulator low. This is a neat trick taught to me by a friend, which seems to solve a lot of the safety problems, and allows full programatic control. I've done a lot of learning about KiCad in general, but exclusively in the schematic editor. I look forward to the next step: PCB footprints.
I don't think any future testing is required. This is because the prototype itself will be the test bed for version 2.0.
A friend of mine came up with the cool idea of integrating female headers into the watch itself to allow for rapid prototyping with a microcontroller. This can be incorporated into V2.0 or later.
After finishing the first version of the schematic, I did the bulk of the footprint association yesterday. Some of the footprints had to be created, but most could be borrowed from the libraries. Care should be taken here to ensure that all of the parts will be able to be soldered by hand, rather than with a reflow oven. This is of particular concern when it comes to parts like the ATMega itself, and the FPC connector.
I also continued to add to both the RS and E14 online carts. I also created a list of parts in the KiCad folder to assist with ordering later on.
I created the footprint for the connector (FH52-10S-0.5SH), and associated it successfully with the schematic symbol. I think I'm ready to try creating the PCB.
It has come to my attention that I have not actually created a project timeline for this project. This has made is somewhat difficult to work on and visualise the next goal. I will break it down into phases, and then calculate a finish date.
After drawing that up, I now see that the PCB and case design are complementary processes. As such, I will have to work on them concurrently. First, I must choose a 3D CAD editor, I think that perhaps SolidWorks is the best option. Then I would have to design my watch case to be 3D printed, or machined. Alternatively, I could use an existing case design, which would remove the need to do any of this work myself. However, this has already been done with the Pebble case for Chronio, so perhaps I had better do something different.
Based on a forum post I just read, I have decided to learn how to use SolidWorks. I think it will be a useful skill for the future.
Next, I would be required to put completion dates to those phases. So, an attempt at that follows:
This allows for at least a little bit of overlap with more important projects, and allows extra flexiblity around exams.
I also tried to import the netlist into KiCad. It (amazingly) imported successfully first time. After moving all of the components around it looked like an absolute mess (45 components). A few issues were noted:
So, now it remains to flesh out the timeline for the hardware design phase. This is a little complicated, since it requires collaboration between two fairly complex components. I suppose if I limit the PCB design to fit within the dimensions of the case. At some point I will need to limit something. If I design the case first, then I will have to "allow" space for the PCB, which should keep it small. If it absolutely MUST be bigger, then I can begin to alter the case design. This seems like a sane approach. So, I should begin by installing SolidWorks. Let's write this down.
I also found the following forum post, which might be useful for making 3D models for KiCad.
I should note that I have not yet made certain that SolidWorks is the best choice for me. It may be that FreeCad is a better solution. After talking to a friend, I have decided to use OnShape, since it's a more modern, web based, free solution. I created an account, but now I need to work through the tutorials.
So, although the above link is no longer relevant, there are plety of alternatives for OnShape.
I started by trying to squeeze everything onto the PCB. It's going to get very tight. The battery clip seems to set the width of the board, which is currently at around 35 mm, and the height has a bit of flexibility, but perhaps could be set at 30 mm. If I wanted to, this is reduceable (I could choose a different battery clip, or I could modify the one I'm considering buying). The next job it to try to organise the passive components into groups, so that they can be placed near the parts that require them.
In terms of the things that need fixing on the board, here is a status update:
I also watched the first tutorial for Onshape, I plan to watch one per day.
I worked through tutorial 2, it was really fun. The software is very powerful and intuitive, I can't believe it's running so smoothly in browser. It's going to be a joy making this watch.
I worked through another issue with the PCB, changing the ADXL345 footprint back into LGA-14. This will be on the reflow side, and can therefore use the 'proper' pad layout.
Just finished tutorial 3, learned about mates and assemblies. Exciting! Making a working rack and pinion was also satisfying.
Today I elected to solve the PCB problem first. U3 and U5 are already on the reflow side, so that issue resolves itself. Also, the chosen 9HT10 oscillator seems to fit nicely into the footprint that I've allowed it. I'll try to make version 2's clock a little more deliberately designed. And this footprint will be fine until I can show that it isn't. Right now, it's the most convenient solution.
I suppose the next step is to try to arrange the parts sensibly on the PCB (firstly the actives, then the passives), and then try to connect everything up on 2 layers. It may be that I need a 4 layer board, but I will try my best to avoid this possibility.
The next step is to start to consider watch designs. I have a couple in my head, as soon as I've finished the tutorials for Onshape I'll try to commit them to the cloud. I will need to do some research into existing designs.
What a horrible game it is to try and organise this PCB.
Issue: ERROR is not connected to the microcontroller.
The footprints of the 0805 components on the reflow side of the board need to be adjusted to the non hand-soldered footprints. What I will do is update ALL of the 0805 footprints to the non hand-soldered type, and then adjust the ones that don't need to be at the end, as the exceptions to the rule.
I also completed the last of the official Onshape tutorials.
In terms of checking for life on the completed watch, I think an optional LED on pin 13 or similar would really help.
I was thinking about watch designs, and I think something like the following is pretty close to what I'm imagining:
This is, of course, the design for the watch case only, rather than any UI design, which is a long way down the track.
Updated the 0805 footprints. I note that the SOT22s are still in the hand-soldered version, maybe these can be changed closer to board completion.
I also briefly experimented with copper pours, which I think I will end up implementing.
So, I did a lot of circuiting today. Here is where I'm uo to:
I think the PCB is electrically complete. There is still some error checking to do though. I've listed some more items that came to mind under the "next actions" list. Also, now that the size of the PCB is quite well defined, I can think about dimensioning the watch a little more.
The FPC connectors arrived from RS, pictured below:
Now, a list of the parts that will require 3D models. By inspection of the current 3D model, and the missing parts:
Many of these models probably exist already, so it would be worth searching for them before making them. I tried to arrange them in rough order of ease of modelling, but it's more or less arbitrary.
The edge of the board looks pretty much fine for version 1. Technically, version 1.4, but who's counting? The dimensions of the board are 35.56 x 30.48 mm.
Parts references were removed from the silkscreen, to make it look a little nicer.
I modelled the oscillator in Onshape, and then exported it as an STL, which I then imported into Wings, and then exported as a WRL, which I then imported into Kicad. It appears in the 3D model now, but it has no colour. I'll leave that for another day.
Given that "The dimensions of the board are 35.56 x 30.48 mm", I might arbitrarily choose some watch dimensions. This sort of works, but sort of doesn't; I need the microUSB to stick out nicely from the side of the case. I added a microUSB to the model from an online collection.
It turns out that open source hardware is nowhere near as easy to organise as open source software. I will have to choose a license in the future.
Obviously there's a lot more to do here, but I just wanted to put down something concrete. A curved face might be nice, and the micro USB and strap bands are obviously required.
I got my PCB design checked over externally, and lots of suggestions were made:
After a little break, I've got back to it. Today I rearranged the parts to be grouped by function, I'll try to fit them together afterwards.
Spotted a potential issue: R12 is going to be draining 3.3V with a duty cycle of 50%, giving an average current draw of around 165 uA.
Items remaining from the list:
A list of parts which should be hand soldered:
A list of parts which should be reflowed:
A long break, but I'm back. Last night I finished the PCB. It's much more electrically sound that the first attempt when it comes to decoupling capcitor placement:
It still remains to add in the rest of the 3D models to check for sanity. Then it's probably time to start ordering. I should order 3 of everything, in case I break things.
I was just looking at the 3D view, and I don't think much is going to change by updating the 3D model any further. It's time to order the parts.
I've ordered most of the parts from Element14 for around $60 inclusing GST, and the rest is coming from RS for around $8. Tomorrow I'll order the PCB.
I finsihed up the PCB with a quick check of the design rules for dirtypcbs.com. Turns out that they don't like slotted holes, this because obvious when I tried to upload the file and the holes didn't appear on the render. I adjusted the PCB layout for the micro USB, but didn't reflect it in my library. That will be a job for after I check if the part fits in a hole not designed for the part. Then I ordered the PCB. Yay! The waiting game begins.
I added the GitHub link to the top of the page with the relevant gerber files and code. I also put the OSHW logo on the PCB. I also bought some solder paste for tht LGA package, which I'll need to use with the reflow oven that I still haven't made.
I spent a bit of time working on the reflow oven today. After disabling the internal thermostat, the best system to hit 230-235 Celcius for 20 seconds requires getting to around 228, switching off the power, and opening the door after another 15 seconds or so. I look forward to testing it with some solder paste. Also, I learned that not all boards were born equal when I burnt a low quality prototyping PCB at aroun 120 C.
A load of parts have arrived. In fact, I'm only waiting on the PCB, the solder paste, the coin cell, the ATmega32u4, and the crystal for the RTC. The ADXL345s arrived in a nice ESD package:
...and the FPC connectors arrived (again, I lost the first order somewhere). So it seems that I was also waiting for that.
...and the crystal has arrived. Next time, I need to remember to get these to all ship on the same day to save the hassle of all these individual parcels.
The solder paste arrived, and I had a bit of practice:
The ATmega32u4s arrived. They were in a very impressive looking moisture-proof case. Element14 continues to impress. So, now I'm just waiting for the coin cell and the PCB itself.
Still waiting on that battery and PCB. Had a nice thought though: it might be cool if the watch were made primarily of wood. I like the idea of it, at least.
The PCB arrived!
Looks like I'm never getting that battery. I'll have to source a new one locally.
I'm sourcing a Li-ion rechargeable coin cell from a local vendor, I'll name them if they can provide the correct item. For now, though, I'm off to the big city for a couple of parties. Back soon!
I unpacked some of the components and did some test fits. The main worries (the connector and the USB port) seemed to fit fine, so that's great. However, it looks like there might be a little bit of manufacturing error on the USB pads, I'll have a look under the microscope before I assemble it. Some thought will have to be put into the order in which things are soldered.
Applying the solder paste has been a real pain. Next time, I'll definitely order the stencil. I've been doing a few practice runs without the critical ADXL345, trying to get even spread and avoiding solder bridges. Generally, it seems that "less is more". A rapid jotting motion has been good for trying to spread evenly in a thin leayer.
At this point I reaslied i had a TC1185, not a TC1186. Same package, but different pins. If R8 is removed, it should function correctly.
I assmebled the rest of the board without problems. I found a mistake with the ground (I was warned!) which I fixed with an extra wire.
It got a bit tricker when I tried to burn the bootloader. The Arduino IDE could find the Atmega32u4, but it couldn't get in sync since it was running off the internal clock. When I (with great difficulty) managed to solder in an external 16 MHz clock,
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin>avrdude -p m32u4 -v -P COM 6 -C "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -c avrisp -b 19200 was able to recognise the chip! (fuses E:F3, H:99, L:5E) Now, I just need to find a way to ensure that the bootloader I install doesn't use that external clock, or include a 16 Mhz clock etc in the next version. I guess I want this one to work for the moment, so I'm going to chase the harder solution.
Time for the fuses then:
|Initial||5E||99||F3||External 8 MHz crystal, divide by 8, SPIEN, JTAGEN, BOD 2.6 V, HWDE|
|Caterina-Leonardo||FF||D8||CB||External 8 MHz crystal, BOOTRST, SPIEN, BOD 2.6 V|
|Forum post||5E||99||C3||Identical to "Initial", since the most significant byte of the extended register doesn't affect anything|
|My proposed||E2||D8||CB||Internal 8 MHz RC oscilator, 65 ms startup, BOOTRST, SPIEN, BOD 2.6 V|
I'm just a bit worried about HWDE, though now I notice that the Leonardo code doesn't include it. I edited the
boards.txt to include a microprocesor exactly the same as the Leonardo, but with a different name, and I adjusted the clock speed to 8 MHz. So, I think I'm armed and ready now. I'm going to try to burn the bootloader through the Arduino IDE and see what happens... it worked! And I verified the fuse settings externally with
avrdude. Now, curiosity cannot hold me back: I'm going to write "Hello, world!" in the form of a flashing light. It works, but the LED flashes twice as fast as it should. And then I updated the fuses as I described, and now the LED is flashing at the correct speed. But now I've done some things and it's stopped working...
After a full day of troubleshooting, here is a list of known problems with the PCB:
A list of things that work on the PCB:
Since everything that was possible to learn from this thing has been learned, I'm now prepared to risk messing with the bootloader again. I'm going to try to reflash it in an attempt to help it interface with my computer. Another problem which might be occuring is that the 56700 baud that it tries to burn the bootloader at might be too high for the internal RC oscillator. So, I'll program it at 19200 baud. Here is the command:
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin>avrdude -p m32u4 -v -P COM6 -C "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -c avrisp -b 19200 -U flash:w:.\bootloaders\Caterina-Leonardo.hex -U lock:w:0x0F:m
A last ditch effort, using code from here after reading a forum post here.
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin>avrdude -p m32u4 -v -P COM6 -C "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -c avrisp -b 19200 -U flash:w:.\bootloaders\Caterina.hex -U lock:w:0x0F:m
OK, time to give up. There's something going on which lets me program easily over SPI, but doesn't recognise the USB device. I suggest that there are two main problems remaining, and they should be solved at the same time: I'll make a test board which has the ATmega32u4 and the accelerometer on it, with a USB connection, optional clock, and perhaps some pin connections for a well known screen. Everything will be broken out nicely, lots of buttons and switches (reset in particular) and lights. This one will operate on either 3.3 V or 5 V as selected by the user with jumpers. Maybe it's worth testing a new, smaller (and perhaps cheaper) speaker. The test board can be 50 x 50 mm, which should be ample space. Looking forwrd to that stencil! Once again, I find myself doing the right things in the wrong order.
As a side note, in my travels I came across this interesting screen. It has very low current consumption, and might be useful for some future project. They still seem to be in stock across all the major outlets at the time of writing.
According to this forum post, "The USB CDC class that the Arduino bootloader uses is not compatible with USB Low Speed Mode, due to the endpoint sizes and type." Therefore, I'm going to give up on that as an option and resort to the 16 MHz clock again. I'll have to resolder it in, and then after resetting the fuses I should be able to upload code as they describe. A redesign of the PCB is therefore necessary, pending the particular results of the USB testing.
I spotted a mistake in the schematic where I had used an MCP73811 rather than an MCP73812. The programable output current is required to be able to deal with the tiny 50-100 mAh coin cell battery which could easily be overcharged by a 85 mA current (lowest setting on the MCP73811), let along the 450 mA current it had been set for in my schematic. It has been replaced by an MCP73812 with a 20k resistor tied to ground for a 50 mA charge current.
I finally downloaded a bunch of the images:
And a quick test of the watch screen:
Despite the late hour, I decided to try getting the watch project going again. After doing a bit of reading, I discovered that I had left the project at an awkward point, and would need to attach the 16 MHz clock, reset the fuses to use this clock, and then try programming over USB. To be totally honest, I don't know how I was even programming it before. Something tells me that I'm going to need to reset the fuses over SPI. Turns out the "USB device is not recognised", so I guess that's what I'm doing. Having set up the SPI connection through an Arduino acting as an ISP, it's time to start probing with
avrdude -p m32u4 -v -P COM3 -C "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -c avrisp -b 19200
Yay! It found the device:
Now, to reset the fuses to hoe they were before. Back to my favourite website. I set the bits accorind to the Leonardo-Caterina setup in the table above. Still can't access it over USB, though the Arduino IDE recognises it as an Arduino Leonardo. The clock is definitely working: when I accidentally removed one of the connectors, the flashing LED started acting up with unpredictable timings. I wish I had documented this process a bit better the first time!