I haven't had time to continue working on the interpreter code the past few days, which is why I have been testing other things such as the power consumption on this device.
I was able to take the device with me and write the program I discussed in the [previous log] and do the following tests while on the go.
Started the [deepsleep 8 min, flash led 1 sec, repeat x127] program at 10:15pm last night. By my calculations this program would take just under 17 hours to complete:
8min × 127 = 1,016 minutes (~16 hrs 55min 34sec)
+ 1sec x 127 = ~2min 6 sec
Total time +/- execution time and varied clock speed = 16hrs 58min
Below are the test results. After starting the program I periodically tested the voltage with multimeter, being careful to keep the solar panel pointed down onto a surface so there was no solar input.
- 8/16/2024_10:15pm 3.93v
- 8/17/2024_9:39am 2.85v
- 8/17/2024_11:26am 2.7v
- 8/17/2024_12:54pm 2.58v
- 8/17/2024_2:22pm 2.46v
- 8/17/2024_2:57pm 2.42v
- 8/17/2024_5:17pm 1.92v
Between the last two readings the voltage dropped rapidly, and I realized while taking the last reading that the device had gone in power down mode so the program was no longer running.
Taking our ~17 hour run time into consideration it appears what happened was at 3:15pm or so the program stopped, which put the device in "Menu Mode", which is what happens when the interpreter is finished running a program. In this modes initial state no LED's are on, but the processor is running full tilt at a whopping 1mhz consuming 1.3mA, sampling VCC voltage every 100ms checking for button input. This would probably drain the supercapacitor from 2.4 volts to 2 volts in about 5-10 min, forcing the device into power saving mode.
To do a more accurate test for this aspect of the device I will finish the interpreter code for controlling PB2, and connect that to a pi pico or arduino as an output.
Writing a new program with an infinite loop like this, will allow looping more than 127 times:
F1 # C= 0 1, L0H PDOH 8M LPF # : F1 : EOP
This program creates a function which compares 0 to 1 checking if 0 is equal. It is never equal, so at the end of the function block the loop function OP LPF (or binary 10100000) repeats the function. After the function is set using the # symbol, it is called just using its register name (alias F1 for function 1).
The only OP in this example program I do not have implimented is the PDOH keyword which stands for Pin Digital Out High, its binary byte is 11100111. This op will control PB2, which is the only pin that is open for use by the user. (What is great about this pin is we can use it as a hardware interrupt, ADC, or digital pin.)
After the interpreter flashea the LED and sends a logic pulse on that pin, the secondary microcontroller read pulse then will log the time and voltage of the devices VCC. Allowing me to see how long the program has actually run and at what rate the voltage depletes in this mode. Im guessing about 30-40 hours of runtime.
Another hardware modification I want to make is change the voltage divider for reading VCC to a 4M and 220k resistor with a 10nf cap on the ADC pin.
This would drastically reduce the power consumption in deepsleep, maybe even reduce it less than supercapacitor self discharge rate.
As we only check this voltage every minute or so, the 10nf capacitor should charge fine in between readings, but it will take some real world tests to know for sure...
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.