Paper S3 questions
-
I know the PaperS3 is really new but just wondering if anyone has figured out the following:
-
Github for the factory demo - I cannot find it.
-
Any way to get the S3 to wakeup via touch (interrupt) or side button, when in a light sleep?
-
Side button can turn off the S3 but not turn it back on (when not plugged into a power source), hence it cannot be used to "reset" the S3 (it only works when the S3 gets power via the USB).
If anyone has figured out the above, that would be very helpful.
otherwise it works relatively well
thanks
-
-
- The factory demo code is not provided by official
-
[Some corrections - see followup comments.]
I have not started reverse engineering the power states on my PaperS3 yet but as far as I can tell with the Arduino IDE, clicking the button once will power up the device and double clicking will power it off.
Pushing and holding the device will cause it to re-run whatever boot stack is on it, which for a Arduino IDE-installed program in the same as powering it up.The device cannot be turned off when the USB is connected to a power souce.There is no way to control the LEDs so if you need to test if the device is running you can work something up with the screen, sound, and touch.
Being an e-ink device the objective is to leave the device off most of the time, and only wake it to update the screen every once in a while.
The feature I would like to see documented, if it exists, is a way to power the gyro off and on. The product page says, "Low power mode: DC 4.2V / 9.28µA (main power off, gyroscope in low power mode); Standby mode: DC 4.2V / 949.58µA (main power off, gyroscope on)" Which means the battery could last for weeks if you didn't need the gyro.
-
Hello @wsanders
the function of the M5PaperS3 power button is described here.
With USB connected I can power off my M5PaperS3 with a power button double-click. I am running a simple program periodically reading the battery voltage and printing it into the log. And the log stops when I double-click the power button.
Thanks
Felix -
@felmue You are correct. I put some code in my program to blink a filled circle on the display, e.g.
void loop(void) { display.startWrite(); if (color == 0) { display.fillCircle(500,910,20,TFT_WHITE); } else { display.fillCircle(500,910,20,TFT_BLACK); } display.endWrite(); color = (color + 1) % 2; sleep(3); }
If I double click the switch while the device is connected to USB it turns off. This is using the Arduino IDE. If the device is off and I press-and-hold the switch the device does not reboot or power on.
-
@wsanders said in Paper S3 questions:
Being an e-ink device the objective is to leave the device off most of the time, and only wake it to update the screen every once in a while.
Just curious if you (or anyone else has) actually got this working on a PaperS3 - meaning on battery only if you can go to light/deep sleep and it wakes up on a timer (it only wakes up on a timer for me when on power but not on battery for me).
-
Hello @aleekwen
well, looking at the schematics there shouldn't be a difference about whether M5PaperS3 is running from USB or battery.
That said, is the battery of your M5PaperS3 charged? My M5PaperS3 battery was fully depleted when I got it and it took several hours for it to be fully charged.
Thanks
Felix -
I am using M5.Power.timerSleep(int) in a sketch and it sort of works. The sketch displays the date and is supposed to wake up and refresh the date a few sec after midnight.
Sketch here: https://github.com/wsanders/M5PaperS3-Stuff/blob/main/papers3badge.ino
I used the int form of timerSleep since for now it was easier than reverse engineering the rtc_time struct. Utimately, the alarm should be set in the chip with a ?mumble?-bit int with value in ?mumble?-seconds. (*)
There are some problems:
- The device seems to randomly wake up at times.
- Occasionally the Status LED is illuminated continuous orange when the device is supposed to be asleep.
At first I thought I was passing timeSleep a 16-bit Arduino int which was limited to 2^16 sec (not a whole day) but the int in the sketch compiles into a ESP32 int which is 4 bytes.
The source for the _timerSleep private class starts at line 724 in Power_class.cpp FWIW. I haven't dug all the ay down to where it calls the chip, but the BM8563 chip is the RTC in almost all the M5 products and should be OK. (*)
PMS150G data sheet here: https://www.padauk.com.tw/upload/doc/PMS15B,PMS150G datasheet_EN_V008_20230216.pdf
(*) I coded up a wristwatch based on the StickCPlus and after nearly a year the RTC is only off by a few sec. )
-
Hello @wsanders
there are two issues I can see with
M5.Power.timerSleep(time)
:- calls
M5.Rtc.setAlarmIRQ(time)
which can only handle up to 255 minutes. See comment here. - calls
_timerSleep()
which calls_powerOff(true)
which never really powers M5PaperS3 off as this functionality has not yet been implemented and therefore uses ESP32 deep- or lightsleep as fallback. See here.
The first point is probably responsible for the premature wake-ups you are seeing.
The second point is probably the reason for the status LED not always turning off.Edit: I've created a PR to fix the power off functionality.
Thanks
Felix - calls
-
@felmue Thanks again ....
Sure enough, the device rebooted 4.25 hours after the last reboot this morning. This isn't too bad a limitation for my badge test skeptch, the sketch will set the date anyway, and if it's less than 4.25 hr before midnight it will still reset at midnight.
Digging deeper into setAlarmIRQ, the 255 min limit is not in the rtc_time_t instance; the rtc_time_t instance should be able to handle an alarm up to a week away.
So far, the LED has not illuminated after M5.Power.timerSleep does whatever it does.
You have to be care to actually send M5.Power.deepSleep the right uint64_t, something like:
M5.Power.deepSleep(1000000L * uint64_t(w), false);
ESP deep sleep should be almost as good as a power off, assuming setAlarmIRQ works.
-
Hello @wsanders
you are correct,
rtc_time_t
is not the limiting factor, it's the 8 bit register in the RTC holding the time for the timer functionality.Well, it depends on what you consider "almost as good". With M5PaperS3 fully powered off (with my PR) at the battery I measure about 9.6 uA (which is close to the advertised 9.28 uA) whereas in ESP32 deep sleep I get about 5.1 mA (which is about 550 times higher).
Thanks
Felix -
@felmue thanks I will try this later I was using the ESP32 deep sleep methods directly vs the M5 ones.
-
@felmue Are you sleeping the IMU with M5.Imu.sleep when you deep sleep the ESP? I think by default the IMU stays awake.