Overview

It's MicroPython Time!

In this project we’ll show you how to make a watch using an Adafruit Feather M0, an RTC module and an OLED display.

This uses microPython, which is an interpreted language that runs on small embedded boards.  

Be sure to check out Tony’s MicroPython playlist to learn how you can write clean and simple Python code to control hardware.  

3D Printed Watch Band

The enclosure and wristband are 3D printed in ninjaflex, so it’s both strong and comfortable to wear.

The whole circuit fits into the 3D printed case and has a nice snug fit.

The two straps are fitted into the slots on the side and can be customized to fit different sized wrists.

Prerequisite Guides

We suggest walking through the following guides to get a better understanding of the components and MircoPython. We also have great tutorials on learning how to solder.

3D Printing

Customize Watch Band

Adjust the Parameters to change the width, length and number of holes for the band.


Patterns

We can change the patterns for each band by editing the features in the timeline.

Download and 3D Print

The 3D printed parts can be downloaded with the link below. 

Parts are optimized for flexible materials, rigid material will not work.

Materials & Slice Settings

This design requires an extruder capable of printing with flexible materials such as the Flashforge Creator. If you're using standard Ninjaflex material (85A shore hardness), we recommend printing slow, around 20 to 40mm/s with the extruder temperature set to 240c.

You can also use Cheetah Ninjaflex, which has a higher shore hardness (95A). The only difference will be in how flexible and how grippy the texture is.

Dual Color Printing

You can achieve the two tone colors using a single extruder by using 2 different gcode files. We'll swap filaments in between the print jobs. You'll need to leave the print on the bed after the first job is completed and then print the second gcode file.

For printing the two wrist bands, the first process will print from 0mm to 0.8mm – you can set this up in Simplify3D by enabling the start/stop options in the Layer Modifications section, in the Advanced tab. The second process will start at layer 0.8mm and can print the rest of the part.

oled-body.stl

oled-starpA.stl

oled-starpB.stl

PLA 245c  / 0c bed

No supports

10% infill

40mm/s print speed

No Retraction

120mm/s travel speed

Multiple gcode processes are created to get a dual color print for the bands.

Print from 0mm to 0.8mm to print the first bottom color.

Then print from 0.8mm to 6mm to print the top colors of the band.

The body was printed from 0mm to 23mm when swapping colors.

Retraction clean up

Flexible materials may need retraction disabled to print successfully, so we'll need to clean any left over material around the slots and grooves on the GP-body.stl part.

 

Assemble

Headers

Add 12 and 16 female pin headers with the female side facing upwards on the Feather Proto board. This will let us plug the RTC above.

The large headers will allow more room for the JST connector and lipo battery to fit between the RTC and Proto board.

Solder Headers


Use a small amount of tac to hold the headers in place. Make sure the headers are flat against the board and then solder each pin.

We can use a Panavise to hold the boards while soldering.

RTC


Use the header pins that came with RTC. Insert the headers with the longer pins facing downwards like shown in the picture.

You can use flush diagnoal cutters to cut one of the headers to fit inside on the 12 pin side of the board.

 

OLED


Solder the short feather headers underneath the board with the female ends facing downwards like shown in the picture. 

Stacking


Once all of the headers are soldered on, we can stacking them on top of each other. 

Add a coin cell battery to the RTC board by sliding it in with the + side up and at an angle.

Fitting Lipo Battery 

There is just enough room to insert the lipo battery between the Feather Proto and the RTC board. Carefully coil the wires so they fit between the boards.

Watch case

 

Align the stack of boards with the port holes on the 3d printed case. Slip the board stack inside the case and attach the watch bands.

The end stoppers on the bands fit inside the slots on each side of the case.   

Wear!

Putting the watch on with one hand can be tricky if you don't clean off the retraction left behind after 3d printing the case. Use a flush diagonal cutter to clean the adjustment holes and buckle tongue.

If the watch doesn't fit, you'll only need to adjust the watch bands by editing the length parameters available in the source files.

Code - Micropython

The board shows up as a mass storage device when you connect it over USB. So we can write and modify our code without having to use a compiler.

Loading Firmware

Read Tony D's guide on how to use MicroPython with boards like the Feather M0

https://learn.adafruit.com/micropython-for-samd21/load-firmware

You'll also need the drivers for the RTC and OLED, download from the links below:

You can copy and paste the code below into the main.py file


To edit code, use your favorite text editor or our custom version of MU below:

Download: file
import busio
from board import *
import ssd1306
import urtc
import time

# With statement uses I2C interface as context manager for automatic init/deinit.
with busio.I2C(SCL, SDA) as i2c:
    rtc = urtc.PCF8523(i2c)
    oled = ssd1306.SSD1306_I2C(128, 32, i2c)

    #### WHEN RUNNING AT FIRST, UNCOMMENT TO SET TIME! ####
    #datetime = urtc.datetime_tuple(year=2016, month=11, day=12, hour=09, minute=40, second=50)
    #rtc.datetime(datetime)


    while True:
        datetime = rtc.datetime()
        print(datetime)
        oled.fill(0)

        hour = datetime.hour
        ampm = "AM"
        if (hour > 12):
          hour = hour - 12
          if (hour == 0):
              hour = 12
          ampm = "PM"
        oled.text(("%d:%02d:%02d "+ampm) % (hour, datetime.minute, datetime.second), 30, 0)
        oled.text("%d/%d/%d" % (datetime.month, datetime.day, datetime.year), 30, 8)
        oled.text('MicroPython Time', 0, 24)
        oled.show()

        time.sleep(1)
This guide was first published on Nov 23, 2016. It was last updated on Nov 23, 2016.