From 4761a66a2813360912ec0695b4cc847e33b69404 Mon Sep 17 00:00:00 2001 From: Th3maz1ng Date: Mon, 19 Aug 2024 12:30:01 +0200 Subject: [PATCH] Added a test to check power consumption of the board for HW debugging purposes --- src/tests/power_consumption_test.ino | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/tests/power_consumption_test.ino 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++; +}