I think the nRF51822 is a better processor for a watch as its lower power and has BLE.
To cut a long story short I have ordered this from AliExpress http://www.aliexpress.com/item/Fashion- … 04126.html
It appears to use the nRF51822, and I’m hoping that its basically the same as the one reverse engineered on the espruino forum
http://forum.espruino.com/conversations/280747/
and also one like this http://www.aliexpress.com/item/Hot-Sale … 08352.html
So hopefully I will be able to have an Arduino smart watch
why you not buy the same espruino model ?
http://ido-smart.en.alibaba.com/product … nitor.html
In this case its 2 devices and they seem to accept paypal, so I may see if I can order them.
But shipping cost was not shown, so that may also be a big additional cost.
I get the general impression that this model of watch is being phased our as its very hard to find anywhere that will supply it. And the other ones I have ordered look like they have better physical construction
But I will contact the company on Alibaba and see how much it will cost for 2
I found IDO 003 on Amazon but the price is much more. On Aliexpres is sold out.
IDO 003 is phased out. It is not present on http://www.idoosmart.com/
The manufacturer told me that the TW64 is the same device, and that it uses the nRF51822, but I wont know for sure until mine arrives.
They told me that the same watch is also sold as a P102. I found some P102 devices on AliExpress for $12, but I can get TW64 for $8 on eBay.
But I really wont know until I actually receive one.
I am also trying to work out a better way to upload to these devices. At the moment you have to take them apart and attach SWD wires, but I want to install a OTA bootloader, and I also want to try to make a dongle using a STM32 which allows the Arduino IDE to upload via USB e.g. perhaps implement USB mass storage on the STM32 and then send this data to a nRF51 acting as the DFU transmitter ( master )
Or perhaps have the STM32 as usbcdc and it can be both upload and for Serial ( for debugging)
But I dont know how many people would be interested in having an Arduino programmable smart watch, as it would require a lot of development time, so I could not make it all open source
I wonder if the companies would be interested in your idea of OTA programming feature? It would be a way to keep them up to date.
If I wanted a smart watch to program with I’d prefer something with wi-fi, maybe gps, sms, etc. Seems it would have a lot more possibilities as far as uses. For instance be able to control devices in your home etc from your phone or receive messages from devices. I’m sure people could think of a lot more uses.
But yeah, I agree it would be a lot of work developing the idea with little return for your efforts.
I am not sure if any smartwatches have wifi, but I guess some may.
It would be more practical to build a ESP32 into a BLE to Wifi router.
I know this community is very price sensitive, hence most people seem to be interested in sub $10 watches, and I think this rules out GPS.
OTA should easily be possible, I already have an OTA bootloader ( written by RedBearLabs)
The difficulty is uploading from PC.
Anyway, I will see what arrives in the post over the following weeks and update the forum with any progress
The model numbers on these things are really confusing.
The packaging had E05-B05 written on it, on a barcode, so I googled for that and found various listings that also quoted the TW64 model code.
So I initially thought I had ordered duplicates, because of the inaccurate descriptions for these products.
However I noticed the watch I received had a heart rate monitor, but the basic TW64 does not have this feature.
Dissassembly was easy. The core of the watch can be removed from the rubber strap, and the back is held on by 4 crosshead screws.
Inside is a nRF51822QFAC (256k flash, 32k RAM), i.e this is the best nRF51822. The board also has both 16Mhz and 32kHz crystals for good timekeeping and low power operation.
On the back of the PCB are pads labelled for SWD and TX and RX …. To easy ![]()
Connecting a JLink revealed the device is read protected (no big surprise), so I had to erase it and then flash the v1.0 (SDK10) S130 softdevice, and I was then able to flash an iBeacon sketch to the watch to confirm BLE etc was working.
I then tried Serial TX and it worked fine (connected to a USB to Serial adaptor)
Goran’s test code proved the button pin and vibration pin are also working, and the acceleromter is also working fine.
OLED is almost working, it does display some text but the position is wrong and it keeps moving, which suggests some pixel addressing problem.
I have not started to investigate the heart rate sensor yet, as getting the display to work correctly is the top priority.
And I will post a write up to my blog
The watches I ordered which had the part number TW64 did contain a MCU by Dialog Semiconductors, DA14580.
This was not what I wanted, but interestingly its not the “Qunitex” device that some listings claim
The DA14580 appears to be a Cortext M0 device, but has very little flash, possibly only 32k, but loads of RAM (42k)
As I know nothing about this processor, its a bit of a dead end, but luckily I ordered some more watches which did have the nRF51822 in them.
I’m not sure what I will do with these, possibly actually use them as fitness trackers, or perhaps salvage the internals, or perhaps just use the case for some other smartwatch
One of the suggestions my girlfriend gave as a project i could make for her was a counter for a skipping rope. Reprogramming one of these would be perfect for that XD.
One of the suggestions my girlfriend gave as a project i could make for her was a counter for a skipping rope. Reprogramming one of these would be perfect for that XD.
Complies with
Bluetooth V4.2, ETSI EN 300 328 and
EN 300 440 Class 2 (Europe), FCC CFR47 Part 15
(US) and ARIB STD-T66 (Japan)
Processing power
16 MHz 32 bit ARM Cortex-M0 with SWD interface
Dedicated Link Layer Processor
AES-128 bit encryption Processor
Memories
32 kB One-Time-Programmable (OTP) memory
42 kB System SRAM
84 kB ROM
8 kB Retention SRAM
Power management
Integrated Buck/Boost DC-DC converter
P0, P1, P2 and P3 ports with 3.3 V tolerance
Easy decoupling of only 4 supply pins
Supports coin (typ. 3.0 V) and alkaline (typ. 1.5 V) battery cells
10-bit ADC for battery voltage measurement
Digital controlled oscillators
16 MHz crystal (±20 ppm max) and RC oscillator
32 kHz crystal (±50 ppm, ±500 ppm max) and
RCX oscillator
General purpose, Capture and Sleep timers
Digital interfaces
General purpose I/Os: 14 (WLCSP34 package),
24 (QFN40 package), 32 (QFN48 package)
2 UARTs with hardware flow control up to 1 MBd
SPI+™ interface
I2C bus at 100 kHz, 400 kHz
3-axes capable Quadrature Decoder
Analog interfaces
4-channel 10-bit ADC
Radio transceiver
Fully integrated 2.4 GHz CMOS transceiver
Single wire antenna: no RF matching or RX/TX switching required
Supply current at VBAT3V:
TX: 3.4 mA, RX: 3.7 mA (with ideal DC-DC)
0 dBm transmit output power
-20 dBm output power in “Near Field Mode”
-93 dBm receiver sensitivity
One of the suggestions my girlfriend gave as a project i could make for her was a counter for a skipping rope. Reprogramming one of these would be perfect for that XD.
ID100 should be OK. I have an ID100HR working. I have also been trying to get the power consumption right down.
At the moment, the display seems to be taking some current even when the DISPLAY_OFF command has been send, and it not lit; yet after I reset the watch and dont run the display init() the display takes no power at all.
I briefly looked at turning off the charge pump, but its not clear in the docs how to do this, and sending 0x00 makes no difference.
I could just physically reset the display with the RST line, and init() it each time I need to turn it on, but this seems wasteful, and I’m sure there must be a better way.
It uses a standard OLED controller, so someone must have come across this and have a solution
BTW. Goran has setup a gitter room for chat about this
https://gitter.im/nRF51822-Arduino-Mbed … atch/Lobby
They actually seem like little modules you can have a lot of fun with
I did speak directly to the manufacturer via Alibaba messages, but they are really only interested in massive orders.
What would be a game great with these, is if they had more connection pads at the back. At the moment the ID100 has 3 pads (5V, GND, 5V) for charging (so you can put the connector on either way and not fry it !)
e.g. replace one of the 5V with SWCLK and add the SWDIO.
But I don’t think there is any chance they would consider this, as joe public would probably blow up the watch by messing around with the additional pins.
I’m going to make a Yourtube video showing the ID100HR and ID107HR, so I’ll post again to the forum when its uploaded.
Its still processing at the moment but should be ready in around 5 mins !
i’ve got small heads, but not that small, so the next mission is to find a screwdriver for it >_<.
I hope it won’t cost more than the watch :p
I bought a small screwdriver with interchangeable heads for around $4 (USD) from a local supplier.
Its remarkably good.
BTW.
Before you reflash it, there may be a way to read the existing firmware even if its locked.
Its an open secret, that I only found out a few days ago, that the “Protect All” system for read protecting the Flash and RAM has a simple exploit, which allows the Flash or RAM to be read out.
So.. Before you erase, it may be worth attempting to back up firmware.
BTW. I had already erased by watch ages ago, but managed to backup an IBeacon as a proof concept, but I know other people have issues backing up. So it looks like the loophole may not be foolproof.
Although this exploit is an open secret, as it has been even mentioned on the Nordic developer forum, I generally refrain from posting the exact details, so PM me if you want more information.
i’ve got small heads, but not that small, so the next mission is to find a screwdriver for it >_<.
I hope it won’t cost more than the watch :p
i’ve got small heads, but not that small, so the next mission is to find a screwdriver for it >_<.
I hope it won’t cost more than the watch :p
And one of my ID100’s arrived, but i think it’s broken >_<. The watch only responds to the button when it’s connected to the charger (and it then shows the battery is full), and once i disconnect it from the charger, the button does nothing >_<. And i’ve tried to make bluetooth connection with the watch, but that also fails, i can’t even see it in the available devices on my phone…
And one of my ID100’s arrived, but i think it’s broken >_<. The watch only responds to the button when it’s connected to the charger (and it then shows the battery is full), and once i disconnect it from the charger, the button does nothing >_<. And i’ve tried to make bluetooth connection with the watch, but that also fails, i can’t even see it in the available devices on my phone…
I think the ID107 was compatible with the manufacturer’s app called VeriFit (https://play.google.com/store/apps/deta … yfit.multi )
I think its written on the box, but each watch seems to be different.
I think the app asks for some permissions that I wasnt that happy about, e.g. access to contacts, but I’m running a jail-broken android phone running a non-standard ROM, and I’m using the XPosed framework, so I can block individual apps doing things like accessing contacts etc, so it wasnt a big issue for me.
What phone do you have? Minimum iOS phone is the 4S when apple added BLE. I can’t recall when it was added to Android, definitely a few years ago as my Android phone is at least 2 year old and was a fairly base model when I bought it
I think the ID107 was compatible with the manufacturer’s app called VeriFit (https://play.google.com/store/apps/deta … yfit.multi )
I think its written on the box, but each watch seems to be different.
I think the app asks for some permissions that I wasnt that happy about, e.g. access to contacts, but I’m running a jail-broken android phone running a non-standard ROM, and I’m using the XPosed framework, so I can block individual apps doing things like accessing contacts etc, so it wasnt a big issue for me.
What phone do you have? Minimum iOS phone is the 4S when apple added BLE. I can’t recall when it was added to Android, definitely a few years ago as my Android phone is at least 2 year old and was a fairly base model when I bought it
Okay, have 3 smartwatches to play with now, let the weekend begin XD.
btw, has anyone tried other smartwatches with the nrf51822 yet? I believe this one also is nrf51822 based i think, and it’s cheap, has a big screen, and that nice usb plug coming out of it (even though it probably only is for power). Maybe also an interesting candidate to hack?
They seem to mainly come from one manufacturer in China, but the same manufacturer used to make the same watches with other MCUs. Which makes things even more complicated.
I have 4 watches, but I found only 2 have nRF51’s in them.
With the watch you linked to, I recall reading about it, and the USB connector was only for charging, which is a shame, as it may be possible to run VUSB on the nRF51 ( though I dont think anyone has actually done it)
I was thinking about buying one like that which has a landscape orientation screen, as the screen is physically bigger ( wider ) so I think it has double the number of pixels of the others.
But I dont think I will risk ordering from that page, I will find one ( albeit a few dollars more expensive) which lists the watch as containing the nRF51
Before you reflash it, there may be a way to read the existing firmware even if its locked.
Its an open secret, that I only found out a few days ago, that the “Protect All” system for read protecting the Flash and RAM has a simple exploit, which allows the Flash or RAM to be read out.
So.. Before you erase, it may be worth attempting to back up firmware.
BTW. I had already erased by watch ages ago, but managed to backup an IBeacon as a proof concept, but I know other people have issues backing up. So it looks like the loophole may not be foolproof.
Although this exploit is an open secret, as it has been even mentioned on the Nordic developer forum, I generally refrain from posting the exact details, so PM me if you want more information.
But i haven’t seen much result yet. I’ve been able to flash the S130 core from nordic via gdb and black magic probe, so that should be okay.
When powering the watch, i see a dfu device get enumerated over bluetooth, so at least something is running on there XD
But then uploading the smartwatch samples from your repo, doesn’t do anything.
I also did a simple test in setting all ports to output & high or low, hoping to at least trigger the vibration motor of the watch, but that didn’t do anything either -_-.
Now it’s enough for today
. Any tips on where to continue from here roger?
First useful thing might be to see if the serial works, and if i get any info from there. But i’m not sure how to hook it up when using the black magic probe. I’ve got rx & tx pads on the smartwatch, where do i connect them to, in order to be able to see the serial communication coming from the smartwatch.
Another confusing thing is that you’ve got 2 nrf51822 arduino repos. I’m using the latest one : https://github.com/rogerclarkmelbourne/Arduino_nrf51822
(btw, it has a bug that the path to the linker files is wrong if you choose generic nrf51822 board. it still uses the path as it is with the original files by RBL)
I hope that’s the right one?
this is the other one: https://github.com/rogerclarkmelbourne/nRF51822-Arduino
This is because those examples contain some function from mbed, and the old repo is a modified version of RedBearLabs repo, which its self is derived from mbed.
The second link is my fork of Sandeep Mistry’s Arduino-nRF5 repo, which is a newer and better implemtation of an Arduino core for nRF51xxx and nRF52xxx devices, however at the moment, no one has had time to port the OLED display code etc to the new repo.
With the Blackmagic probe, the DFU device is to update the BMPs own internal firmware, its not used to upload to the target device.
You need to select the GDB com port, as the Com port in the IDE, otherwise it wont upload.
I normally open a separate terminal program to the other BMP com port, if I am using it for USB to serial ( or if I am using a separate USB to serial adaptor to view debug messages)
Also you need to pick the Smartwatch board, otherwise Serial will be on the wrong pins of the watch
This is because those examples contain some function from mbed, and the old repo is a modified version of RedBearLabs repo, which its self is derived from mbed.
The second link is my fork of Sandeep Mistry’s Arduino-nRF5 repo, which is a newer and better implemtation of an Arduino core for nRF51xxx and nRF52xxx devices, however at the moment, no one has had time to port the OLED display code etc to the new repo.
With the Blackmagic probe, the DFU device is to update the BMPs own internal firmware, its not used to upload to the target device.
You need to select the GDB com port, as the Com port in the IDE, otherwise it wont upload.
I normally open a separate terminal program to the other BMP com port, if I am using it for USB to serial ( or if I am using a separate USB to serial adaptor to view debug messages)
Also you need to pick the Smartwatch board, otherwise Serial will be on the wrong pins of the watch
Its fixed at 9600 baud, so the sketch needs to use that speed.
Did you use the S130 SoftDevice version 1.0 which is part of the Nordic SDK V 10?
The SD 2.0 wont work as the application code offset is different
Its fixed at 9600 baud, so the sketch needs to use that speed.
Did you use the S130 SoftDevice version 1.0 which is part of the Nordic SDK V 10?
The SD 2.0 wont work as the application code offset is different
There are pinout differences between these watches
I had to visually trace and then confirm with my multimeter which pins went to the display on the ID107HR
If you have a github account, its probably worth logging into this gitter lobby , created by Goran, as there are a few other people who may be online to help
I’d need to double check
//#include <time.h>
#include <BLE_API.h>
#include "SFE_MicroOLED.h"
BLEDevice ble;
#define VIBRATE 7
#define BUTTON 4
#define DEVICE_NAME "ArduWatch"
Ticker RTCTicker;
SPI my_spi(P0_2, NC, P0_1);// MOSI, MISIO, SCLK
MicroOLED my_oled(my_spi, P0_30, P0_0, P0_29);//SPI,Rst,DC,CS
#define alarmHours 14
#define alarmMinutes 33
#define alarmSeconds 0
volatile boolean showTime=true;
volatile boolean useAlarm = false;
volatile int alarmTime = alarmHours * 3600 + alarmMinutes * 60 + alarmSeconds;
// Use these variables to set the initial time
volatile int alarmOnCount=0;
#define UPLOAD_TIME_SECS 7
volatile int secsTime = ((__TIME__[0] - '0') * 10 + ( __TIME__[1] - '0')) * 3600 +
((__TIME__[3] - '0') * 10 + ( __TIME__[4] - '0') )* 60 +
((__TIME__[7] - '0') * 10 + ( __TIME__[7] - '0')) ;
volatile time_t theTime;
time_t cvt_date(char const *date, char const *time)
{
char s_month[5];
int year;
struct tm t;
static const char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
sscanf(date, "%s %d %d", s_month, &t.tm_mday, &year);
sscanf(time, "%2d %*c %2d %*c %2d", &t.tm_hour, &t.tm_min, &t.tm_sec);
// Find where is s_month in month_names. Deduce month value.
t.tm_mon = (strstr(month_names, s_month) - month_names) / 3 + 1;
t.tm_year = year - 1900;
return mktime(&t);
}
// Simple function to increment seconds and then increment minutes
// and hours if necessary.
void updateTime()
{
/*
if (++secsTime> 24 * 3600)
{
secsTime=0;
}
*/
if (useAlarm == true && secsTime==alarmTime)
{
alarmOnCount=10;// on / off cycles
}
if (alarmOnCount>0)
{
alarmOnCount--;
digitalWrite(VIBRATE, !digitalRead(VIBRATE));
}
}
#define DISPLAY_ON_TIME_MS 5000
void displayTime()
{
unsigned long m=millis();
int lastSecs = 0;
int hours,remainder, minutes,seconds;
char txtBuf[9];
// y2k.tm_hour = 0; y2k.tm_min = 0; y2k.tm_sec = 0;
#if 0
time_t now;
struct tm *ts;
char buf[80];
// Format time, "ddd yyyy-mm-dd hh:mm:ss zzz"
ts = localtime((const time_t*)&theTime);
Serial.println(ts->tm_hour);
Serial.print("Again");
while(1);
#endif
my_oled.command(DISPLAYON);
alarmOnCount=0;// if the alarm is buzzing, stop it.
digitalWrite(VIBRATE, LOW);
while(millis() - m <DISPLAY_ON_TIME_MS)
{
if (lastSecs!=secsTime)
{
hours = (secsTime% (24*3600)) / 3600;
remainder = secsTime % 3600;
minutes = remainder / 60;
seconds = remainder % 60;
my_oled.clear(PAGE); // Clear the frame buffer
sprintf(txtBuf, "%02d:%02d:%02d", hours, minutes, seconds);
my_oled.setCursor(5, 5);
my_oled.puts(txtBuf);
// my_oled.setCursor(9, 20);
// my_oled.puts("Radiona");
my_oled.display(); // Draw the memory buffer
lastSecs=secsTime;
}
delay(1);
}
my_oled.command(DISPLAYOFF);
}
void buttonCheck(){
showTime=true;
}
void disconnectionCallBack(const Gap::DisconnectionCallbackParams_t *params) {
// Serial.println("Disconnected!");
// Serial.println("Restarting the advertising process");
ble.startAdvertising();
}
void initBLE(void)
{
ble.init();
ble.onDisconnection(disconnectionCallBack);
// setup adv_data and srp_data
ble.accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE);
ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
/*
ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_16BIT_SERVICE_IDS, (uint8_t*)uuid16_list, sizeof(uuid16_list));
ble.accumulateAdvertisingPayload(GapAdvertisingData::HEART_RATE_SENSOR_HEART_RATE_BELT);
*/
ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED); // set adv_type
// ble.addService(hrmService);// add service
ble.setTxPower(0);// set tx power,valid values are -40, -20, -16, -12, -8, -4, 0, 4
ble.setAdvertisingInterval(1600);// set adv_interval, 1000ms in multiples of 0.625ms.
ble.setAdvertisingTimeout(0); // set adv_timeout, in seconds
ble.startAdvertising();
}
void setup() {
//theTime=cvt_date(__DATE__,__TIME__);
pinMode(VIBRATE, OUTPUT);
pinMode(BUTTON, INPUT_PULLUP);
Serial.begin(9600);
Serial.print("HEllo");
#ifndef LOW_POWER
NRF_POWER->DCDCEN = 0x00000001;
NRF_TIMER2->POWER = 0;
NRF_UART0->POWER = 0;
#endif
initBLE();
my_oled.init(0, 8000000);
my_oled.setFontType(0);
my_oled.clear(PAGE);
my_oled.setCursor(4, 12);
my_oled.puts("ArduWatch");
my_oled.display();
delay(2000);
RTCTicker.attach_us(updateTime, 1000000);
attachInterrupt(BUTTON, buttonCheck, FALLING);
}
void loop() {
if (showTime==true)
{
showTime=false;
displayTime();
}
else
{
ble.waitForEvent();// Go to low power mode until an event e.g. interrupt or BLE event
}
}
#include <Wire.h>
#define KX022_addr_w 0x3E
#define KX022_addr_r 0x3F
#define KX022_Accel_CNTL1_1 0x18
#define KX022_Accel_CNTL1_2 0x41
#define KX022_Accel_ODCNTL_1 0x1B
#define KX022_Accel_ODCNTL_2 0x02
#define KX022_Accel_CNTL3_1 0x1A
#define KX022_Accel_CNTL3_2 0xD8
#define KX022_Accel_TILT_TIMER_1 0x22
#define KX022_Accel_TILT_TIMER_2 0x01
#define KX022_Accel_CNTL2_1 0x18
#define KX022_Accel_CNTL2_2 0xC1
#define DATA_OUT_BASE 0x06
void initSensor(){
writeTwoBytes(KX022_Accel_CNTL1_1,KX022_Accel_CNTL1_2);
writeTwoBytes(KX022_Accel_ODCNTL_1,KX022_Accel_ODCNTL_2);
writeTwoBytes(KX022_Accel_CNTL3_1,KX022_Accel_CNTL3_2);
writeTwoBytes(KX022_Accel_TILT_TIMER_1,KX022_Accel_TILT_TIMER_2);
writeTwoBytes(KX022_Accel_CNTL2_1,KX022_Accel_CNTL2_2);
}
void writeTwoBytes (int one, int two)
{
Wire.beginTransmission(KX022_addr_w);
Wire.write(one);
Wire.write(two);
Wire.endTransmission();
}
int getByte (int address)
{
int readedValue;
Wire.beginTransmission(KX022_addr_w);
Wire.write(address);
Wire.endTransmission();
Wire.requestFrom(KX022_addr_r , 1); // Or-ed with "1" for read bit
if(1 <= Wire.available()) // if two bytes were received
{
readedValue = Wire.read();
}
return readedValue;
}
float getAccel(int channelNum)
{
return ((int16_t)((getByte(DATA_OUT_BASE+1 + 2*channelNum)<<8) | (getByte(DATA_OUT_BASE + 2*channelNum)))) / 16384.0;
}
void setup()
{
// put your setup code here, to run once:
Wire.begin();
Serial.begin(9600);
initSensor();
}
void loop()
{
Serial.print(getAccel(0)*10);
Serial.print("\t");
Serial.print(getAccel(1)*10);
Serial.print("\t");
Serial.println(getAccel(2)*10);
delay(50);
}
So probably doesnt work with your watch
So this code probably wont work for you
#include "SFE_MicroOLED.h"
#define VIBRATE 7
#define BUTTON 4
SPI my_spi(P0_29, NC, P0_30);
MicroOLED my_oled(my_spi, P0_1, P0_0, P0_2);
const int CLOCK_SPEED = 1000;
// Use these variables to set the initial time
int hours = (__TIME__[0] -'0') *10 +( __TIME__[1] -'0') ;
int minutes = (__TIME__[3] -'0') *10 +( __TIME__[4] -'0') ;
int seconds = (__TIME__[7] -'0') *10 +( __TIME__[7] -'0') ;
unsigned long lastUpdate = 0;
// Simple function to increment seconds and then increment minutes
// and hours if necessary.
void updateTime()
{
seconds++; // Increment seconds
if (seconds >= 60) // If seconds overflows (>=60)
{
seconds = 0; // Set seconds back to 0
minutes++; // Increment minutes
if (minutes >= 60) // If minutes overflows (>=60)
{
minutes = 0; // Set minutes back to 0
hours++; // Increment hours
if (hours >= 12) // If hours overflows (>=12)
{
hours = 0; // Set hours back to 0
}
}
}
}
void setup() {
// put your setup code here, to run once:
my_oled.init(0, 8000000);
my_oled.clear(PAGE);
my_oled.setCursor(0,0);
my_oled.puts("Its Alive");
my_oled.display();
pinMode(VIBRATE,OUTPUT);
pinMode(BUTTON,INPUT_PULLUP);
Serial.begin(9600);
Serial.println("Smarty");
delay(2000);
}
void loop()
{
digitalWrite(VIBRATE,!digitalRead(BUTTON));
char txtBuf[9];
// Check if we need to update seconds, minutes, hours:
if (lastUpdate + CLOCK_SPEED < millis())
{
lastUpdate = millis();
updateTime(); // Add a second, update minutes/hours if necessary:
my_oled.clear(PAGE); // Clear the frame buffer
sprintf(txtBuf,"%02d:%02d:%02d",hours,minutes,seconds);
my_oled.setCursor(5,12);
my_oled.puts(txtBuf);
my_oled.display(); // Draw the memory buffer
}
}
#include <SPI.h>
#define VIBRATE 6
#define TOUCH 7
#define BUTTON 4
int c=0;
void setup()
{
Serial.begin(9600);
delay(100);
Serial.println("Hello ID107HR");
pinMode(TOUCH,INPUT);
pinMode(BUTTON,INPUT);
pinMode(VIBRATE,OUTPUT);
}
void loop()
{
Serial.print("Button state ...");
Serial.println(digitalRead(TOUCH));
delay(100);
digitalWrite(VIBRATE,digitalRead(TOUCH));
}
These may be the correct defines
#define VIBRATE 8
#define TOUCH 7
#define BUTTON 4
These may be the correct defines
#define VIBRATE 8
#define TOUCH 7
#define BUTTON 4
The digital watch code has 2 problems.
1. Takes too much power
The display seems to take power even if it is turned off via the SPI command.
The only way that I found to stop it taking power seems to be by using its Reset input. But then you have re-initialise the display each time before you use it.
Perhaps turning off the Charge Pump in the display would reduce current, but I have not had time to try various commands to see which of them would fix this.
2. The watch seemed to show the correct time for about 10 hours, but I then had a glitch and I think it lost or perhaps gained about 30 minutes.
At the moment I dont now what caused this.
The digital watch code has 2 problems.
1. Takes too much power
The display seems to take power even if it is turned off via the SPI command.
The only way that I found to stop it taking power seems to be by using its Reset input. But then you have re-initialise the display each time before you use it.
Perhaps turning off the Charge Pump in the display would reduce current, but I have not had time to try various commands to see which of them would fix this.
2. The watch seemed to show the correct time for about 10 hours, but I then had a glitch and I think it lost or perhaps gained about 30 minutes.
At the moment I dont now what caused this.
There are a load of setup commands, for the display size ( rows , cols etc) and stuff to do with the Charge Pump etc.
I tried to set the watch using the time and date compiler variables, but its not quite right as it depends on how long it takes to compile and upload.
But its better than nothing ![]()
I cant remember the Start and Stop code for the time, so perhaps thats a mistake.
BTW.
Currently we are using my old repo for this, which is based on RBLs repo.
But we should really move to my new one, sooner or later, as its based on Sandeep Mistry’s repo which is better.
However the OLED code only runs on the old repo, as the OLED code came from mbed, and RBLs code has mbed functions in it.
I don’t think it would be hard to port the OLED library to the new repo, but I don’t have time to do this at the moment. ;-(
I don’t think it would be hard to port the OLED library to the new repo, but I don’t have time to do this at the moment. ;-(
Re: Repos
Sorry. There are 3 of them and I forgot the really old one.
Do not use this one.
Its “very old” and I should probably remove it
https://github.com/rogerclarkmelbourne/nRF51822-Arduino
This is the “old” one which works with the Smart watch. Its based on RedBearLab’s repo (which is based on mbed)
https://github.com/rogerclarkmelbourne/Arduino_nrf51822
This one
https://github.com/rogerclarkmelbourne/arduino-nRF5
Is the latest one, but does not work with the Smart watch, and also has some other problems. However in the long term this will be the best repo, as its a fork of Sandeep Mistry’s new repo, which has been written from scratch and doesnt have all the mbed etc junk in it.
However at the moment our OLED code does not run with it (because of the mbed stuff), and also Sandeep’s repo does not include BLE examples (they are in a separate repo on his github account) and the BLE examples e.g. the Beacon seem to have problems and take too much power (according to what Goran has told me)
So..
Continue to use the repo which works for you, as its good enough to understand how the watch works, and also you can play with the BLE examples as they also work on the watch e.g. make it a iBeacon if you want, or perhaps merge the UART demo and send messages to the display ![]()
I just bought (and received) a USB BLE dongle (from eBay). (they only cost $5)
I’m hoping (eventually) to be able to upload via DFU from Windows.
But I only received the dongle yesterday, and I’m really busy with work, so I have not had time to understand how to communicate with it.
(Also I think only Windows 8 and newer e.g 8.1 and W10 have the BLE stack, and I normally run W7 as its stable)
I suspect Linux also supports these dongles (which seem to be made by CSR), but I have not had time to try that either ![]()
I just bought (and received) a USB BLE dongle (from eBay). (they only cost $5)
I’m hoping (eventually) to be able to upload via DFU from Windows.
But I only received the dongle yesterday, and I’m really busy with work, so I have not had time to understand how to communicate with it.
(Also I think only Windows 8 and newer e.g 8.1 and W10 have the BLE stack, and I normally run W7 as its stable)
I suspect Linux also supports these dongles (which seem to be made by CSR), but I have not had time to try that either ![]()
I’d probably end up doing an Ardroid App in Java if I needed to. (though its been a while since I did any Java)
I occasionally do some iOS dev, but I’ve not switched to Swift, as I do it do rarely, that its easier for me to use Objective C.
So..
Continue to use the repo which works for you, as its good enough to understand how the watch works, and also you can play with the BLE examples as they also work on the watch e.g. make it a iBeacon if you want, or perhaps merge the UART demo and send messages to the display ![]()
It shouldnt be too hard to port it.
It has some confusing mbed things, e.g the GPIO pin variables are actually objects (classes) so changing the value, changes the GPIO pin output.
(this confused me for a while !)
I think the SPI code is very similar to normal Arduino.
It shouldnt be too hard to port it.
It has some confusing mbed things, e.g the GPIO pin variables are actually objects (classes) so changing the value, changes the GPIO pin output.
(this confused me for a while !)
I think the SPI code is very similar to normal Arduino.
I was thinking about buying one like that which has a landscape orientation screen, as the screen is physically bigger ( wider ) so I think it has double the number of pixels of the others.
But I dont think I will risk ordering from that page, I will find one ( albeit a few dollars more expensive) which lists the watch as containing the nRF51
It sounds like its not an easy job.
I have ordered another smartwath, which is supposed to use the nRF52, but I wont know for sure if thats whats in it until it arrives, and I have a feeling it may be hard to take apart.
But I will post an update when it arrives.
I’ve not had any time to look at my existing nRF51 based watches for several weeks, as the STM Arduino Core has been taking up a lot of my spare time.
pretty nice
pretty nice
AFIK. Nordic have their own custom DFU implementation, which is supported by their App (on both Android and iOS)
However getting the binaries onto the phone and then manually running the App each time and selecting the file to upload etc etc etc, is not a very smooth development process.
I did ask Nordic if there was any publicly available code for another nRF51 to act as DFU master, but there isn’t. But I think Nordic sell a product which may do this (for about $100).
Its technically possible to write a nRF51 to nRF51 uploader but it would take a reasonable amount of error e.g to be able to have one nRF51 connected via USB Serial to a PC and get it to send DFU data to another nRF51 via BLE.
BTW. I think there is some sort of Serial bootloader as well, rather than DFU, but that doesnt really help that much as there isnt any nRF51 maser code for that either AFIK
I did look at using a cheap CSR BLE dongle on Windows to connect to the nRF51, but Microsoft doesnt support BLE on Windows 7 (which I’m using), and even when I tried it on Windows 10, I didnt get very far.
So I’m sticking with uploading via direct connection.
BTW. I know one person (Goran) who drilled some holes and used some IC socket pins through the side of a watch so he can program it, while its in its case. But I’ve still got both of my watches in pieces on the bench, as I’m struggling to find time to look at them.
http://www.ebay.com/itm/182341391730
Well, its a con !
I received 2 of them today and manage to get one of them apart, despite it being glued together
But I found it does not contain the nRF52 but uses a Dialog processor
So that was a complete waste of $30, as I bought 2 of them thinking that they would be an excellent platform because they contained the nRF52 which has STM32L4 like performance and low power consumption.
Unfortunately as the package they came in had tracking the vendor knows I received them, and although I have complained that they are not as advertised, I suspect they will try to get me to send them back, which would cost at least half the purchase price, so would definitely not be worth the hassle.
(...)Adafruit_SharpMem_SPI.cpp:92:5: error: expected unqualified-id before '.' token
SPI.begin();
^
I have a feeling its name has something do with it being the SPI Master, but I cant recall the exact syntax.
I am sure there are examples of SPI using the RBL core somewhere.
It’s not just a matter of replacing ‘SPI’ with ‘SPI_Master’ in the code (and libraries). There are certain functions that are common to the arduino SPI libraries (and the STM32 one) that aren’t in the RBL one. So far I’ve found these compatibility problems:
– SPIClass::beginTransaction() – doesn’t exist at all
– SPIClass::endTransaction() – doesn’t exist at all
– the class ‘SPISettings’ doesn’t exist at all, this usually stores SPI settings for use with other functions
– SPIClass::setBitOrder() is named ‘SPIClass::setBitORDER()’ – wrong case
Maybe someone that knows a bit more than me can have a go at cleaning it up and name it ‘SPI’ like usual. It doesn’t look like it would take long. I could botch it together myself (like I have), but I have below average knowledge about C++ and no idea how SPI works on the low level. It’s a real pain to have to change a ton of libraries to get SPI working ![]()
https://github.com/sandeepmistry/arduino-nRF5
I think his SPI implementation is more standard than the RBL version
Today I have managed to marge latest sandeepmistry with Roger patches, ant test on ID107HR.
It seams that most things are working with S130 v2 softcore.
I have fixed OLED lib and display is working.
I have tested I2C scan with original library and I can find accelerometer.
I did not manage to get response with original KX004 library but it compiles well.
My simple KX004 is not working, so we still need some debugging.
Button is working, but did not get vibrations from watch (it could be broken).
I can push my newest libs to your repo or make just samples repo (but we have so many repos that even me do not know what is ok…)
I perhaps we should chat in gitter about the best place for your files.
Its hopefully got the nRF52832 in it, as its an ID107 Plus.
But I won’t know for sure until I can get it apart, and it seems to be glued together.
I have ordered some other watches claiming to have nRF52’s in them but had a completely different processor (made by Dialog), so fingers crossed these do really contain the nRF52.
Its technically possible for TI chips to advertise the same UUID, but its unlikely that anyone writing firmware on a TI decice wold do this.
‘i’m sorry, we don’t have that item, i’ll check for any store in the area that has it in stock’
stephen
the iown i5 plus has a nice big screen, and 2 touch areas on the screen so you can swipe, and i confirmed it has an nrf chipset, so i hope to one day get it working and do fun projects with it
the iown i5 plus has a nice big screen, and 2 touch areas on the screen so you can swipe, and i confirmed it has an nrf chipset, so i hope to one day get it working and do fun projects with it
http://www.rogerclark.net/new-nrf52832- … available/
Most of the information has been supplied by Curt White
The ID107 looking quite promising as a development platform.
There is one large problem, as the watch is glued closed, so has to be cut open, which takes a lot of patience and time.
So I’m currently investigating ways of getting the watch to reset using external stimulus.
I don’t want to destroy the watch I have, but I’m thinking of injecting ripple on the USB charging port, to see if I can induce a reset
If anyone has any ideas about that, I’d be interested to hear them
Thanks
Unfortunately it’s a sealed unit, in an attempt to make it waterproof I think.
I have tried to cut one open, but gave up for the moment, as I was butchering the case.
This model has a built in USB plug, but apparently only 5V and GND are connected, even though the plug also has the USB data a lines.
It has a small lipo cell and built in charger circuit.
So I can’t cause a brown out, unless the battery is flatten.
I can’t access the clock connections either.
However, my thought is that RF can do strange things to devices, if you expose them to enough of it ![]()
I presume that the RF would be inducing currents inside the device, and changing 0’s to 1’s and vice versa.
E.g. Stick it in a microwave oven, and I’m pretty sure it would not continue to operate normally, and is likely to reboot ![]()
But that’s also likely to turn it into a lump of melted plastic, and would damage the RF side ( Bluetooth )
Where as perhaps If I connected a 32mhz transmitter to the GND , and had the whole thing running off a battery, I may be able to effect the clock to glitch and attempt to read data too fast etc.
I searched the web, but could not find much about this sort of thing.
I found an instructable about using a flash bulb circuit in a disposable camera, and a coil to do something similar, and I recall reading about someone getting a PC to reboot, by basically building a spark transmitter, using a car ignition coil
But the latter is dangerous and inpractical as a reset button ![]()
the last watch i opened was also glued shut, so i slowly heated it with my heat gun and carefully pried the edges until the glue loosened, and like that i could easily open it without damaging it. (and then the screen was glued to the pcb, so that was also some careful prying to separate them >_<)
I can install a DFU bootloader, but in order to run the bootloader the watch needs to be reset.
Well, it can be reset in software via BLE, but if the sketch crashes, then its impossible to reflash without taking it apart.
So I’m trying to work out if there is a way to induce a reboot by external means.
I had considered trying to cut some small additional holes in the watch and have pads to connect the SWD, or in this instance a pad connected to reset, but its hard to make a neat job of modifying these very small devices.
Hence why I’m looking for a non-invasive solution / hack
[RogerClark – Sat Jul 01, 2017 10:45 am] –
The problem is not so much opening it in the first place, but having to open it each time I want to flash new firmwareI can install a DFU bootloader, but in order to run the bootloader the watch needs to be reset.
Well, it can be reset in software via BLE, but if the sketch crashes, then its impossible to reflash without taking it apart.
So I’m trying to work out if there is a way to induce a reboot by external means.
I had considered trying to cut some small additional holes in the watch and have pads to connect the SWD, or in this instance a pad connected to reset, but its hard to make a neat job of modifying these very small devices.
Hence why I’m looking for a non-invasive solution / hack
indeed, for long term that would be ideal
i’m wondering about the i5 plus i’m intending to use, there is a huge XDA thread about development on it, maybe i can find something there to flash my binaries on it via their tools ![]()
[RogerClark – Sat Jul 01, 2017 10:45 am] –
The problem is not so much opening it in the first place, but having to open it each time I want to flash new firmware
I can install a DFU bootloader, but in order to run the bootloader the watch needs to be reset.
Well, it can be reset in software via BLE, but if the sketch crashes, then its impossible to reflash without taking it apart.
So I’m trying to work out if there is a way to induce a reboot by external means.
From the pictures I can’t tell, but perhaps you can fit small hall sensor or even reed switch and tie it to reset pin. This way you could reset the device by holding a magnet near the clock case. You need to open the case at least once to install the magnetic sensor, though – but still better than opening it again for reflashing.
I was hoping to find a way to reset without ever needing to open the watch, because some watches are glued together and taking them apart always damages them slightly
I am Emmanuel from France.
I read all these post and also the Roger’s blog, and I am very interesting in the ID107 HR plus.
So, Roger, actually is it possible to program it as you do for the ID100HR (by direct connections to the board?)
I saw also you search a way to reset it without opening the case. I will order one, and I could work on if you want (could you explain the trick if reseting to download code inside?)
Emmanuel.
[manu84 – Wed Aug 09, 2017 10:05 am] –
Also do you know this watch, seller claim it use nrf51822..
I would not trust the MCU listed in these adverts.
I bought 2 watches claiming to have nRF52832 in them, but they both had a completely different MCU
You may be luckly, but its really impossible to know until you open the watch and look inside
https://devzone.nordicsemi.com/question … n-windows/
Is it correct?
could it work with the ID107 HR plus?
Emmanuel
[manu84 – Wed Aug 09, 2017 11:35 am] –
It’s look like there are a way to use ota – dfu on windows :https://devzone.nordicsemi.com/question … n-windows/
Is it correct?
could it work with the ID107 HR plus?
Emmanuel
Thanks for the link.
In terms of whether it could be made to work with that watch…
Well, most things are possible in software, but you would probably need to load different firmware inside the watch first. And you would need to open it and connect SWD wires
However if you read the comments on the youtube video, the watch seems to fake the readings, so I’m not even convinced it has an nRF52 in it.
These companies just write things in the description which they think will sell more watches, and most users would not notice as the don’t take them apart
I just received my heart monitor smartwatch (near same as ID107).
I open it and check the mcu is right nrf51822.
The pcb is not same than yours but I identify rx, tx, swdio swclk test pad.
Then I follow your blog post (http://www.rogerclark.net/arduino-on-th … ontroller/), setup the arduino ide and program a mapple mini as describe (I have aslo a st-link v2, Could I use it?).
So now, to program the watch:
– Do I only need to connect swdio,swclk and ground to mapple mini, correct?
– Could you share you arduino script to test my config with the watch?
Regards.
Emmanuel
When in gdb I run monitor swdp_scan command, GDB return the nrf51822 as a ARM Cortex-M…
So I found my nrf51822 is a QFAAH1 version and found your post about problem you got with this version.
I test it also with a stlink v2 mini and openocd v 0.10 it fail also..
So please how do you solve the programing of H1 with the maple mini black magic probe? (I use your blackmagic_archive_version to burn the maple mini) ???
Thanks for your support.




