• More ideas
    Measuring the awake duty cycle of a sleepy Espruino board.
    Using an analog clock would work if the sleepy Espruino on time is longer that one cycle of the clock mains 60 Hz. Or 50 Hz.
    If the sleepy Espruino on time is shorter then this would be better.
    Given a sleepy Espruino board that wakes up periodically to perform the user’s task, it would be useful to measure that percentage time in a period (24 hrs.) it is awake.
    Hardware:
    Take a watch crystal oscillator output (32.76803 kHz) as one input to a two input NAND gate.
    Use a pull-down resistor on a pin on the sleepy device so that when it’s asleep the pin is low and when awake the pin is high. Tie this pin to the 2nd input of the gate.
    Tie the output of the gate to a divide by 256 and follow that by another divide by 128 chip.
    If the gate is “on” the output of the 2nd divider would be 1 Hz.
    Tie the output of the 2nd divider to a pin on a 2nd Espruino board, programmed to count the pulses on the pin. Then 100* pulse_count / elapsed_time is the percent on duty cycle.
    Of course an even faster clock and divisor chain could be used.
    Is there some way to use a pin on the measurement Espruino board to gate the watch crystal oscillator and eliminate the extra hardware?
    Is there a way to use the counters on the ARM chip to implement this?

    Another method if E.getTemperature() is available.
    In a room with relatively constant temperature, load the Espruino with code to sleep for an hour, wake up, measure and report the chip temperature T1.
    Then load your program to sleep, wakeup, do your job and sleep again. Add code to read and report the chip temperature after an hour T2.
    And finally run code fully awake for an hour, then read and report the chip temperature T3.
    Duty cycle % = 100*T2/(T3-T1).

About