TapClock for WatchX


#1

Hi,
you will find TapClock at Github => https://github.com/venice1200/TapClock/tree/master/TapClock

Actual Version is v0.8.4 (fixes some Bugs in v0.8.2)
New: Battery check and Alarms, MPU Icon.
See also Readme file inside sketch folder.
Direct Link: https://github.com/venice1200/TapClock/tree/master/TapClock/TapClock_v0.8.4
Binary: https://github.com/venice1200/TapClock/releases/download/v0.8.4/TapClock_v0.8.4.hex
I added an txt file to Github which explains the states a bit more.
See: https://github.com/venice1200/TapClock/blob/master/TapClock/TapClock_v0.8.4/TapClock_v0.8.4_States.txt

v0.8.2 (fixes some Bugs in v0.8.0)
New: RTC Alarm System used.
See thread entry below and the New Dokumentation TapClock_v0.8.2_ReadMe.txt file inside the sketch folder.

——————————————

The documentation below is for all Versions before v0.8.x
v0.6.4, using EEPROM System for storing Setup Parameter
See thread entry below.

v0.6.3, added third Watchface BlockClock
Needs the new font “Clock5x7”

v0.6.1, added WakeUp Modes.
1: MPU based Wakeup (TapClock Mode)
2: Lower Right Button based Wakeup (WordClock Mode)

v0.6.0 with 2 Watchfaces (Standard & WordClock) and Gestures for the Setup Menu (see Setup Menu below)
Changed Menu Values (Watchface) are not stored in EEPROM.
After a reboot these setting are back to normal.

v0.5.7 with Time Menu and Stats Page.
Runtime: 22-23 hrs

Definitions: ULB = Upper Left Button (USB Side), URB/LRB = Upper/Lower Right Button

Libraries

  • I2CDEVLIB including an MPU6050 library, search for “jrowberg/i2cdevlib” at Github
    • You need I2Cdev and MPU6050 from the Arduino folder
    • You need to remove the original MPU library as they share the same filename(s)
  • Bounce 2, debouncing Buttons, search for “thomasfredericks/Bounce2” at Github
  • SSD1306Ascii, OLED library, search for “greiman/SSD1306Ascii” at Github
  • PinChange Interrupt library, search for “NicoHood” at GitHub (up from v0.6.0)
  • Need modded “System5x7” font for Battery Symbols, see TapClock Thread (up from v0.6.0)

Upload

  • If TapClock runs you can upload code to the MCU only if the clock is awaken, so shake it :slight_smile:

Hints

  • The Sketch needs MPU calibrating values which you can create with the WatchX_IMU_Zero_0x69.ino sketch avalible at my Github Repo.

Usage
If WatchX is connected to USB Power the System will never go to sleep if it’s awaken.
You can wait until the display is powerred off and then connect USB Power for charging without “display on”.
Charging is shown through an glowing right side Led.
If WatchX is on Battery, the system waits for 5 secs (const long clocktime = 5000;) then send the MCU into “SLEEP_MODE_PWR_DOWN”.
The Interrupt from the MPU is configurred for waking the MCU on shaking or tapping.
The motion values for shaking or tapping are actually fixed in sketch.
Search Setup for:

//Modify the following for your needs
mpu.setMotionDetectionThreshold(80); //80 
mpu.setMotionDetectionDuration(4); //4

To get proper Angle values from the MPU you need to calibrate your MPU.
Search Setup for the below section and replace my values with your own calibration values:

// Offsets got from IMU_Zero Sketch
mpu.setXAccelOffset(106);
mpu.setYAccelOffset(-397);
mpu.setZAccelOffset(1255);
mpu.setXGyroOffset(68);
mpu.setYGyroOffset(-9);
mpu.setZGyroOffset(29);

To show the time the system needs to be woken up.
After this the clock must be moved to two positions configured in the sketch to show the time (maybe i have to changed this).
Search for:

// Clockpos/Waitpos
const float xclockposmin = 15;
const float xclockposmax = 90;
const float yclockposmin = -30;
const float yclockposmax = 30;
const float zclockposmin = 15;
const float zclockposmax = 90;
const float xwaitposmin = -90;
const float xwaitposmax = -20;
const float ywaitposmin = -30;
const float ywaitposmax = 30;
const float zwaitposmin = 20;
const float zwaitposmax = 90;

How to get the time shown:
See: https://i.imgur.com/MT4GaJv.mp4

  1. Wake up the system by shaking watch, the left LED is powerred on
  2. Rotate watch in that way that clockface can’t be seen, the left LED blinks
  3. Rotate watch in that way that clockface can be seen, left LED is going off

Now the time should be shown.
If you don’t do this within the clocktime the system goes back to sleep.

The Stats Menu can be used to show the needed angle values.

Setup Menu (Time Menu)

  • If Clock is shown ULB opens the Menu for setting the time.
  • URB and LRB Button move the “>” Cursor Up and Down (Rotating Cursor)
  • Pick a value to modify with ULB, the Menu Entry will be inverted and values can be changed with URB/LRB, confirm with ULB
  • Select Exit or Save and confirm with ULB to Save the time values to the RTC or Exit without saving

Setup Menu Starting with v0.6.0

  • Rotating WatchX forwards or backwards moves the Cursor up and down or modify the values (Gestures) see https://i.imgur.com/vI5ss3R.mp4
  • Choose Watchface: 1=TapClock Watchface, 2=WordClock’s Watchface
  • Adjustable Clocktime in 1/10secs = Time until WatchX goes to sleep

Stats Page

  • If Clock is shown URB opens the Stats Window showing…
    • Uptime after Reset/Restart in hrs:min (if RTC time is set correctly)
    • Wakes and Shows to show how often the clock is woken up with/without showing time
    • Angle values (+/-90°) calculated from Accelerometer (see sketch for details), calibration (!!) needed for correct values
    • Exit with ULB

Compiling

  • Sketch: v0.5.7: 73%, v0.6.0: 84%, v0.6.3: 93%
  • Global Variables: v0.5.7: 30%, v0.6.0: 42%, v0.6.3: 45%

See also the Readme on Github.

Cover
The cover is Transparent PLA Painted with Tamiya Color Spray.
Inspired by the Odroid-Go community on Reddit.

Credits
A WatchX Clock Sketch based on WatchX Hardware and:

  • WatchX libs provided by ArgeX, especially the MPU6050 lib and Demo Code from Korneliusz Jarzebski
  • OLED Library SSD1306Ascii by Greiman
  • i2cdevlib/mpu6050 by jrowberg
  • BasicWatch v1 from kghunt
  • WatchX by Hackeitos
  • Interrupt and Power Save Mode Information by Nick Gammon
  • PinChange Interrupt library by NicoHood
  • Arduino 1.8.5
  • The WatchX Reddit Community

Cheers

P.S.Still working on Dokumentation
P.S.S Sorry can’t add more Pictures or Links to this Post.


#2

I loved the breathing effect while charging:) however I am having trouble to see the watch. I calibrated the watchX but still having difficulty :slight_smile: My stats show 33 wakes and 6 views. Maybe my calibration routine is not right. I uploaded the calibration sketch, put the watchX stand still and it calibrated.

Am I doing something wrong?

Keeping the watchX awake while USB connected is very clever. We need to import this feature to basic watch as well.


#3

Hi,
you need to copy the calibration values out of the serial window of the calibration sketch
into the TapClock sketch and replace my values with yours as each MPU is different.

See the screenshot here which values are needed: https://i.imgur.com/FOmkXfg.png
You have to choose one of the calibration values for each section.

Replace the values for:

// Offsets got from IMU_Zero Sketch
  mpu.setXAccelOffset(106);
  mpu.setYAccelOffset(-397);
  mpu.setZAccelOffset(1255);
  mpu.setXGyroOffset(68);
  mpu.setYGyroOffset(-9);
  mpu.setZGyroOffset(29);

After you have replaced my calibration values in the sketch and uploaded it the Stats Screen
show nearly 0 at each axe if the WatchX lies on a flat and horizontal surface.
See https://i.imgur.com/mNhEpCd.jpg

See the sketch header as there are some more infos
like heating up the MPU for 10 Minutes before you run the calibrating sketch
and use a flat and horizontal surface for calibration.

Cheers


#4

Ohh, it’s clear now:) I will try as you suggested and report back:)


#5

Uploaded TapClock v0.6.0 to Github

I added WordClock’s Watchface which you can choose from the Setup Menu.
Watchface Value: 1=TapClock Watchface, 2=WordClock Watchface.
Added Gestures for the Setup Menu (Move Cursor/Change Values)
The Timer for the Sleepmode (Clocktime) is also adjustable in 1/10sec steps from the setup.

First Post updated (linked Wakeup Video/Gestures/Watchface)


#6

TapClock v0.6.1 is availbale at Github

New:
Change Wakeup Mode
1: MPU Wakeup (TapClock Mode)
2: Right Lower Button Wakeup (WordClock Mode)

First Post Updated


#7

Can’t wait to test it out:)


#8

v0.6.3 is out
Added a third Watchface BlockClock based on the new font.
See Font for Greiman Library (with Battery Symbols) for details.

I am now at 93% storage.

First Post updated.


#9

TapClock 0.6.4 is out (Happy new Year Edition)
Changes:

  • Include “Clock5x7.h” Font file through the sketch or library System instead of modifying the SSD1306ASCii library.
    See HowTo here Font for Greiman Library (with Battery Symbols)
  • EEPROM reading and writing of Setup Parameter
    If the EEPROM System was never used it will preset’ed during Setup()
    EEPROM stores Clocktime (40), Watchface (1), Wakeup Mode (1) and (NEW!) Contrast (20), defaults in brackets
    Only changed Setup Values are stored to EEPROM
  • Faster changing of Setup Values by holding the buttons pressed for more than 1500ms
  • Reset Uptime and Counter in “Stats” with URB
  • Re-Write Setup Menu Rotation
  • Some cosmetics

See also notes inside the sketch

First Post updated

Happy New Year!


#10

I have been using the Tap Clock since the previous update. I am so happy with the watch face 3. First couple of days I have used it with shake wake up(wakeup mode 1) battery drained a little fast so I switched to wakeup mode 2 which is waking it up with button press. I have a better battery duration. Can’t wait to test new release:)

Happy new year!! :tada::tada::confetti_ball:


#11

I know, the MPU needs around 50% of the the total battery usage.
I had tried your BLE Power reducing tips but nothing really helps.


#12

I did wonder if waking every X Millis then checking the watch orientation could somehow be employed to implement a bring to wake functionality.


#13

Thats more or less what TapClock with MPU WakeUp does.
The MPU Interrupt wakes up the system and the sketch checks two different watch positions before the display is powerd on.
You only need to replace the MPU WakeUp with an timer wakeup.


#14

Hi there, this is my favorite firmware right now! I have finally printed a decent case so I can wear the watchx on a regular basis. I have also deactivated mpu like mtulu has, in order to have more runtime.

I would like to play a bit more with the mpu however, as I wasn’t able to get the calibration sketch up and running as of yet. I flashed the sketch from your repo, it compiled and flashed fine, but then the watchx seems dead. I get no output on the serial monitor at all :frowning:
First I thought, maybe I was too impatient and just let it sit for about 15 minutes after reuploading the sketch, but still nothing was sent over serial. there are also no leds lighting apart from the short breathing when the hardware is reset via button press. Is there anything I need to be aware of that needs to be configured in the sketch? should I simply wait longer?


#15

The calibration sketch uses the serial at 9600 baud, make sure your terminal is correctly set.
The sketch is waiting for the serial connection before it proceeds, double check your available interfaces after start of the sketch as well.

If the connection is Ok you should see immediatly an
Initializing I2C devices… in the terminal window.


#16

hmm the baud rate default was 9600 so I think that is not the problem. I will try again and fiddle a bit more with the serial monitor. maybe it’s a stupid thing I was missing. Haven’t done a lot of arduino development, so I am not familiar with the built in serial monitor yet. good to know, that the sketch is waiting for a connection. thanks!


#17

I uploaded v0.8.0 of TapClock to Github.

A lot changes and fixes done since 0.6.4 :slight_smile:

  • RTC Interrupt based Alarm Wakeup
  • Only one WatchFace possible because of low RAM, but other Watchfaces can be chosen from sketch
  • All needed files are in the sketch folder
  • Version v0.2 Clock5x7.h font file
  • No need to modify the OLED library
  • See Sketch Dokumentation

The New Dokumention is the TapClock_v0.8.0_ReadMe.txt file inside the Sketch folder.

First Post Updated.


#18

Well done! Thanks for the updates. I think we need a future that all other watch firmwares should benefit. Which is Low Battery Warning. Most of the time I check the battery level but end up forgot to charge it. I realised how important is a low battery warning:)


#19

I uploaded v0.8.2 of TapClock to Github.

Some changes done

  • MPU Wakeup fixed
  • Button Wakeup permanent active
  • Some Setup changes
  • Setup: Wakeup Mode replaced with MPU Enabled
  • Alarm Mode 6 (Multi Weekday Alarm, see Sketch Readme)

I am now at 93% Memory with BlockClock Watchface so I can’t add nothing big.

First Post updated.


#20

If you have an idea how to check the battery if the system is on sleep let me know.
Maybe it’s enough if battery check is done on every wakeup.