Basic_Watch_v2 in progress


#81

My battery life is horrendous on the latest version. I think this is because my device thinks the USB is always connected so it doesn’t go to sleep.

I think my watch has a hardware fault.


#82


#83

Did you tried the USB Detection code snippets „standalone“ to be sure it‘s not something from the sketch even it‘s unlogical?


#84

No. I will give it a try. Seems odd thought that you,@mtulu and I all loaded the same code from GitHub and yours both work and mine does not.

When I get a chance I will try the snippet.


#85

Maybe just the line which is not cleared for whatever reason.


#86

Odd


#87
#include "SSD1306Ascii.h"
#include "SSD1306AsciiSpi.h"
#define CS_PIN  A5
#define RST_PIN A4
#define DC_PIN  A3
#define CRG_STATE 5
SSD1306AsciiSpi oled;

void setup() {
  // put your setup code here, to run once:
USBCON|=(1<<OTGPADE);  //enables VBUS pad
pinMode(CRG_STATE, INPUT_PULLUP);
  oled.begin(&Adafruit128x64, CS_PIN, DC_PIN, RST_PIN);
  oled.clear();
  oled.setFont(System5x7);
}

void loop() {
  // put your main code here, to run repeatedly:
oled.clear();
bool usbConnected = (USBSTA&(1<<VBUS));
//bool charging = digitalRead(CRG_STATE);
oled.println(usbConnected);
//
delay(500);
}

#88


#89

OK. So if I have pin 5 enabled as a input with pullup. USB detection does not work. If I comment it out it works fine.


#90

Weird because my setup is with INPUT_PULLUP.

#define CRG_STATE 5

setup()

pinMode(CRG_STATE, INPUT_PULLUP);
USBCON|=(1<<OTGPADE);

loop()

usbConnected = (USBSTA&(1<<VBUS));
charging = usbConnected && !digitalRead(CRG_STATE);


#91

I have disabled charge detection for now. I also found a bug that was causing the watch to not sleep (may be related to usb issues). So hopefully I will see better battery life tomorrow.


#92

6 hours and 75% battery left. Although I have a slight delay on waking the watch because I have put the MCU to sleep 750ms each cycle.

I was looking at pcint last night but it doesn’t play ball with the Adafruit Bluetooth library.

Also I have noticed some battery degredation. I can only charge it to 93% now.


#93

Still 61% almost 12 hours later.


#94

15% after 24 hours. Not amazing but much better.


#95

There is definitely an increase in battery life based on my test. I did not understand why charge detection causing USB to stay attached. I will take deep look into it, once I return from the CES Show:)


#96

It must be the polling of the Bluetooth. I can’t use interrupts though as the pcint libraries I’ve tried won’t work with the bluefruit library.