Basic_Watch_v2 in progress

I have tried the blufruit app and that finds the watch fine.

Obviously though I want to do the song skipping thing that mtulu was doing.

Once I get that working my next step is Bluetooth notifications. This is going to be harder as we need a phone app to actually send the notifications over Bluetooth in the first place. There are a lot around so I may just keep trying them to see if there is one that talks to the watch in a way we can interpret.

I normally work on Ubuntu (not sure which Arduino version) but today I tried to compile my sketch on Windows but I get this error.

sketch\display.h: In function 'void MainMenu()':

sketch\display.h:179:64: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

 char* items[] {"Exit", "Set Time", "Tones Menu", b, "Alarm"};

Any idea what this is?

Does the b not need “”?

It’s a variable passed in from above.

Never seen before 


Ok. So it just works from home :-s

Bluetooth song skipping now works fine. Bizarrely though my OnePlus 3T refuses to pair with it. My laptop and my Nexus 7 work fine.

I’m going to go ahead and code UART Bluetooth flash notifications as I can use the Adafruit app for testing. But then we will need an android app that runs as a service to forward notifications to the watch.

1 Like

I found an enhanced RTC Lib which can be used to add interrupt based rtc alarm wakeup to the system.
Maybe something for you instead of timer wakeups.
See https://www.instructables.com/id/Arduino-Sleep-and-Wakeup-Test-With-DS3231-RTC/
and https://github.com/FabioCuomo/FabioCuomo-DS3231/

Have you tested it? There needs to be a connection between the RTC and an input pin. TBF I can’t sleep too long as I need to wake up once a minute at least to check for hourly tones and alarms.

Also when I add Bluetooth notifications I’ll need to check for those too.

Can you have a look at my USB detection? It says it’s always connected, but I pretty much copied from your tap clock sketch.

Not tested yet, just found.
Here (another RTC Lib)

is written about:

Values for Alarm 1
  • ALM1_EVERY_SECOND – causes an alarm once per second.
  • ALM1_MATCH_SECONDS – causes an alarm when the seconds match (i.e. once per minute).
    etc.

INT3 = RTC-INT on the board.
Bluetooth has an INT Pin too


If we can get everything working off interrupts then we can put the watch in deep sleep and wake it once a minute for time based events. Battery should last a lot longer.

Currently I get around 2 days and I’m sleeping for a third of the time. If we could stretch that out to 80% of the time then the battery should easily last 5 days even when using all the sensors.

That will be hard.
My Record with sleeping MPU and MAG,
waking the system from the deepest MCU Sleep Mode with a button was about 50hrs runtime without using Bluetooth or the Temperature Sensor.
The MPU costs around 50% Battery at TapClock.

Hmm. Must be able to do better. The nwatch Dev who use similar hardware was getting a month.

I got the elektor pdf with the nwatch article yesterday but haven’t finished reading.


upps N|Watch != nWatch.

Many DIY Watches around.

If I am correct Zak Kemble‘s nwatch has no MPU/MAG/BLE/BME.

I go through all the posts and I can see that there is an issue connecting the watch to the phone. Proper initialisation should be like so:

  ble.factoryReset();
  ble.sendCommandCheckOK(F( "AT+GAPDEVNAME=watchX" ));
  ble.sendCommandCheckOK(F( "AT+BleHIDEn=On"  ));
  ble.sendCommandCheckOK(F( "AT+BLEPOWERLEVEL=4" ));
  ble.reset();

When a look at the Basic Watch Bluetooth code I see this line:

    ble.sendCommandCheckOK(F( "AT+BleKeyboardEn=On"  ));

It will cause phone or pc to be seen as keyboard and this can lead keyboard not poping up when you want to text something. There is no issue on Android side because you can select weather you want to use the device for data input or not. I am searching the solution for the iphone

Side not, If you previously connect the watchX to a PC/Mac you should remove it. If watchX connect to a device you won’t be able to see it on search.

Also I am sharing below commands that can be useful:

ble.sendCommandCheckOK(F( “AT+GAPDEVNAME=watchX” )); // Change the name of the Ble device.
ble.sendCommandCheckOK(F( “AT+HWMODELED=DISABLE” )); // Disabling this will reduce power consup.
ble.sendCommandCheckOK(F( “AT+UARTFLOW=OFF” )); // Disabling this will also increase battery life
ble.sendCommandCheckOK(F( “AT+BLEPOWERLEVEL=-12” )); // This sets broadcast power. It has a significant effect in battery life. Please see PAGE-95 for more detail
ble.sendCommandCheckOK(F( “AT+BLEMIDIEN=OFF” )); // Disabling this will also help in battery life.
ble.sendCommandCheckOK(F( “AT+GAPSTOPADV” )); // We can start and stop Bluetooth advertisement, this line will stop it.
ble.sendCommandCheckOK(F( “AT+GAPSTARTADV” )); // This line will start it.

1 Like

Just a note, on Page 149 of the BLE Document ist written:
-snip-
Can I use the IRQ pin to wake my MCU up from sleep when BLE UART data is available?
No, on SPI-based boards the IRQ pin is used to indicate that an SDEP response is available to an SDEP command.
-snip-
Is the INT connection completely un-useful?

The IRQ pin is connected on INT2. It’s role is being at logic HIGH state when packet/packets are available. The bluetooth module has it’s own NRF51822 MCU so all bluetooth related activity occure at NRF51822 then data is passed to Atmega32U4 via SPI.

Logically we should be able to wake up the MCU with an external interrupt through INT2. I don’t know why adafruit stated it as it is. Am I missing something here?

I have basic Bluetooth messages flashing up on the watch when sent from the Adafruit app!

Got to try it now:) By the way I think charging led indicator not really performing as it is supposed to be. I was looking at it right now and searching through the code:)

No it isn’t . Also it says usb is connected all the time when it is not. Oh the code in got has sleep disabled, I forgot to re-enable it.

The Bluetooth notification is really sweat:) I loved it great work! I have a good coffee and great music will dig into usb problem now;)