The Things Node : new low power library development

Mine is that the node does not deliver the time the button is pressed

What do you mean. a delay?
Did you tried the code above, when I push the button, data are received in the second on TTN dashboard.

For quick reference on this post I added the schematics direct link on the 1st topic
schematic

Ok guys,

Anyone interested how to change this 3.2mA sleep mode to 280µA?

You won’t believe it, when you call sleep of the TheThingsNode library, the lib is not setting the RN2483 for sleeping, I changed that in the code and now sleep consumption is about 280µA, not the best we can do but far much better and usuable

I changed sendData() of the above sketch. You can’t do it in wake() or sleep() because wake and sleep are called on each watchdog wake (every 8s) and it would enable/disable the module each 8s. So the most efficient way, is to wake the module before send, and set it to sleep after send.

void sendData(uint8_t port)
{
  // Wake RN2483 
  ttn.wake();

  // Read battery voltage
  uint16_t vbat = node->getBattery();

  debugSerial.print(F("Battery:\t"));  debugSerial.print(vbat);  debugSerial.println(F("mV"));

  // Just send battery voltage
  lpp.reset();
  lpp.addAnalogInput(4, vbat/1000.0);
  ttn.sendBytes(lpp.getBuffer(), lpp.getSize(), port);

  // Set RN2483 to sleep mode
  ttn.sleep(300000);
  // This delay is not optional, try to remove it
  // and say bye bye to your RN2483 sleep mode
  delay(50);
}

I’ll do a PR of the lib, I think I can do some optimization in terms of low power.

10 Likes

great @Charles

i’ll try tomorrow, also I didn’t understand why didn’t they put the rn2483 in sleepmode and let it wake up the processor (like in the rocketscream node you have to)
maybe that can be done with one wire and a little software tweak, maybe even without a wire

Thnaks, Exactly what I wanted to do, sleep RN2483 and then RN2483 wake the 32U4 but I don’t know how it is possible? Would be great is RN2483 as a pin change on wake up (that we could put to an 32U4 I/O to wake it up) this would avoid us stupid watchdog wake every 8S :wink:

2 Likes

when the RN wakes up it always sends ok first so if you connect TX to the interrupt pin of the mcu

hey hey, TX of RN2483 is connected to RX1 of 32U4, I think I just need to set the interrupt on this pin, having played with 328P interrupts for I while, it should be possible, let me finish my pull request before :wink:

2 Likes

max 49 days without waking up the mcu every 8 seconds :sunglasses:

GitHub - GreyGnome/EnableInterrupt: New Arduino interrupt library, designed for Arduino Uno/Mega 2560/Leonardo/Due

I’ve made a pull request for fix in the library, until merged, check the fixed version here

I’ve also created a new example to monitor node battery on mydevices

Next step, optimize sleep mode get get less consumption

2 Likes

Sorry for the confusion. The button release function in the original coude should provide the duration that the button was pressed. It now alwas says “0”. It seems as if the rise or fall is not detected correctly in processing the interrupt.

PS. I just read your comment on Github about this issue.

// If button pressed, send press duration
// please myDeviceCayenne add counter value type to
// avoid us using analog values to send counters

yep :rofl:

dci-ttnnode

congrats to @Charles… you nailed it !

2 Likes

Thansk @BoRRoZ but still too much for me, got some other ideas, if you have time to help for measurement I’m your man, I’ll take care of Low Power Code optimization

What about trying with sensors enabled? Would you mind trying CayenneLPP.ino just to see?

2 Likes

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