I have tried with a 10k resistor from reset to VDD, but does not seem to do anything.
I have also measured the sleep current of the arduino, whic is 2.8uA at 3.2V supply, directly from the batteries, without regulator or power diode. and in idle mode (delay) it is about 4.8mA which seem correct,
Futher more i have tried to only send the sleep command without putting the arduino to sleep like this.
void loop() {
ttn.wake(); // wake the RN module from sleep, if it is still sleeping
delay(5000);
ttn.sleep(5000); //sleep RN module in [ms]
delay(5000);
}
This only seem to lower the current from 27.6 to 25.4mA
Also if i try to reset the module in the loop, with a large delay in between, the current drops to 5.6mA
void loop() {
ttn.wake(); // wake the RN module from sleep, if it is still sleeping
delay(5000);
digitalWrite(12, LOW);
delay(5000);
digitalWrite(12, HIGH);
ttn.sleep(5000); //sleep RN module in [ms]
delay(5000);
}
Anyone have any ideas?, How do TTN.sleep function work?
As i said earlier, the MCuy only pulls 5mA when active. so that is not the problem here.
I Also tried putting the MCu and the rn2483 module to sleep, this result in a 22mA current draw, which is 1000x higher than it should be, and what others are reporting.
Perhaps ttn.sleep(5000); isn’t actually doing anything. Can you make it sleep for a long time (say 30 minutes) and then try talking to the RN2483. It clearly shouldn’t reply. If it does then clearly it isn’t asleep
Your numbers do not stack up. There is no way the Trinket draws only 5mA without some form of power management. Given the code shown in the previous post, 22mA is reasonable.
The datasheet for the 328p say 5.2mA at 5V 8MHZ in active mode, so it seem legit.
My Pro trinklet runs at 3.2V but at 12MHz. I have removed the regulator from the board together with the power led.
I had a similar issue using a wemos D1 mini with a RN2903. Turned out that when I went into deep sleep , the pin I was using for uart tx (pin 15) when high which caused the RN2903 to wake up so the D1 mini was sleeping but the RN2903 was awake. I ended up using a different pin 0 for tx.
In my case it was about 3ma of current being drawn by the RN2903. Once I changed the Tx pin I was under 1 ma. But the battery still died after a few weeks so I ended up using a TPL5110 to control power. My sensor wakes every 90 minutes for a reading.
The software serial pins is draining the current here. Many years ago, I would put the pins as output with internal pull up before sleep. Recently when I used the AltSoftSerial instead of SoftwareSerial, only an end() is enough to put the pins into proper low power state. Just need to call begin() once awake.
I have now tried several of your solutions. but ended up building a new node. with another set of parts.
Same setup as described earlier, but new parts.
The idle current is now only 8mA, and sleep is 4uA, which is where i wanted it.
So i guess there is something wrong with the first rn2483 module, since it is consuming 22mA in idle, the new one only consume 2.6mA in idle, as the datasheet confirms it should.
Maybe i find the error some day.
To test power sleep functionality i only used this code
#include <SoftwareSerial.h>
#include <TheThingsNetwork.h>
#include <OneWire.h>
#include <LowPower.h>
#define loraSerial SoftSerial
#define debugSerial Serial
// Replace REPLACE_ME with TTN_FP_EU868 or TTN_FP_US915
#define freqPlan TTN_FP_EU868
#define SpreadingFactor 7
SoftwareSerial SoftSerial(10, 11); // RX, TX
TheThingsNetwork ttn(loraSerial, debugSerial, freqPlan, SpreadingFactor);
void setup() {
loraSerial.begin(19200);
debugSerial.begin(9600);
//Restart the RN2483 module
pinMode(12, OUTPUT);
digitalWrite(12, LOW);
delay(500);
digitalWrite(12, HIGH);
ttn.reset();
ttn.showStatus();
}
void loop() {
ttn.wake(); // wake the RN module from sleep, if it is still sleeping
delay(5000);
ttn.sleep(9000); //sleep RN module in [ms]
delay(1000);
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
}
Rest is connected to pin 12, and is pulled up py a 10k resistor.
Of cause this is only the power down test. my final code is different, and still a work in progress.