Forum Replies Created
-
AuthorPosts
-
LIM PHANG MOHKeymaster
Hi,
First check, are both USB connected to a PC with a terminal open?
while (!Serial) ; // Wait for serial port to be available
This will wait for the serial port (in this case USB) to open before running the remaining of the codes. With the default radio configuration, it will even run without antenna for few meters.
- This reply was modified 7 years, 5 months ago by LIM PHANG MOH.
LIM PHANG MOHKeymasterI would definitely suggest using some sealant/epoxy to tighten everything up on holes that you drill on the enclosure.
And it’s best to orient the holes facing downwards although you might have already seal them.
The amount of heat that we get here in tropical area is crazy close to 50 Degree Celsius inside the enclosure based on our past experience. 25-30 Degree Celsius is really a very accommodating range. Below 0 Degree Celsius, I doubt that the Li-Ion would charge effectively although it can still be used to power still down to -20 Degree Celsius.Also if possible, do add some desiccant packs, it really helps.
LIM PHANG MOHKeymasterGlad that it work.
LIM PHANG MOHKeymasterCan you give me a link to Ver.1.50 or above?
You can install from the Arduino IDE library manager itself.
But, if you want to install it manually, here you go.LIM PHANG MOHKeymasterVersion:1.40
This is the root cause. Please use version 1.50 and above. It’s a compiler optimization issue which causes the BOD to be enabled without you noticing it.
for(byte pin = 0; pin<22; pin++)
{
pinMode(pin,OUTPUT);
digitalWrite(pin,LOW);
}You don’t have to.
LIM PHANG MOHKeymasterWith WDT enabled, it would add around 4 uA on top of the 0.1 uA of the chip in power down.
So, there’s some stuff still sucking some current somewhere in your setup. I just tested my Mini Utra 8 MHz and it is 1.7 uA (on-board regulator consume 1.6 uA) in power down. Turning on the WDT of 8 s results in 6.0 uA which is spot on with the values from the datasheet.
Using Arduino IDE 1.6.8. Meter has a 0.1uA resolution. Running at 5V & 3.3V shouldn’t be that far off.The regulator totally removed from the board?
LIM PHANG MOHKeymasterA multimeter has a very slow refresh rate compare to what is being captured actually. If you use a small resistor and measure the voltage across it at the input supply and use an oscilloscope, you might see the timing more accurately.
Are you using the latest version of the library? I asked because if you are not, the previous version might not compile correctly on the latest Arduino IDE 1.6.x branch due to the compiler optimization. The BOD will not be turned off although the code says so due to this optimization. BOD has strict timing in terms of instruction cycle to turn it off. Too fast or too fast will not get it to turn on/off accordingly. Your 28 uA is giving me that impression.
Other than that, just make sure all pins are output low.
And, what multimeter are you using and what is the resolution of the DC uA range?
LIM PHANG MOHKeymasterHi,
It should be due to this:for (i = 0; i < wdtCounter; i++)
But, how long does this duration of the spike? In any case, it should not be even noticeable, as that line of code execute is few us.
To even improve your code, if your maximum argument does not exceed 255 (unsigned char), then use unsigned char as your argument. Using the int variable would mean using 16-bit signed variable. The comparison that take place in the loop when converted into machine code will yield different results. And if you can, do a count down instead of count up implementation. That way, in the machine code, it only need to do a compare zero routine which the AVR core has a single instruction to do just that.And regarding the amount of 0.028mA, is there anything else connected? Even wires that leads to nowhere?
LIM PHANG MOHKeymasterHi Dean,
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(); }Okay, that code will only work with AVR based Arduino. You can either use the :
- LowPower library together with an external RTC module to wake up perioidcally through attachInterrupt().
- RTCZero library without LowPower library (the RTCZero library has a simple function to put into standby mode). The built-in RTC in the Mini Ultra Pro board can be used to wake up the processor with any desired period of time as it has calendar support. You can try to work from this example.
Please let me know if you have any questions.
I’m sorry if the response was slow for the past few days, I was away on an emergency.
- This reply was modified 7 years, 10 months ago by LIM PHANG MOH.
LIM 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).
LIM PHANG MOHKeymasterHi Dean,
Looks like either your library is not installed properly or missing.
Please post your code here using the code tags.LIM PHANG MOHKeymasterHi StefanA & Dean,
Best place to start is the powerDownWakePeriodic example.Can you guys post your code here?
LIM PHANG MOHKeymasterHi Dean,
On Arduino Zero, only the standby function is currently supported.
But, you can use the RTC (using the RTCZero library) functionality to wake the processor up to any period of time according to your need but in seconds resolution.LIM PHANG MOHKeymasterThere seems to be same definition used in the MyHwATMega328.h which is also defined in LowPower.h.
I’m not familiar with mysensors, but if you can change that enum naming in MyHwATMega328.h file into something else, that would solve the problem.LIM PHANG MOHKeymasterRalf,
It seems that extended standby is not supported on the ATmega168. I must have been referring to the avrlibc distribution instead of the datasheet while writing the library. Will do a patch to restrict the usage only to the chips having the extended standby mode support. For now, refrain from using that mode.
-
AuthorPosts