The Things Node : new low power library development


@BoRRoZ, thanks, yes please, could be great.
Both libs should be ok, waiting TTN team to merge in upstream.


both ?
I only replaced this one >

another thing I want to ask, can you change the topic title, for some its confusing
suggestion ’ The Things Node : new low power library development


sleeping on battery !, CayenneLPP sketch loaded :sunglasses:

(Acht) #172

@Charles Thanks a lot for your work! Also my DMM shows around 35uA during sleep, nice!
But I observed something strange: if I disable the Temperature alert, as in your CayenneLPP example, the temperature is frozen. No change in temperature is visible, also not if I heat it with hot-air.

Freezes, if Alert is OFF:

// No Alert for temperature

Back to normal, if Alert is ON:

// Alert for temperature

The temperature is back to normal and follows, heating/cooling curve.
Can anybody else reproduce this behaviour with his node? @BoRRoZ?


In my ttn node the temp is frozen too…

(LoRaTracker) #174

Which is the sketch that was intially loaded into the node when new ?

Not having much sucess with updated library, I want to go back to the original sketch to check my node.


you know howto install a library because you’ve tested it.
so delete that library and install the original from TTN.
upload a sketch from examples and you’re done.


For the frozen temp() I suspect (even if not explicitly written in datasheet) that we need to wait at least for One sample before reading temp value. I changed the wakeTemperature() as follow

void TheThingsNode::wakeTemperature()
  if (!this->temperatureSleep)


  // If was in powerdown mode, let time to convert temperature
  if (!this->temperatureEnabled) 
    // See datasheet 5.2.4 (added 5ms each for security)
    uint8_t dly[4] = { 35, 70, 135, 255};
    delay( dly[TTN_TEMPERATURE_SENSOR.getResolution()]);

  this->temperatureSleep = false;

Repo is updated

(LoRaTracker) #177

So which of the sketches is the one that ships with the new nodes ?


Unfortunately I cannot test… today I brought the sensor to my Basle house to monitor temperature there. Bad luck…
Are you aware of this github library hackscribble/hackscribble-MCP9804-library
in its doc it has some information on usage e.g.
The temperature reading from the MCP9804 will not change in shutdown mode, even if the ambient temperature changes.

So to read a valid temp value, the sensor must be in continuous mode

p.s. just saw that you enhanced your code.


You have to follow the quick start guide… . first sketch to load is the one to get the device info to be able to register your app and device…and then one of the examples where you have to add your keys… everything is written in the fool proof quick start…

(Gianluigi) #180

Thanks for the work of this team, really interesting.
In order to test this solution, I’m wondering if I need to update both the original TheThingsNode and TheThingsNetwork with your version arduino-node-lib and arduino-device-lib or only the first one.
In relation to your calculation about the battery consumption, I think that if you have one battery with X energy (mAh) with 2 batteries you get 2X energy, independently from the voltage or the circuit connection (serial or parallel).


no, thats not true… see

(Acht) #182

@Charles I did a first quick test with your updated Library, it looks like it’s working now as expected! Temperature behaves normally and sleep current is down to around 35uA. Good job!

(LoRaTracker) #183

I will comment to my own post to avoid confusion, I hope it is allowed to remain, I note that quite a few posts have been purged from this thread.

It occured to me when I got my node that there would have to be a fuctional check of the nodes of some form before they were shipped. So out of curiousity I checked what was coming out of the USB\Serial port of my ‘new’ node.

This was coming out (@115200 baud);

Battery: 3273
AppEui: 0000000000000000
DevEui: *********************
Band: 868
Data Rate: 7
RX Delay 1: 1000
RX Delay 2: 2000
Total Airtime: 0.00 s
Light: 31
Temperature: 9.50 C
Temperature alert: disabled
Moving: No
Button pressed: No
Color: Blue
USB connected: Yes
Battery voltage: 4716 MV
Sending: mac tx uncnf 3 *********************
Response is not OK: no_free_ch
Send command failed

And once I had the EUI and the node was within reach of a Gateway, it did indeed show up on the map, no need to load the info sketch or any other sketch.

Hence my question as to where to find the sketch that produces the above printout …

(Gianluigi) #184

In my opinion the energy related with a battery is obtained by multiply the electric charge Q(mAh) with the voltage V (V). (
So if we have a battery with 1000mAH and a voltage of 1.5V we get an energy of 15 Wh that for example could supply a load of 15 W for an hour.
Then if we take two of these batteries we get 30 Wh energy, that could supply the same load for two hours.



in the things node there are 3 batteries in series… increasing the voltage


will check again later today … any influence on the sleepcurrent expected ?

@ LoraTracker … that factory loaded sketch couldn’t be saved and as far as I know was/is not available / neccessary


Nop, just temperature fix


One way to think about it is that the energy in a battery is the Ah rating multipled by the voltage.

When the batteries are put in series, the voltage changes (doubles)., but the Ah rating does not.
i.e. the energy that can be supplied is doubled (same Ah but twice the voltage).
This means more power can be transferred for the same current flow.

When you say “supply the same load for 2 hours”, you have to consider that if you keep the load the same, the current will double if you double the voltage