phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 3426
Posted: 03:29am 01 Oct 2025
If I have understood the issue, waiting 500mS would 10% of the total time awake and he would rather not use that much power.So he wants to wake it just as the pulses are about to start, count them, check the tilt switch and if nothing needs to be done go back to sleep as quickly as possible.
I think Jim's point is using the pulses to wake it up may not work if the pulses last less than 1mS. The particular chip being used may respond faster than that but would have to be tested to find it's minimum wake pulse duration. Then compare that with the measured pulse durations being supplied. All unknown at this time.
Edit. Perhaps a CMOS gate wired as a pulse-stretcher could be connected to the wake pin to ensure a 1mS pulse. A second CMOS gate wired as an integrator, as suggested by @robert.rozee, would provide an analogue voltage representing the number of pulses. After waking the pin it is connected to would then be set to AIN. After reading the voltage the AIN pin would be changed to DOUT to reset the integrator then the pin would be set to OFF.
Further thoughts. The extra gates may not be needed. The pulse stretcher:- diode --> capacitor to gnd. and Wake pin. After waking read the integrator. When ready to go back to sleep set it to DOUT to discharge the cap then OFF then SLEEP. The integrator could be just as robert.rozee described:- diode --> resistor --> capacitor to gnd. and AIN pin. Measure and discharge as above. Edited 2025-10-01 14:11 by phil99
Footnote added 2025-10-01 14:50 by phil99 Ok, forget all the above. See Jim's post below.