Final Project, final push.

Alright so it's the last few days before the project presentation and here's a checklist of what I have ready and what I need to get done:

 

Status of Board as of Friday!

Screenshot%202018-12-13%2019.04.17

 

 

Producing the circuit board

Here is a quick showcase of the steps taken to produce the final circuit board:

20181214_111918

Here is the Gerber file loaded onto the Bantam software for cutting on the Othermill.

20181214_113923

Here is the top traces cut out

20181214_114634

and then the holes drilled out. You can see that there is a small portion where the mill did not completely cut through, this needs to be corrected later

20181214_120756

and finally the reverse side cut.

Soldering on the LEDs

The LEDs that I'm using APA102-2020 have Tiny footprints. So based on previous iterations, I decided to carefully try making a stencil using the vinyl cutter.

Vinyl

and then carefully placed the stencil on the top surface of the board and applied solder paste to get the follwoing result:

Vinyl_solder_paste

SolderPaste

 

Step Response Code

Basically it's saving two 16-bit values up and down that correspond to when the MCU sets the Tx line high and low respectively.

Dual sensors

Ideally I would like to have two touch sensors - one on the left and one on the right of the watch dial. However, as I'm designing the watch face, I'm quickly running out of space and pads. So what I want to try is to use a single Rx line and two Tx lines - one for either side. Then, in code I can turn on the transmit lines sequentially and then sample the Rx lines. Hopefully, this works...

Here is the main part of the Tx-Rx example code form the class website:

Issues encountered while manufacturing the electronics

Continuous testing to catch problems earlier and establish minimal functionality

Here is a picture of what the board looks like with just the rivets and LEDs. It wasn't very clear to me when I did this but turns out some of the rivets didn't really make very good connections. Luckily in the workflow I had planned, I wanted to test connectivity at this stage before proceeding with populating all the other components.

20181214_152658

20181214_184404

Doing so revealed that some of these connections couldn't be salvaged just by using solder to bridge gaps but required more serious intervention...

It kinda broke my heart that I had to have these jumper wires to salvage the situation but with the time crunch I had no choice. A saving grace is that my intended plan for the watch face involved frosting the outer circumference of the acrylic layer so as to diffuse and soften the LED glow, which should, in theory cover up the jumper wire on the front face.

 

Design detail of the ATMega328P

Here are some details about the pin connections for the main board

Pin connections

"LED clock" = PB0

"LED data" = PB1

"Blue LED" = PD7

"toBLE"= PD6

"frmBLE"=PD5

"Switch"=PB2

"SensorRx"=PC1

 

 

Test code

Here is the sample code I used to test the LEDs. "Test" here refers to testing the minimal functionality of the LEDs - do they all turn on. Turns out soldering these tiny LEDs with the reflow method takes some practice... I seem to almost always get it right the second time around.

By the time we had to end for the day I had this going -

light

 

img

Not bad eh?

Looks a lot like the Arc reactor from the Iron Man franchise.

 

 

Some notes on Physical space

  
Total depth available after installing Acrylic cover8.12 mm
Thickness of PCB board1.84 mm
Thickness of board with components4.4 mm
  

If I want to fit another PCB in the battery case it needs to be crescent shpaed between 24.55 mm and 33.05 mm diameters.

Timers and Interrupts

Alright, now after all the battle scars that my board has endured (including a microcontroller replacement...) it is time to tell time.

ATMega328P has 16 bit timer/counters so the maximum value that these can count to are (subtract one cause they all count from 0).

Since I have a 20 MHz Crystal hooked up to the board and I have the system clock set to run based on the external clock, that's going to count at 20MHz... which is very fast if you want to count to 1 second. So we want to use a prescaler and count at say of the system frequency. This prescaler is set in the TCCR1B Timer/Counter 1 Control Register B.

So that will mean the count frequency can at the slowest be 20MHz/256 =78.125 kHz. This implies that the time for each tick is s s.

Also since the counting frequency is 78125 kHz we need to count up to 78125 for a 1 second interval. Since that won't be possible with our 16 bit register. So we need to split this up to say of a second. In of a second, at a frequency of 78.125 kHz, we have 15,625 ticks. Since all our counters count from 0, that means we will count till 15,624. This value is now possible in our 16 bit register.

So once the counter reaches this value we need to throw an interrupt.

The follwoing bit of code does that, and some more. Bascially the ISR bit of the code handles the interrupt. (ISR = interrupt service routine).

 

Now to the above code I add some functions that allow it to turn on the LEDs at the appropriate location:

 

Scope time

So after all the timer interrupts were setup the LEDs weren't happy. They seemed to be blinking randomly in a variety of colors and brightness, suggesting that somehow the timing was off. So the next step was to probe the signals using a scope.

0xE5 = 0b11100101

20181217_173743

 

 

20181217_173748

 

As you can see in the above picture, we have 4 bytes of 0, which is the start frame, then we have 4 data bytes that are:

So data to the first LED seemed fine, as I continued scrolling through the other frames I found that not all the "second batch" of signals had started before the first batch could complete!

So I added tiny delays to my functions that made them look like this:

With these additions, the watch could happily tell time and respond to a touch input!

Horray.

 

Note on Project scope and time management

I started out with a grand notion to create an affordable DIY smartwatch that could cost ~ $15. However, I'm running out of time now. So while my watch started out very smart, it progressively dropped in IQ and right now it had decided to be a watch. A customizable watch no doubt, but still, a watch.

 

 

Final Integration

It is now time to put everything together...

Voltage, power and current.

During testing iterations I discovered that the LEDs don't behave very well with 3V (which was what the CR2412s flat button cells provide). So I decided to make a regulator board and stack two 3V cells, and use the 5V regulator to bring down the voltage to 5V where everything was happy!

 

reg_board

reg_board_inserted

reg_board_soldered

Attaching straps to the watch body

Since I was super protective, and didn't want the the EDM machine to make line cuts in order to access the points to make holes for the straps to fixture onto the watch casing, I had to do so manually using a drill. So I very carefully fixtured the casing and then did this...

side_holes

 

Finally putting it all together

FinalPic

Integration

 

Acknowledgements

Many thanks to my sections mates for all the wisdom and support, and a special shout out to Zach and Ben for all the troubleshooting and sharing of knowledge. Learnt so much this sem.