The Things Node : new low power library development


You have to update both libraries because the functions called by the CayenneLPP sketch in the node library are contained in the device library

(Gianluigi) #190

It may be that I don’t understand well the post of Hanspeter, because what was termed energy (VAh) is instead capacity (Ah).
The reasoning of Hanspeter is correct, because he compares only the capacity (Ah) and the current (A).

(LoRaTracker) #191

That sketch would (or appeared to at least) to go into sleep mode without first establishing a connection to a gateway, it would wake up and send a message when it was shaken etc.

The nearest gateway to me is over 5km away, and I dont stand a chance of connecting to it with the node sat on the bench whereupon I can measure the sleep current, the node needs to be outside on a mast.

So are there any sketches whereby the node will go into sleep mode without making the initial first connection ?


Maybe would have been better to use the term “Electrical storage capacity” instead of “Energy” The term capacity alone means something in F or uF for capacitors


Nodes never connect to a gateway, they just send hoping one or several gateways receive their data…

(Gianluigi) #194

Yes, it could.
The important things for me is to have understand that your battery duration evaluation works.
Anyway wikipedia report:
A battery’s capacity is the amount of electric charge it can deliver at the rated voltage


If my own gateway is off I am not able to join the network over another gateway So you’re not alone in this.
closests GW is 3 km from here and also not reachable when laying on my desk, ( when I move to the other side off the house and under certain weather conditions it will)

these are the available TTN sketches


After first boot go to sleep and then join the network only after shaking, I haven’t seen, but I think now, with the new CH2I lib, it could be done.
Maybe its time to revive TTN NODE central with coding tips and tricks ?


quite off topic I know.

The problem of the “energy stored on a capacitor” is a classic one because it has some counterintuitive elements. To be sure, the battery puts out energy QVb in the process of charging the capacitor to equilibrium at battery voltage Vb. But half of that energy is dissipated in heat in the resistance of the charging pathway, and only QVb/2 is finally stored on the capacitor at equilibrium. The counter-intuitive part starts when you say "That’s too much loss to tolerate. I’m just going to lower the resistance of the charging pathway so I will get more energy on the capacitor." This doesn’t work, because the energy loss rate in the resistance I2R increases dramatically, even though you do charge the capacitor more rapidly. It’s not at all intuitive in this exponential charging process that you will still lose half the energy into heat, so this classic problem becomes an excellent example of the value of calculus and the integral as an engineering tool.

if you proceed further with this problem by making the charging resistance so small that the initial charging current is extremely high, a sizable fraction of the charging energy is actually radiated away as electromagnetic energy. This crosses the threshold into antenna theory because not all the loss in charging was thermodynamic - but still the loss in the process was half the energy supplied by the battery in charging the capacitor.

So the energy supplied by the battery is E = CVb2, but only half that is on the capacitor - the other half has been lost to heat, or in the extremely low charging resistance case, to heat and electromagnetic energy.

One thing about the Ah rating of a battery though. It is defined as
"The rated capacity of a battery is usually expressed as the product of 20 hours multiplied by the current that a new battery can consistently supply for 20 hours at 68 °F (20 °C), while remaining above a specified terminal voltage per cell."
So, if you can use something like a joule thief circuit, you can get more than the rated capacity

(LoRaTracker) #197

I have tried CayenneLPP and that just keeps attempting to join;

_Sending: mac join otaa _
Response is not OK: no_free_ch
Send join command failed

Current consumption is stuck at 15mA, so I guess until it suceeds in its intial join attempt it wont go to sleep.


I think you’re right… and by design.
Maybe change that sketch a bit that after x attempts it goes to sleep and tries again later…


Slightly reworded and recalculated but still an estimate for the ttn cayenneLPP sketch on the ttn node with all sensors active and sending one 42byte message per hour:
AAA batteries have an electric charge stored of about 1150mAH. 3 Batteries in series have 4.5V but still an electric charge of 1150mAH which is 3600 x 1150 = 4140000 mAsec. The node running over N hours draws N times ((3600sec x 0.035mA) + (3sec x 14mA)) = 168mAs (sending one 42 bytes payload message/hour). Dividing available charge by charge used/hour i.e. 4140000mAs / 168 mAs = 24600 hours or about 1026 days or about 33 month. This calculation assumes the node to be running until batteries are empty which is not the case, so practical usage time may be about half of above. Just an estimate…
@CurlyWurly states that the lifetime might be much longer until the voltage drops below a usable level, but its depending on battery type and the price/quality and the brand of course. So it might last even 2 years or longer, who knows…

(LoRaTracker) #200

For alkaline batteries best to use an average voltage of 1.2V, as they are down to that voltage before they are half gone. If you just use the mAhr figure to calculate battery life and dont convert to watts, you dont need to worry about that.

By far the best batteries for use in nodes of this type are the energizer lithiums, the voltage is stable to around 1.45v till they are almost dead, and they are good down to -40C or so.

At -20C an alkaline is down to around 10% capacity, the energizer lithiums keep almost 100% capacity at -40C


@LoRaTracker Thanks for the additional info…


Not true! Look at graph, please update your statement


For more information about battery indicated and real capacity, you can check this website:

and particularly this page: (comparator for AAA and AA battery).

Each battery has very detailed information. Example for Energyzer lithium:

(LoRaTracker) #204

A modified CayenneLPP sketch to force it to go to sleep if the intial connect attempt fails has a sleep current of 45uA.

Measured with a EEVblog uCurrent Gold and Fluke 87V.


sure the rn2483 is back to sleep to ?


Estimates are always true… but it may be a bad estimete of course


Hi there,

Just pushed new version of the 2 libs,

  • code optimization, win approx 700bytes of flash. This let us some space because CayenneLPP sketch was full.
  • fixed debouncing button while on USB with no sleep
  • no sleep mode by default when on USB (asked by @BoRRoZ)

To be done

  • sleep on failed join (not so easy, also need to check if module can auto join on transmit)
  • do not send when node is always moving to avoid LoRa Duty cycle restriction

Thanks all for being my favorites testers


your welcome :rofl: