-
AuthorPosts
-
June 6, 2016 at 9:52 PM #4659StefanAParticipant
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.
June 7, 2016 at 1:16 AM #4661DeanParticipantI am having similar problems.
June 8, 2016 at 8:50 PM #4664LIM PHANG MOHKeymasterHi StefanA & Dean,
Best place to start is the powerDownWakePeriodic example.Can you guys post your code here?
June 8, 2016 at 11:20 PM #4666DeanParticipantI’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?
June 8, 2016 at 11:43 PM #4667DeanParticipantSo 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();
}June 9, 2016 at 1:59 AM #4668StefanAParticipantI 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?
June 9, 2016 at 2:37 PM #4669DeanParticipantMy 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.
June 9, 2016 at 3:21 PM #4670LIM PHANG MOHKeymasterI’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).
-
AuthorPosts
- You must be logged in to reply to this topic.