Pages: [1]   Go Down
Author Topic: Advice? - Making Arduino Uno "sleep" & "wake up"  (Read 4955 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I am trying to make a small outdoor project in which an arduino uno runs on battery power (3.7v 270 mAh), and that it collects temperature data for 5 minutes, then goes to "sleep" for 30 min, "wakes up", collects temp data for 5 minutes, and then goes back to sleep for 30 min, etc etc...

I think that for this I need a real-time clock (RTC) that is capable of having an "alarm". I had already purchased a DS1307 but I am not sure if this would allow me to make the arduino sleep & wake up.

Anyone has any suggestions?

Thank you!!!!
Logged

Oz
Offline Offline
God Member
*****
Karma: 5
Posts: 748
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Capo.

Alas I think that won't work the way you want.

Alas the RTC is only that.  It keeps time.

What you may need to do is - and I am REALLY GUESSING here - is see if you can put the arduino into a sleep mode and set one of the pins as an interupt input.

When this pin is stimulated, it wakes up, does what you want and goes to sleep again.

That would require an external circuit timing and sending a pulse every 30 minutes.

Alas:  I fear that the external circuit doing this may take more power than is saved with the arduino in sleep mode.

As you may see, I too am new so may be way off, but using the RTC won't work to do what you want.

Good luck though!

Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 95
Posts: 4084
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

A DS1307 can be configured to output a 1Hz square wave that could be used to generate an interrupt that would wake the microcontroller from sleep mode.

That sounds like it's a ways off from the 30-minute requirement, but it can work quite well by simply counting the wake-ups, and when 30 minutes (1800 wake-ups) have elapsed, take the measurements. Else it just increments the counter and goes right back to sleep. This can happen fast enough that the current used by the microcontroller waking up every second is negligible.

Actually a similar result can be achieved without an external RTC by using one of the MCU's internal timers or the watchdog to generate an interrupt. Accuracy in this case is dependent on the accuracy of the MCU's system clock, which often will not be as accurate as an external RTC, but still can be good enough for many applications.

So this can all work very well indeed, but there is a major problem when using a Uno for this kind of project.

The ATmega328P microcontroller is not the only thing on the Uno board that draws current. In fact, the other stuff on the board draws more current than the MCU and continues to do so even if the MCU is sleeping! The MCU itself will draw 11 or 12mA when running, and in the deepest sleep mode, less than 1µA, which for most practical purposes can be considered to be zero. I measured the current drawn by an Uno at about 42mA with the MCU running, and about 31mA with the MCU in power-down sleep mode.

This is one reason why Arduinos are called "prototyping platforms". The solution to this particular problem is to design a circuit that consists of a microcontroller and only whatever other circuitry is required to do the job.

Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

0
Offline Offline
Newbie
*
Karma: 0
Posts: 6
I love YaBB 1G - SP1!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I recently put together a simple sleep library that does exactly what this poster is looking for. You can find it here:

https://github.com/n0m1/Sleep_n0m1

In this library you can set how long the arduino sleeps for by calling the function sleepDelay(milliseconds of sleep). It works pretty much the same as the delay() function but it sleeps the arduino for that time. It works using the watchdog timer so you can even use it in full power down mode. It includes a few examples to get your started. I hope this helps someone out there! Goodluck!
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A DS3231 might be what you want. It's an RTC as the DS1307 but has a programmable alarm which then triggers an INT pin which can wake up the Arduino.

You might wanna give the Seeeduino Stalker (V2.1, http://www.seeedstudio.com/wiki/Seeeduino_Stalker_v2.1) a try. It includes an Arduino trimmed for power saving (Atmega 328p running on 8MHz) with a DS3231 (for sleeping/wakeup as well as RTC), an microSD card socket (logging) and a XBEE socket (wireless communication). Everything to control a solar panel and a LiPo battery is also included. A water proof case is also available. I use one of these myself and the only thing you have to change is that you need a USB2Serial adapter to upload your code.
« Last Edit: May 16, 2012, 05:06:20 am by pylon » Logged

Värmland, Sweden
Offline Offline
Sr. Member
****
Karma: 9
Posts: 262
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can also check the PCF8563 which is another RTC with alarm function.
Logged

Pages: [1]   Go Up
Jump to: