Hi there
I had to spend quite some time getting The Things Node running with 40uA sleep current, so I thought I could give you a quick How-To what you have to do.
There is a forum thread that contains a lot of info on this topic, but it is rather long and not well structured.
The Things Node 40uA HowTo
-
Open Arduino IDE (v1.8.13) and install TheThingsNetwork (V2.0.6) and TheThingsNode (V2.0.6) via Tools/Manage Libraries
-
If you have a Node with rather old LoRa module RN2483 firmware version (e.g. V 1.0.1), you need to update this firmware to version 1.0.5 according to this forum post.
-
Open the File/Examples/TheThingsNode/BatteryMonitorLPP. (Paste in the AppEui and appKey and freqPlan for your gateway/application). When you download the sketch at this point, you would measure approximately 400uA sleep current.
-
Open the library file /Users/XYZ/Documents/Arduino/libraries/TheThingsNode/src/TheThingsNode.cpp with a text editor and add both lines commented with +++ in the appropriate places.
void TheThingsNode::deepSleep(void)
{
ADCSRA &= ~_BV(ADEN);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
MCUCR |= (1 << JTD);
USBCON |= (1 << FRZCLK);
UHWCON &= ~_BV(UVREGE); // +++ disable the USB regulator
//USBCON &= ~_BV(USBE);
PLLCSR &= ~_BV(PLLE);
sleep_enable();
sleep_mode(); //Sweet dreams!//wake up, after ISR we arrive here ->
sleep_disable();
PLLCSR |= (1 << PLLE);
power_all_enable();
//USBCON |= (1 << USBE);
UHWCON |= UVREGE; // +++ enable the USB regulator
USBCON &= ~_BV(FRZCLK);
ADCSRA |= (1 << ADEN);
}
Compile, download and enjoy 40uA sleep current. Now if you change the connection interval (which is 5 minutes per default) to e.g. 6 hours, you can run The Things Node from 3x AAA batteries for approximately 2 years now!