diff --git a/src/tests/power_consumption_test.ino b/src/tests/power_consumption_test.ino new file mode 100644 index 0000000..792c7f3 --- /dev/null +++ b/src/tests/power_consumption_test.ino @@ -0,0 +1,46 @@ +/** + * Author : Anatole SCHRAMM-HENRY + * Created the : 19/08/2024 + * This is the source file containing an app for power consumption testing. + * It wakes up for 4 seconds, turns the 3.3V rail on, then turns it off and goes to sleep + * for 4 seconds in a loop. This allows to check the sleep current which should be around 60 µA. + */ + +#include "definition.h" +#include "BoardConfig.h" +#include "WSPeripherals.h" +#include + +BoardConfig defaultBC; +WSPeripherals WSP(defaultBC); + +uint8_t sleepSlots(0), rCode(0); +WeatherStationDataPacket payload; + +void setup() +{ + #if SERIAL_DEBUG_ENABLED == 1 + Serial.begin(SERIAL_BAUD_RATE); + Serial.println("Setup begin"); + #endif + + rCode = WSP.init(); + + #if SERIAL_DEBUG_ENABLED == 1 + Serial.print("WSP init returned : ");Serial.println(rCode); + Serial.println("Setup end"); + #endif +} + +void loop() +{ + //Lets sleep for 4 secondes + LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_OFF); + Serial.println("Waking Up"); + WSP.externalPeripherals(WSPeripherals::ON); + delay(4000); + WSP.externalPeripherals(WSPeripherals::OFF); + Serial.println("Sleeping"); + delay(100); + sleepSlots++; +}