After just 7 to 10 days, the 3xAAA batteries of my TTN Nodes (from the TTN online shop) were already empty, even if it only transmitted one frame every 4 hours. From reading in the forums, there is a known bug in the Microchip RN2483 module, preventing it to enter sleep mode and draining the battery.
I’m not yet sure if this is the only reason why the orignal TTN Node is draining the batteries that quick, but updating the firmware of the RN2483 to get rid of that known bug could probably help.
Since the procedure to update the microchip lora module is not quite straight forward, I am trying to document it here.
Gotchas:
The microchip LoRa development tool for linux and mac apparently contains a bug, preventing you from selecting the firmware file. Hence you have to use Windows to perform the upgrade.
You need a serial connection to the RN2483 module, so you have to temporarily upload a “passthrough” code onto the TTN node to get direct access to the RN2483 module to perform the upgrade.
Prepare the TTN Node for the firmware upgrade by uploading the passthrough sketch:
Open Arduino IDE (assuming you have already installed all required TTN libs) and open:
File \ Examples \ TheThingsNode \ Passthrough
Upload this sketch to the TTN Node to allow a serial passthrough connection from the TTN-Node USB Serial port to the RN2483 chip.
On a Windows (10) machine, perform the following steps:
Launch the installer and complete the installation
If you had selected to install Java, you must also manually start the JRE8 installation now, as the loradev installer just puts the java installer EXE into the program folder, but does not actually execute it:
Open the folder c:\Users(username)\Microchip\LoRaSuite\Java and doubleclick the java installer exe.
Now open a NEW command prompt, navigate to c:\Users(username)\Microchip\LoRaSuite\Applications\LoRaDevUtility\ folder and launch:
java -jar LoRaDevUtility.jar
The microchip loradev utility should start up now.
Now connect the TTN Node, which is in passthrough mode, to the microchip loradev tool, click the “find devices” button and the RN module should show up in the left panel. Select it and the console should display RN2483 1.0.1 Dec 12 2015 etc…
Locate the DFU tab and in the “bootloader input” section click on the button for “select file”.
Remember, this button does not work in linux and mac, even if the userprefs xml was updated… that’s why we are forced to use windows here.
Select the firmware hex file in the folder “binary\For Bootloader” of the ZIP file you downloaded before. Hit Update Firmware and wait until completed.
Reconnect and verify that the version in the console now shows 1.0.3 (or newer)
Now you can upload your own code again using the arduino IDE.
I hope this will fix the sleep mode bug, which drains the batteries of the TTN Node within just a few days.
@flx
I followed the description but was not successfull.
First of all de file location differs. In my situation it is:
C:\Users\drasv\Microchip\LoRaSuite\Applications\LoRaDevUtility\LoRaDevUtility.jar
When I run it from the command prompt I see him scanning ports. In my case COM13 is the The Things Node with the installed passtrough program.
The Microchip Developmend Utility is not showing any device.
I cannot click “Find device”.
Am I missing something?
Any suggestion is helpfull.
Cu, Remko.
I did not have to press any (reset) buttons. Just plug in the node and launch the LoRaDev tool, then it should find it even without pressing the “find” button.
Can you verify if the serial passthrough is really working by opening a serial console in arduino IDE:
In Serial Monitor select “Both NL & CR” and “115200 baud” in the bottom right dropdowns and send a command like: mac get deveui
There must be a reply by the RN chip.
Btw, after upgrading the firmware, close the LoRaDev tool, unplug the node and connect it again, then launch the LoRaDev tool again. It should immediately find the new device and report the new firmware version in the console. If you don’t restart the tool, it will not work with the already listed device.
Thanks, I’m glad to hear it worked! Now I hope this will really fix the battery drain problem, because just 7 days is a joke, when TTN claims “over a year” in the specs.
Just after ordering, they dropped prices from EUR 70 to 50… d’oh!!
@pe1mew have you used the same usb cable as for uploading the arduino sketch?
If I understood you right, the loradev tool recognizes the TTN uno correctly, but not the TTN Node?
@flx
I removed sending on move and setup transmit every 5 minutes and with my 1st node, got 2/3 weeks
Updated firmware on my 2nd node just now, and let’s see how far it goes
Here the sketch for reference (could be fine that TTN provide a Year duration sketch
#include <TheThingsNode.h>
#include <CayenneLPP.h>
// Set your AppEUI and AppKey
const char *appEui = "0011223344556677";
const char *appKey = "00112233445566778899AABBCCDDEE";
#define loraSerial Serial1
#define debugSerial Serial
// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
#define freqPlan TTN_FP_EU868
TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan);
TheThingsNode *node;
CayenneLPP lpp(51);
#define PORT_SETUP 1
#define PORT_INTERVAL 2
#define PORT_MOTION 3
#define PORT_BUTTON 4
void setup()
{
loraSerial.begin(57600);
debugSerial.begin(9600);
// Wait a maximum of 10s for Serial Monitor
while (!debugSerial && millis() < 10000)
;
// Config Node
node = TheThingsNode::setup();
node->configLight(true);
node->configInterval(true, 300000);
node->configTemperature(true);
node->onWake(wake);
node->onInterval(interval);
node->onSleep(sleep);
node->onMotionStart(onMotionStart);
node->onButtonRelease(onButtonRelease);
// Test sensors and set LED to GREEN if it works
node->showStatus();
node->setColor(TTN_GREEN);
debugSerial.println("-- TTN: STATUS");
ttn.showStatus();
debugSerial.println("-- TTN: JOIN");
ttn.join(appEui, appKey);
debugSerial.println("-- SEND: SETUP");
sendData(PORT_SETUP);
}
void loop()
{
node->loop();
}
void interval()
{
node->setColor(TTN_BLUE);
debugSerial.println("-- SEND: INTERVAL");
sendData(PORT_INTERVAL);
}
void wake()
{
node->setColor(TTN_GREEN);
}
void sleep()
{
node->setColor(TTN_BLACK);
}
void onMotionStart()
{
node->setColor(TTN_MAGENTA);
debugSerial.print("-- SEND: MOTION");
sendData(PORT_MOTION);
}
void onButtonRelease(unsigned long duration)
{
node->setColor(TTN_BLUE);
debugSerial.print("-- SEND: BUTTON");
debugSerial.println(duration);
sendData(PORT_BUTTON);
}
void sendData(uint8_t port)
{
printSensors();
if (port != PORT_MOTION) {
lpp.reset();
lpp.addDigitalInput(1, node->isButtonPressed());
lpp.addDigitalInput(2, node->isUSBConnected());
lpp.addDigitalInput(3, node->isMoving());
lpp.addAnalogInput(4, node->getBattery()/1000.0);
lpp.addTemperature(5, node->getTemperatureAsFloat());
lpp.addLuminosity(6, node->getLight());
float x,y,z;
node->getAcceleration(&x, &y, &z);
lpp.addAccelerometer(7, x, y, z);
ttn.sendBytes(lpp.getBuffer(), lpp.getSize());
} else {
// Time to see motion led
delay(500);
}
}
void printSensors()
{
debugSerial.println();
debugSerial.println("SENSORS:");
debugSerial.println("--------");
debugSerial.print("LED Colour:\t");
debugSerial.println(node->colorToString(node->getColor()));
debugSerial.print("Temperature:\t");
debugSerial.print(node->getTemperatureAsFloat());
debugSerial.println("°C");
debugSerial.print("Light Sensor:\t");
debugSerial.print(node->getLight());
debugSerial.println("lux");
debugSerial.print("Moving now:\t");
if(node->isMoving())
{
debugSerial.println("yes");
}
else
{
debugSerial.println("no");
}
debugSerial.print("Button pressed:\t");
if(node->isButtonPressed())
{
debugSerial.println("yes");
}
else
{
debugSerial.println("no");
}
debugSerial.print("USB connected:\t");
if(node->isUSBConnected())
{
debugSerial.println("yes");
}
else
{
debugSerial.println("no");
}
debugSerial.print("Battery:\t");
debugSerial.print(node->getBattery());
debugSerial.println("mV");
float x,y,z;
node->getAcceleration(&x, &y, &z);
debugSerial.print("Acceleration:\tx=");
debugSerial.print(x);
debugSerial.print("g\n\t\ty=");
debugSerial.print(y);
debugSerial.print("g\n\t\tz=");
debugSerial.print(z);
debugSerial.println("g");
debugSerial.println("--------");
debugSerial.println();
}
@ursm I just upgraded both my TTN Uno and mt Thnings Node. IMHO this procedure is usable for any node using a RN2483 and a MCU that can act as transparent passtrough
@flx thanks for your perfect instructions. Worked nicely. Unfortunately ‘The Things Node’ still uses around 3.8mA in sleep mode. Is the schematic of ‘The Things Node’ available? Maybe the excessive current drawn is a hardware design issue.