HelTecAutomation / CubeCell-Arduino

Heltec CubeCell Series (based on ASR6501, ASR6502 chip) Arduino support.
247 stars 138 forks source link

Lack of Low Power and simple Send/Receive example sketches #20

Closed Stone-Hedge closed 4 years ago

Stone-Hedge commented 4 years ago

Hi,

I can't find any documentation for handling sleep modes. Would it be possible for Heltec to publish some simple example sketches on this topic?

Another issue is that while there is a ping/pong example provided, there is no simple LoRA Send or LoRA Receive sketch in the examples. I believe that a more simple example will be needed by n00bs...

Thanks,

Dan

muzo178 commented 4 years ago

I second the request for simple Lora Send and Lora Receive sketch examples for building simple point to point solutions.

Skipper-is commented 4 years ago

I'd like to know if there is a test method to see what has woken the device, if I'm using both a timer and a GPIO wakeup.

Skipper-is commented 4 years ago

And is there a clock that says how long the device has been on for? I know about millis(), but this resets after a low-power. There is an RTC.h file, which appears to have a good number of functions that could be used here, but I cannot access them..

Heltec-Aaron-Lee commented 4 years ago

here were two sleep and wake up examples:

Stone-Hedge commented 4 years ago

Thanks Aaron. A simple send and receive sketch would be popular too.

Heltec-Aaron-Lee commented 4 years ago

Send and receive example

muzo178 commented 4 years ago

Send and receive example

How can we ping pong between the Cubecell—using this example— and the WiFi LoRa 32 (V2)?

I tried using OLED_LoRa_Receiver.ino example, but it didn’t work?

I gather this is what Stone-Hedge is after as well?

Stone-Hedge commented 4 years ago

Send and receive example

Aaron, this is a great sketch but I think it is too complicated for n00bs and people who are learning the basics. Would it be possible for you to write a very simple and short sketch for send and receive, similar to what was provided for the Heltec OLED Lora V2 boards?

Stone-Hedge commented 4 years ago

Send and receive example

How can we ping pong between the Cubecell—using this example— and the WiFi LoRa 32 (V2)?

I tried using OLED_LoRa_Receiver.ino example, but it didn’t work?

I gather this is what Stone-Hedge is after as well?

Actually, I am having this problem but that isn't why I created this issue thread. I'll create a new issue for that.

Skipper-is commented 4 years ago

Going back to low power, is there a way of seeing total time since switched on (or a time that persists between sleep)? Like a RTC?

Bwooce commented 4 years ago

Hey @Skipper-is check out TimerGetCurrentTime() (returns millis, into a type TimerTime_t). There's also a helpful companion function "TimerTime_t TimerGetElapsedTime( TimerTime_t past )" to calculate differences easily which caters for overflow/wraparound.

I'm yet to use it in real life, but the stack uses it (for duty cycle etc) and it calls RTC functions so I'd assume it has to count correctly. I'll report back later, let me know if you have success.

OstertagM commented 4 years ago

Hey could you make an example how to go into low power with lorawan. How save save sessions keys or counter.

Heltec-Aaron-Lee commented 4 years ago

For the currently examples with LoRaWAN all include low power features. system will automatic into sleep mode when a frame success.

mahesh2000 commented 3 years ago

TimerGetElapsedTime() & TimerGetCurrentTime() examples:

/**
 * Print uint64_t value as Arduino Serial.print does not provide this. Recursive.
 */
void print64(uint64_t value) {
    if ( value >= 10 ) print64(value / 10);    
    Serial.print((uint16_t) (value % 10));
}

uint16_t counter = 0;
TimerTime_t curTime;
TimerTime_t prevTime; 

/**
 * Keep track of time since bootup and time since last invocation
 */
void printTheTime() {
  // TimerGetElapsedTime( TimerTime_t savedTime );
  prevTime = TimerGetElapsedTime( curTime );
  curTime = TimerGetCurrentTime();
  TimerSysTime_t LastTxSysTime = { 0 };
  LastTxSysTime = TimerGetSysTime( );
  Serial.printf("[myLoop] %d do some useful work. time: ", counter++); 
  print64(uint64_t (curTime)); Serial.print(", elapsed since last sleep: ");
  print64(uint64_t (prevTime)); Serial.println("");
}