LowPowerLab Forum

Hardware support => General topics => Topic started by: darkcurrent on July 14, 2015, 03:44:08 PM

Title: WeatherShield sleep/power down - garbled serial [SOLVED]
Post by: darkcurrent on July 14, 2015, 03:44:08 PM
Hi all,
I have connected a WeatherShield board to a Moteino R4. To save battery, I would like to put the Moteino in power down mode using this code:  LowPower.powerDown(SLEEP_1S,ADC_OFF, BOD_OFF).
My problem is the following: once getting out of power down, data received by the serial terminal contain strange characters... I do not meet this problem if I keep the Moteino powered on, sampling Temp, RH and pressure every second.
Is there something particular about the use of WeatherShield board when putting the Moteino in sleep mode or power down mode ?

Thank you for your help!
Title: Re: WeatherShield and power down
Post by: Felix on July 14, 2015, 03:56:06 PM
You probably need to Serial.flush() before you go to sleep (and after perhaps). Try that and see if it fixes the issue.
There are examples that go into sleep and also read data from the WeatherShield: here is one (https://github.com/LowPowerLab/MailboxNotifier/blob/master/MailboxNotifier4_sender_withWeatherShield.ino).
Title: Re: WeatherShield and power down
Post by: TomWS on July 14, 2015, 04:03:38 PM
Quote from: Felix on July 14, 2015, 03:56:06 PM
You probably need to Serial.flush() before you go to sleep (and after perhaps). Try that and see if it fixes the issue.
There are examples that go into sleep and also read data from the WeatherShield: here is one (https://github.com/LowPowerLab/MailboxNotifier/blob/master/MailboxNotifier4_sender_withWeatherShield.ino).
I agree with Felix, definitely Serial.flush() before sleep, but if you also use Serial read, then do a Serial.flush() after waking as well.  This will eliminate any input garbage that 'collected' while sleeping...

Tom
Title: Re: WeatherShield and power down
Post by: darkcurrent on July 15, 2015, 04:51:46 PM
Following your advices, I added a Serial.flush() before setting the Moteino in sleep mode. It now works without problem!

Thanks to both of you! :)