Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #4659
    StefanA
    Participant

    I bought a mini ultra 16mhz board from you and I want to use it together with the Low Power library. But I have some trouble understanding how the library works.

    My aim is to build a wireless solar/battery powerd light sensor. I want the MCU to use as little power as possible and periodically take readings via an I2C sensor and transmit the values though a radio module connected to the serial port.

    I been looking at the example code of the library and done some simple tests but I can’t get it to work properly. I hope now I could get some advice here.

    #4661
    Dean
    Participant

    I am having similar problems.

    #4664
    LIM PHANG MOH
    Keymaster

    Hi StefanA & Dean,
    Best place to start is the powerDownWakePeriodic example.

    Can you guys post your code here?

    #4666
    Dean
    Participant

    I’m really confused now. In a previous post you said that the only mode currently supported is the standby() function. The powerDownWakePeriodic example uses: LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

    which I believe you said won’t work the mini ultra?

    #4667
    Dean
    Participant

    So I deleted the Low-Power-master folder and put it back in the Arduino libraries folder. It now compiles with standby().

    However, it is not clear how you use the standby() function…how do I get it out of standby?

    I was originally planning to do something like this:

    // Put the Beecvr to sleep. Enters the RSUltra into sleep mode.
    void gotoSleep (uint8_t dur) {
    uint16_t counter = 0;
    uint16_t sleepCount;

    // put the Beecounter to sleep
    digitalWrite(pwrPin, LOW); // cut power to the Beecounter
    digitalWrite(ploadPin, LOW); // as well as the pload pin on the Beecounter

    // put the XBee to sleep
    pinMode(xbee_sleeprq_pin, INPUT); // use internal pullup to pull pin to 3.3V

    // put the RSUltra to sleep
    sleepCount = hourWDTinterval * dur;
    while(counter < sleepCount) {
    // enter powerDown mode
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

    // iterate the counter
    counter++;
    }
    wakeup();
    }

    #4668
    StefanA
    Participant

    I have done some progress. I inserted a serial flush() in my code and now the serial print command seems to work as it should.

    If I put the LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); function in a for loop. Will the sleep time increase times the number of loops?

    #4669
    Dean
    Participant

    My sketch won’t compile using LowPower.powerDown. The response I got from RocketScream was this was not supported on the Ultra Mini. Apparently the only power saving mode supported is standby()…which does compile. However, it is not clear to me how to use this function.

    It would be great if RS provided some code on specifically how to put the Ultra Mini asleep for a period of time and then wake it up.

    #4670
    LIM PHANG MOH
    Keymaster

    I’m really confused now. In a previous post you said that the only mode currently supported is the standby() function. The powerDownWakePeriodic example uses: LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

    which I believe you said won’t work the mini ultra?

    I’m sorry because I thought you were referring to the normal AVR based MCU in this particular thread.
    I will answer your question in your original thread.

    I have done some progress. I inserted a serial flush() in my code and now the serial print command seems to work as it should.

    Yes, you need to use Serial.flush() to ensure all characters are transmitted out before the device go into sleep which will power down the serial interface. Some people use delay(), but Serial.flush() is the correct way to do it.

    If I put the LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); function in a for loop. Will the sleep time increase times the number of loops?

    You can do something like this:

    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
    if (sleepCounter++ >= SLEEP_DURATION)
    {
      // Do your sensor acquisition, data logging, data transmission, etc here
      // Reset the sleep counter
      sleepCounter = 0;
    }

    Declare the sleepCounter variable using appropriate variable type that can hold the maximum value you intended. The constant SLEEP_DURATION is the sleep duration of you wanted in order to achieve (SLEEP_DURATION x 8 s).

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.