Deepsleep and AGC
Hi Duncan,
Both AGC and Deepsleep can be used for both models. Deepsleep is however dependent on a TFT screen with a backlight that can be switched OFF. For most of the TFTs that are used this needs a very simple modification (documented in this thread), breaking a connection between the backlight and the supplied voltage and putting a resistor between the PWM-pin and the TFT backlight. I will create a HEX with DEEPSLEEP (AGC will be in all) and that will also assume the TFT is PWM controlled.
As promised a bit more details on the new functionality, first up DEEPSLEEP and AGC.
How does DEEPSLEEP work ?
Deepsleep will put the teensybat in the lowest possible energy-state. For both T3.6 and T4.1 this means the device will be in hibernation, only the RealTimeClock will be active. At wakeup the system will restart completely as if you switched the device newly on. One thing at this special startup is different, it will immediately switch to AutoRecording (using the user-saved settings from EEprom) and will also switch off the screen fully.
Edit: Deepsleep can be started (after setting it ON) from the main menu when AutoRecord is choosen.
In the Auto Recording menu you need to set the USE DEEPSLEEP parameter to ON. The Sleep Start and Sleep End parameters allow you to set which part of the day the system will be sleeping. This has been currently been tested in cases where the sleep is only "during" the day. The code does however allow setting the Sleep Start for instance at 23:00 and Sleep End at 02:00 but this has NOT been tested.
When the system is actively recording (in Autorec) you can always interrupt this by pressing the LEFT recording button, just as in normal "auto-recording" mode. When the system is asleep pressing a button wont work. But there is a way to wake the system up (and break the deepsleep routine). If you press the LEFT recording button for a long time (at least as long as the value of DEEPSLEEP_TIMER (default 5 seconds) in bat_defines.h) the system will wakeup with a reset. After this deepsleep will not continue and you can alter settings or just use the device handheld.
Deepsleep is -as far as we know from testing - the most efficient on the Teensy 3.6 models, they use often less than 1mA when asleep. For the Teensy 4.1 we have not gotten energyuseage that low, it was often between 5-10mA. Most of my testing was done using a 1500mAH Lipo that was directly connected to VIN on the Teensy to power everything with the 3v3 that the Teensy can deliver. I got about 20 hours of recording and 55 hours of sleep using that setup. But thats on one of my machines and I hope people will experiment with
this to find out what the best way is to power the device for a very long time.
On the Teensy3.6 you can monitor the voltage on the 3v3 pin automatically and even stop the TeensyBat from further recording when the voltage drops too low. This feature is mainly
interesting if you use an unprotected LIPO battery. These should not be drained below 3V normally. This is set in bat_defines using VIN_ON (monitoring of 3v3) and VIN_LOW (currently 3000). This is ONLY for the T3.6 as the T4.1 has no option to directly read the output from the 3v3 pin.
How does AGC work ?
The Automatic Gain Control was added to react to very strong signals that normally would not allow proper recording. This option can be set in the STARTUP DEFAULTS section of the settings menu. There are 3 user controlled parameters.
AGC : On or OFF
AGC_increase (ms): time it takes the AGC to increase the GAIN after a strong signal was encountered
AGC_decrease (ms): time it takes the AGC to decrease the GAIN when a strong signal is present.
The AGC decrease is currently set to 5ms, so 5ms after the system detects a signal that is considered too strong it will step the current GAIN one position down.
If the signal still is too strong the gain will keep going down. When the strong signal has passed by the GAIN will increase again to the original value step by
step and the time between these is set by the AGC_increase value. Behind the screens (in the code) there are more parameters that allow more control
over this feature.
When AGC is ON and you do a manual recording (using the Recording Button) the AGC will be active also. When you use AutoRecording and you want to use
AGC that this needs to be activated in the AUTO RECORDING settings.
cheers
Cor