Espruino on your watch!

Posted on
Page
of 10
/ 10
Last Next
  • I got distracted today... There are these 'smart' watches on eBay right now called iDO / DO 003. If you look on eBay for 'fitness watch' and then find ones that look similar, you'll see you can get them for under £10 in the UK, including postage.

    They're wireless, with the same nRF51822 chip in as the micro:bit (which I now have Espruino running on) - which got me thinking....


    1 Attachment

    • P1060665.JPG
  • Hmm. forum upload troubles...


    1 Attachment

    • P1060668.JPG
  • opened...


    1 Attachment

    • P1060670.JPG
  • The battery is soldered on :)


    1 Attachment

    • P1060681.JPG
  • 3 wires for SWD


    1 Attachment

    • P1060684.JPG
  • And you have Espruno on it - it took a while to get the OLED going, but it does say hello ESPRUINO in this picture, although I didn't focus properly :)

    The watch itself new appears as a BLE UART device, and you can program it through the Web IDE (at least on Chromebook or Android phones).


    1 Attachment

    • P1060690.JPG
  • Rough info so far:

    CPU: https://infocenter.nordicsemi.com/topic/­com.nordic.infocenter.pdf.ps/nRF51822_PS­_v3.1.pdf
    Accelerometer: http://kionixfs.kionix.com/cn/datasheet/­KX022-1020%20Specifications%20Rev4.0%20c­n.pdf
    0.49" OLED - SSD1306 - http://www.buydisplay.com/download/manua­l/ER-OLED0.49-1_Series_Datasheet.pdf (but not that pinout)

    Name Pins Notes
    RX pad P0.17 ?
    TX pad P0.18
    CLK pad SWDIO
    DIA pad SWDCLK
    32k osc? P0.26, P0-27 Not fitted
    Vibrate P0.07 via some FET/transistor
    Button P0.04 Needs input_pullup
    Accelerometer P0.10-16? Kionix kx022-1020
    P0.16 clk
    P0.15 short pulses? irq?
    P0.14 data
    OLED SSD1306 64x32
    P0.29 MOSI
    P0.30 SCK
    P0.0 DC
    P0.1 RST
    P0.2 CS

    Test code - there's very little program space at the moment:

    var BTN = D4; pinMode(BTN,"input_pullup");
    
    var initCmds = new Uint8Array([ 
      0xAe,
      0xD5, 
      0x80, 
      0xA8, 31,
      0xD3,0x0,
      0x40,
      0x8D, 0x14, 
      0x20,0x0, 
      0xA1,
      0xC8,
      0xDA, 0x12,
      0x81, 0xCF,
      0xD9, 0xF1,
      0xDb, 0x40,
      0xA4,
      0xA6,
      0xAf 
    ]);
    var flipCmds = [
         0x21,
         0, 63,
         0x22,
         0, 7];
    
    
    var dc = D0;
    var rst = D1;
    var cs = D2;
    
    var g = Graphics.createArrayBuffer(63,31,1,{vert­ical_byte : true});
    
    var spi = new SPI();
    spi.setup({mosi: 29 /* D1 */, sck:30 /* D0 */});
    
    digitalPulse(rst,0,10);
    setTimeout(function() {
      digitalWrite(cs,0);
      digitalWrite(dc,0); // command
      spi.write(initCmds);
      digitalWrite(dc,1); // data
      digitalWrite(cs,10);
    }, 50);
    
    g.flip = function() { 
    cs.reset();dc.reset();
    spi.write([0x21,0,127,0x22,0,7]);
    for (var i=0;i<4;i++) {
      spi.write(0xb0+i,0x00,0x12);
      dc.set();
      spi.write(Uint8Array(this.buffer,64*i,64­));
      dc.reset();
    }cs.set();
    };
    
    //function cmd(c){cs.reset();dc.reset();spi.write(c­);cs.set();}
    //function dispoff(){cmd(0xae);}
    //function dispon(){cmd(0xaf);}
    
     g.drawString("Hello",0,0);
     g.drawString("ESPRUINO",10,10);
     g.flip();
    
  • My attempts at tracing the PCB. Still don't know exactly where the accelerometer connects, but at least I have some ideas based on poking around on the 'live' watch.

    edit: right-click, open image in new tab :)


    1 Attachment

    • do-003.jpg
  • It was programmed using OpenOCD - I messed up though and didn't manage to save the contents of the existing firmware!

    Next steps, when I get time:

    • Move the OLED driver into C code, save some Flash by removing the arraybuffer graphics
    • Figure out how to use the over the air updates - I can't keep dismantling it every time I need to update the firmware :)
    • Turn it back into a watch!
    • Work out how the accelerometer is connected
  • If you want some kind of wireless sensor then you could do a lot worse than this...

    • Rechargeable, with proper charger
    • Bluetooth Low Energy
    • Vibrate
    • Screen
    • Button
    • Accelerometer
    • 2x pads on the back that are just general purpose IO
    • 2x pads on one side that are general purpose IO too (probably meant for a 32k crystal)
  • This looks amazing. Will be following progress!

  • Latest firmware, kind of watch-like:

    var initCmds = new Uint8Array([ 
    0xAe,0xD5, 0x80, 0xA8, 31,0xD3,0x0,
    0x40,0x8D,0x14,0x20,0x01, 0xA1,
    0xC8,0xDA,0x12,0x81,0xCF,
    0xD9,0xF1,0xDb,0x40,0xA4,
    0xA6,0xAf ]);
    
    var dc = D0;
    var cs = D2;
    
    var g = Graphics.createArrayBuffer(63,15,1,{vert­ical_byte : true});
    
    var spi = new SPI();
    spi.setup({mosi: 29 /* D1 */, sck:30 /* D0 */});
    
    digitalPulse(D1,0,10);//rst
    cs.reset();dc.reset();spi.write(initCmds­);delete initCmds;cs.set();
    
    g.flip = function() { cs.reset();dc.reset();spi.write([0x21,0,­127,0x22,0,7]);for (var i=0;i<4;i++) {spi.write(0xb0+i,0x00,0x12);dc.set();sp­i.write(Uint8Array(this.buffer,64*i,64))­;dc.reset();}cs.set();};
    
    var n=0;
    
    function onSec() {
    var d=new Date();g.clear();g.drawString(d.getHours­()+":"+d.getMinutes()+"."+d.getSeconds()­);g.flip();if (n++>10) {spi.write(0xae,cs);clearInterval();}
    }
    
    pinMode(D4,"input_pullup");
    setWatch("clearInterval();setInterval(on­Sec,1000);n=0;spi.write(0xaf,cs);",D4,{e­dge:"falling",repeat:true});
    

    Turns out 200 variables really isn't very much!

  • Hello,

    Looks very interesting! After my hacking with the Adafruit board last week I finally managed to get around to the unrelated stuff I was supposed to be working on. One ebay order later and you have managed to distract me a little bit more :-)

    What do you use with openocd to program it? I'm a bit tempted to order one of the STM32 discovery boards with STLink on it, which I think should work..it's easier to attach to that than the JLink Lite I was using previously.

  • Yes, I just used an STM32F4Discovery board. You just pull 2 jumpers off, then it's 2 wires and ground. OpenOCD seems a bit crazy though - I ended up trying to dig the relevant command-line out of Adafruit's tools.

  • nRF51822 (via micro:bit) - just as some STMs - as Espruino / Javascript enabler / platform... really cool.

  • very cool!

  • Very interested in this!

  • Does this have any feedback other than the display? E.g. a buzzer, LED or vibration?

    Edit: Read it has vibration, awesome.

  • Hello,

    Aaargh! I ordered one and it is the wrong thing!

    It looks exactly the same as the one you have - same bracelet, case and charger. However the insides are different. It looks as though it has an LCD screen with a backlight rather than OLED screen and the chip inside is marked CC2541. This could be a TI chip with an 8051 processor, assuming it isn't a clone!

    It has "xianwei" and v3 written on the PCB, along with 2015.12.17 which I guess is a surprisingly recent manufacturing date. There is also a swoosh logo on the PCB which reminds me of a certain other sports manufacturer.....

    It's really interesting to do a search on alibaba.com for "smart bracelet nrf51822". There appear to be loads of identical looking products from different manufacturers. Some claim to use nrf51822, others a dialog semiconductor part, and I guess this one has a TI part. I'm not sure what it says that there are so many different companies making identical looking but different products. Now how to find the correct one on eBay...

  • Argh, sorry about that. I'd kind of assumed that all the ones that looked like that were the same too.

    If it helps, this is the exact eBay listing that I bought mine from

  • No need to apologise - and thanks for the link. This device uses the Nordic Bluetooth service UUID and shares an app even though it doesn't have a Nordic chip in. I find it fascinating that there appear to be a few companies making identical looking devices but with different insides, yet which share the same Android app.

  • Yes - especially as the CC2541 has half the amount of RAM!

  • This is funny! I've got the version with the cpu from Dialog semiconductor: DA14580 (50k RAM).

    1. Can I determine whether they use flash or otp?
    2. I cannot recognise the acceleration chip. @Gordon I couldn't see the kx022 on your pictures?
    3. Would it be possible to port Espruino to the Dialog cpu (Cortex M0)?
  • It appears Gordon got lucky, like @ColinP I also got the LCD CC2451 variant. To add insult to injury I can't even pair it with my phone. Espruino as a wearable perhaps too good to be true xD

  • @luwar wow, 50k? Sounds like an interesting chip.

    1. It's almost certainly flash... I'm not sure anyone really uses OTP any more
    2. The accelerometer is the tiny black thing on the opposite side of the chip to the crystal. I didn't check it was the kx022 yet, but I imagine it is.
    3. I'm sure you could port Espruino to it, but it could be quite a lot of work. Generally it's not hard to get Espruino running with a serial terminal, but it'd take weeks to get it working with I2c, SPI, timers, etc, and then weeks more for Bluetooth :(

    @Ducky damn, that's bad news. Can you post up a link to the different one? It'd be good if we could figure out if there was any obvious difference from the outside.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Espruino on your watch!

Posted by Avatar for Gordon @Gordon

Actions