The Things Node : new low power library development

dci-ttnnode2

node->configMotion(true);
node->configLight(true);
node->configTemperature(true);

1 Like

@BoRRoZ and @Charles thanks for your work! You were just a bit faster than I. Today I also started to investigate into current consumption of the ttn node and found out, that the RN2483 is not put into sleep! But the code to put the uC into Sleep works.
whole_setup
Above the left top DMM shows the total current consumption (3.97mA). The left lower one shows the current of the RN2483 (2.96mA) and the right one shows the current of the uC (~13µA). The DMM measurement is not super precise, because it is in mA Mode (µA would mean to much drop, 100Ohm Shunt)
Was measured with standard LPP sketch.
RN2483_in_sleep
Than I loaded the Passthrough sketch an put the RN2483 manually into sleep. The current of the RN2483 went nicely down (~4µA). So as you mentioned above, it’s really about putting the RN2483 into sleep.
The remaining 900µA or in your setup @BoRRoZ 600µA (probably because of lower supply) is probably mainly due to Pulldown Resistors. I think the R11 (10k) and R16 (10k) will contribute with each around 300uA, but I have to check that, to be sure.
Additionally it’s not really nice to have R12 and R13 that low (1k), but it is not that critical, because current (each 3mA) is only drawn during communication.
I will keep you updated.

2 Likes

Thanks,
I tried to wake up the processor by the RN2483, and it works, so we would be able to stop the watchdog to wake up the node every 8 seconds.
yep I didn’t even seen these 1K I2C pullup, what’s these values? :wink: You’re right only on communication.

Another thing I’ve done is to sleep the Light sensor after measuring, datasheet says no problem with that.

I need to arrange code and I will publish as PR of course.

5 Likes

3 x agilent… handy :sunglasses:

tnx for investigating

@BoRRoZ, yes, really handy the agilent DMMs :blush:, but are not mine, belong to the company I work for…

2 Likes

is it allready implemented ? … checking

Yes @johan merged the PR yesterday :wink:

1 Like

CayenneLPP-low

the CayenneLPP example from the things node library 2.0.5.
all sensors on and mcu and radiomodule in sleepmode
that’s a big improvement ! thanks @Charles and @johan
is this right ? I have some doubt now :sunglasses:

button-sleep

all sensors off and wake up after a buttonclick, transmit and back to sleep, this is the lowest current draw possible with this hardware.

(your test appl from yesterday @Charles)

Thanks,

would be interesting to see with these 3 func changed in TheThingsNode.cpp, this setup light sensor to low power just after reading even if it’s enabled and of course wake up device before reading :wink:

void TheThingsNode::configLight(bool enabled)
{
  if (enabled == this->lightEnabled)
  {
    return;
  }

  // Ok be sure to set it to low power mode
  if (!enabled)
  {
    digitalWrite(TTN_LDR_GAIN1, LOW);
    digitalWrite(TTN_LDR_GAIN2, LOW);
    // Just to be sure, see datasheet, at least 1.5ms to enable Low Power
    delay(2);
  }

  this->lightEnabled = enabled;
}

uint16_t TheThingsNode::getLight()
{
  uint16_t value = 0;

  if ( this->lightEnabled)
  {
    switch (this->lightGain)
    {
    case 0:
      digitalWrite(TTN_LDR_GAIN1, LOW);
      digitalWrite(TTN_LDR_GAIN2, LOW);
      break;
    case 1:
      digitalWrite(TTN_LDR_GAIN1, HIGH);
      digitalWrite(TTN_LDR_GAIN2, LOW);
      break;
    case 2:
      digitalWrite(TTN_LDR_GAIN1, LOW);
      digitalWrite(TTN_LDR_GAIN2, HIGH);
      break;
    case 3:
      digitalWrite(TTN_LDR_GAIN1, HIGH);
      digitalWrite(TTN_LDR_GAIN2, HIGH);
      break;
    }
    // Wait to settle
    delay(1);

    // Read value
    value = analogRead(TTN_LDR_INPUT);

    // Go back to sleep mode
    digitalWrite(TTN_LDR_GAIN1, LOW);
    digitalWrite(TTN_LDR_GAIN2, LOW);
    // Just to be sure, see datasheet, at least 1.5ms to enable Low Power
    delay(2);
  }

  return value;
}

tried that, changed TheThingsNode.cpp (v 2.0.5)

compiling CayenneLPP from examples gives this error:

…libraries\TheThingsNode-2.0.5\src/TheThingsNode.cpp:745: undefined reference to `TheThingsNode::configLight(bool, unsigned char)

745 configLight(false, 1);

after disabeling this line it compiles , it joines but the only thing working is the button :sunglasses:

@Charles did I forgot something

without this modification, all is working? strange, need to check this

yes all is working but the CayenneLPP sketch draws 3.8 mA… so that’s one off the sketches from examples users are going to try first.
batteries in… play a bit and forget about the batteries…

can you get all the sensors automatic to sleep in the library after a certain time waking up after shaking or something ? possibly with a setting ?

Well, that’s what I wanted to do (but need to be sure the sensor consumption worth it).

  • The light sensor need 1.5ms to go to sleep and less then 1ms to wake up, so yes, we can put it in sleep mode between reading when sensor is enabled
  • I need to check setup time for temp sensor to see if we can do the same (but in this case will certainly remove the temp alert feature waking up by IRQ) but can be an option.
  • for the motion can’t do real thing, need to be up to wake up on motion, but once again, we need to check datasheet to see if consumption gain on sensors worth it.
1 Like

if you can save 3 more mA … its worth it :sunglasses:

I think this TTN node is mostly used in ‘study situations’, laying around on your desk and not used as a outdoor temp sensor for example.

so taking the batteries out because you don’t have time to play/study for a couple of days, or testing the temp sensor with an 1 hour interval , yes then we can save a lot off battery energy with ‘auto sensor sleep’ in the library

Just one thing, keep in mind these libraries are also used on other ‘none TTN node’ kit too :smile: just saying

ttnlibs

we talk about the dedicated The Things Node Arduino Library … not the ‘universal’ rn2483 TTN lib

1 Like

Now with the updated 1.0.3 version of the microchip firmware and the 2.0.5 version of the ttn node lib nodeLib205
I run the node countinuosly sending a message from the basic sketch every 10 minutes. By logging the messages sent I can see that the reported battery voltage drops about 0.96mV per message (average over 200 messages). It does not drop after each message but lowers in steps of 7 or 8 messages by 6mV. See some log entries below:
{“battery”:3312,“event”:“interval”,“light”:49,“temperature”:23.5}
{“battery”:3312,“event”:“interval”,“light”:50,“temperature”:23.63}
{“battery”:3312,“event”:“interval”,“light”:50,“temperature”:23.69}
{“battery”:3312,“event”:“interval”,“light”:51,“temperature”:23.75}
{“battery”:3312,“event”:“interval”,“light”:43,“temperature”:23.75}
{“battery”:3312,“event”:“interval”,“light”:42,“temperature”:23.69}
{“battery”:3312,“event”:“interval”,“light”:38,“temperature”:23.5}
{“battery”:3312,“event”:“interval”,“light”:34,“temperature”:23.44}
{“battery”:3312,“event”:“interval”,“light”:29,“temperature”:23.38}
{“battery”:3306,“event”:“interval”,“light”:26,“temperature”:23.31}
{“battery”:3312,“event”:“interval”,“light”:24,“temperature”:23.25}
{“battery”:3306,“event”:“interval”,“light”:24,“temperature”:23.19}
{“battery”:3306,“event”:“interval”,“light”:23,“temperature”:23.19}
{“battery”:3306,“event”:“interval”,“light”:24,“temperature”:23.25}
{“battery”:3306,“event”:“interval”,“light”:24,“temperature”:23.25}
{“battery”:3306,“event”:“interval”,“light”:24,“temperature”:23.31}
{“battery”:3306,“event”:“interval”,“light”:24,“temperature”:23.25}
{“battery”:3300,“event”:“interval”,“light”:24,“temperature”:23.31}
{“battery”:3300,“event”:“interval”,“light”:24,“temperature”:23.31}
{“battery”:3300,“event”:“interval”,“light”:24,“temperature”:23.38}
{“battery”:3300,“event”:“interval”,“light”:24,“temperature”:23.38}
{“battery”:3300,“event”:“interval”,“light”:24,“temperature”:23.38}
{“battery”:3300,“event”:“interval”,“light”:24,“temperature”:23.38}
{“battery”:3300,“event”:“interval”,“light”:24,“temperature”:23.44}
{“battery”:3300,“event”:“interval”,“light”:24,“temperature”:23.5}
{“battery”:3300,“event”:“interval”,“light”:24,“temperature”:23.56}
{“battery”:3300,“event”:“interval”,“light”:24,“temperature”:23.56}
{“battery”:3300,“event”:“interval”,“light”:24,“temperature”:23.63}

I will keep it running and see how long it will run with the 3 AAA batteries. I am not sure what the minimum voltage can be until it stops running. We will see…

this sketch and library is not fully optimised yet … it draws in this setup 3.9 mA / h + Tx

Interesting. The LoRaSensorTile with accel, RGBW ambient light sensor, and BME280 pressure, humidity, and temperature uses ~50 uA when updating and logging all the data once minute and sending to LoRaWAN every ten minutes.

Why is the TTN node so much less efficient? Is it one of the sensors?

? how did you calculate that …