Smarty the watch – it is aliveeee

Smarty the watch – it is aliveeee

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon

After a bit of struggle I was able to wake up the clock.

I was completely dead but when I removed battery I could see him with raspberry debugger and load new firmware.


First thing I have found that it is possible to program it from arduino

Roger has nice tutorial how to get arduino working, and there is tut how to get cheap USB programmer debugger

Arduino on BLE

I already had STM32F103C8T6 ARMSTM32 Minimum System Development Board from ebay so I decided to give it a try

I programmed programmer on raspberry pi programmer :)


So I have now tried but I had problems with it I could not upload sample


Debuger was installed


It all seems OK


Some suggestions was that I need to change ID in registry, but I did not do that


So I loaded Arduino sample with raspberry watch just to check if I’m on right way. And nRF accepted flash


I did not have time to test it because it was Thursday and I need to rush to my makerspace

I just surf a bit and on some picture I saw that when programming with similar debuger they do not use SWD pins that are named on board, they have used pins A4 and A5, and that was bingo. I was now able to upload sample from arduino.


But sample with arduino did not work I was not able to get blink led on P0_07 (there is vibro motor on that pin) so it should vibrate while HIGH.

I have searched how can I test if it is working and find The ARM® mbed™ IoT Device Platform so I decided to try it.


I was really easy to start programming within MBED I just selected some nordic board loaded and wrote a blink led

and that worked. Button on pin P0_04 worked to.

Next was to get OLED working. I have searched MBED libraryes and found this one

I have tested it and LCD woke up with only garbage on screen.

I have contacted author of library Nenad to help me with getting something on screen. Here is his response couse I still did not get OLED working right:

“Hello Goran, first you have to make sure, that your OLED SSD1306 controller is configured for the SPI interface. My adapted library only supports SPI, so it won’t work with OLEDs configured for I2C. Second you will want to change the LCDWIDTH and LCDHEIGHT in SFE_MicroOLED.h to your actual OLED size. If it’s a 64 x 32 one, you have to set it to that. You can also try to change LCDCOLUMNOFFSET to a different value than 32. Normally on OLEDs with SSD1306 controller and less than 128 pixels width, the actual pixels are arranged in the middle of the SSD1306 memory width. So an OLED with 64 pixels width is often mapped with an offset of 32 in the controller memory. But it could be different for your patricular OLED, so you could try an offset of 0 or any multiple of 8. Third you should adapt the init sequence in SFE_MicroOLED.cpp to your OLEDs values. What i have seen from your attached datasheet, some values are different: command(SETMULTIPLEX, 0x2F) should be 1F instead of 2F (because your hight is 32 and not 48 pixels). command(SETCOMPINS, 0x12) should be 00 or 02 instead of 12. command(SETCONTRAST, 0x8F) per your datasheet is 4F and not 8F, but i doubt this will cause problems. command(SETPRECHARGE, 0xF1) per your datasheet is 1F and not F1. I’m not sure if this is important or maybe even a typo in the datasheet. Best regards Nenad”

Datasheet of OLED is here:

After some change I was able to get Hello world on screen.


So next step to get really Smarty is to get accelerometer to work.

First I have tried with library

But did not work,I ave tried I2C scanner to check if I use wrong I2C address but that did not work to. Then I readed all pins that are connected to accelerometer:

//P0_16 SCL     — default HIGH probably pullup
//P0_15 SDO/ADR — default HIGH probably pullup
//P0_14 SDI/SDA — default HIGH probably pullup
//P0_13 Trigger — default LOW
//P0_12 INT1    — default LOW
//P0_11 INT2    — default HIGH probably pullup
//P0_10 nCS     — default HIGH probably pullup — from datasheet is this pin is high I2C is enabled so this is ok
// The  Slave  Address associated  with  the KX022 is 0011111X,
// where  the  programmable  bit,  X,  is  determined by  the  assignment  of ADDR (pin 1) to GND or IO_Vdd.
// So in this case we have adress 0011111
// 1Fh 3Fh 00111111

But nothing worked.

So I reported that to Roger, he pointed me to some I2C problems with nRF

Its possible the I2C scanner will not work, as I think it uses a bit of a trick

However I found this

which links to this

So perhaps you could try that code, even if you have to use mbed

And I have tried, and get response from Accelerometer and its adress.

It was using some wire library that is not compatible with i2c and I did not manage to easily get original KX022 library to work.

So I just tested WHO_A_I register and got response, and then I decided to write line by line in main file and I got response from accelerometer X axis in MBED.


While I was working with MBED Roger worked in fixing Arduino to accept all pins, and change pinout that suits Smarty.

He suggested that we open a chat room so others can join so I did so.


Roger created repository with Smarty pinout:

On my watch I broke pin 18 so now I use pin 17 as TX pin, you can change that in


It was easy to port some code from MBED to arduino, so now we have all working as on MBED

OLED is still not working good still has some garbage on screen, accelerometer does not have library it is all in main ino file, it does not use smart things like tap double tap flip interupts. accelerometer could wake up nRF to save battery life and so on…

I have pushed some samples on git you can check and fix within Smartwatch examples

This is some digital watch example.

Other BLE samples are working too


Back to the hand:



Join us in chat room, and on git, and thanks for reading :)

Ideas Todo:Flash old android phone (Samsung Galaxy Fame) to firmware that can do BLE — done  phone now has CM12.1 I can connect with bracelet

Adding more sensors like pulse sensor or muscle sensor

Epilepsy seizure detect

On Threat CALL or send SMS

Blind read SMS privatly

TROL other bracelets with Smarty bracelet

If bracelet is stolen and someone connect to it and install our app from store  (make some nasty stuff SEND SMS with location or something)

One Bracelet to rule them all


Roger has fixed OLED …