RFM69 RX switching OFF

I have an RFM69 connected to an 8Mhz 328 all working fine on 3.3v, RFM69.h library. The RFM69 receives a pulse every 30seconds from a master clock and this pulse is used a reference sync pulse for driving a wall clock.
This is to be a battery application so leaving the RFM69 in Rx mode whilst sleeping is taking too much current.
What I would like to do is turn off the RFM69 for say 28seconds, wake it up and wait for the pulse to come in , then sleep again for the next 28seconds until its time to seek the next pulse. I'm happy sleeping the 328 processor but...

I cant find anything other than sleeping transmitters or sleeping receivers left in Rx mode. Anyideas ?

Basic Rx code below for info:







//RFM69_lopower 328 pulse rcv v0.2
//sleep to be added


// references:
// Uses the RFM69 library by Felix Rusu, LowPowerLab.com
// Original library: https://www.github.com/lowpowerlab/rfm69
// SparkFun repository: https://github.com/sparkfun/RFM69HCW_Breakout

#include <RFM69.h>
#include <SPI.h>
#include <Wire.h>

// Addresses for this node. 
#define NETWORKID     0   
#define MYNODEID    5   // My node ID
#define TONODEID      1   // Destination node ID (pulse transmitter)
#define FREQUENCY     RF69_915MHZ

// AES encryption (or not):
#define ENCRYPT       true // Set to "true" to use encryption
#define ENCRYPTKEY    "TOPSECRETPASSWRD" // Use the same 16-byte key on all nodes

// Use ACKnowledge when sending messages (or not):
#define USEACK        true // Request ACKs or not

// Packet sent/received indicator LED (optional):
#define LED          A5 // LED pin

// Create a library object for our RFM69HCW module:
RFM69 radio;

//******************************************
void setup()
{
  // Set up the indicator LED 
  pinMode(LED, OUTPUT);
  digitalWrite(LED, LOW); //test it
  delay(800);
  digitalWrite(LED, HIGH);

  // Initialize the RFM69HCW:
  radio.initialize(FREQUENCY, MYNODEID, NETWORKID);
  // Turn on encryption
  if (ENCRYPT)
    radio.encrypt(ENCRYPTKEY);
}//*****************************************

void Blink(byte PIN, int DELAY_MS)
//Blink an LED for a given number of ms
{
  digitalWrite(PIN, LOW);
  delay(DELAY_MS);
  digitalWrite(PIN, HIGH);
}
//******************************************
void loop()
{
  //  see if it has received any packets:
  if (radio.receiveDone()) // Got one!
  {
    if (radio.DATA[1] == 80) //P  pulse rec'd
    {
      Blink(LED, 300);
      radio.DATA[0] = 0;// clear out buffer (dunno if needed)
      radio.DATA[1] = 0;
      radio.DATA[2] = 0;
    }
    
    if (radio.ACKRequested())
    {
      radio.sendACK();
    }
 
 //Sleepy(); **put stuff to sleep**
  }
}

Is just turning off the RFM69 totally an option? Like if it was powered by a switched transistor on an i/o pin?

a7

Whats the problem with the sleep command for that library ?

radio.sleep();

I think the issue with this is you leave in RX mode , which still takes current, and allows wake up from sleep on receiving a packet ??? Putting completely to sleep ( like you can do in TX mode? ) And waking up again under software control is what I need ( can this be done by say by toggling reset ?) to really get the current consumption really low .

This is the bit I’m unsure about and need some advice

Turning off via a transistor is an option .. anyone done it ?

That puts the entire module into a circa 1uA sleep mode, or should do.

:+1:How do you wake it up again ?

Use the radio.initialize(FREQUENCY, MYNODEID, NETWORKID);
command perhaps ?

I’ll give it a try and report back ( not today tho!) .
Thx .

Well , here is the Code I've tried and it works -no need to wake up the RFM69 seperately with initialize command ... .
when sleeping I have around 12micro amps @3.3v.

  • it takes current during the while loop each time it wakes, but my meter can't see it.
    ( havent checked if my RFM69 has flash on it yet)
    thx srnet .
  • might be better with the radio sleep inside the loop :wink:
void Sleepy()
{
 // here after a pulse has been rec'd and sleep until next is due. 
//pulses are every 30sec, sleep for 28sec.
// sleep the 328, the radio , and flash memory on the radio chip (if fitted)
int X=0;
 radio.sleep();
// Enter power down state 328 for 8 s with ADC and BOD module disabled
    while(X <6)
    {
    LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_OFF); 
    X++;
    }

}

There is an assumption that the RFM69 register contents are reatined during sleep mode, although the datasheet does not seem specific on the topic.

So for reliability it might be an idea to use the radio.initialize(); when waking up from sleep.

agree... it certainly can't hurt to do so

Edit: spoke to soon - doesn't like that statement Radio stops working after the first run through this loop

void Sleepy()
{
  // here after a pulse has been rec'd and sleep until next is due.
  //pulses are every 30sec, sleep for 28sec.
  // sleep the 328, the radio , and eeprom on the radio chip (if fitted)
  int X = 0;
  //radio.sleep();
  // Enter power down state 328 for 8 s with ADC and BOD module disabled
  while (X < 6)
  {
    radio.sleep();
    LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_OFF);
    X++;

  }
 
  radio.initialize(FREQUENCY, MYNODEID, NETWORKID);
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.