Wake from sleep with internal timer/interrupt?

29 Mar 2014

Hi all,

Need some help with the sleep modes and waking from them as I've trawled through all the info on here but not been able to find much of any help. I'm using a LPC1768 and need to be in sleep or deep sleep, after a set time wake and take reading from a sensor and send to a websocket page for viewing and then go back to sleep. Looking to do this every 30seconds. Any info I've found relates to external interrupts. But I want it to wake after a time but not sure what timers can be used for this.Can anyone help with this?

Also I am using the Vodafone 3G dongle for communications, didn't know if anybody knew a way of disconnecting it to also save power. As the whole device will be powered from a common supply I really need to power of the dongle as I believe it draws quite a bit.

Had a lot of help on the forums, as always any help is greatly appreciated :)

Rob

29 Mar 2014

First, LPC1768 on the mbed board has huge power consumption regardless of the state. And your 3G dongle won't exactly lower that. So you need to wonder how much you you are really reducing the power consumption.

For waking up, you can get some inspiration from: http://mbed.org/users/Sissors/code/WakeUp/. It supports all mbeds I have, minus the LPC1768, simply for the reason its power consumption is huge anyway. On a stand-alone setup it could be alot lower though. As you can see in the code, there are completely different solutions depending on the controller + mbed libs. So you will have to check what is suitable on the LPC1768. The LPC812 was easy for example, it simply has a wakeup timer. The KL25Z and friends also, but that is already used by the ticker interrupt, so its state needs to be stored first. The LPC11u24 lacked a timer for that, so instead the watchdog timer is used, which works, as long as you don't want to use a watchdog at the same time.

29 Mar 2014

Thank you for that. Didn't realise the 1768 had such large power use. I have a 11U24 which I was using but found out it cant be used to host a USB device (the 3G dongle) so went for the 1768. It is going to be a battery powered unit and will need to last probably in the region of 12hrs. Not sure if this is achievable or not with the dongle running constantly, hence wondering if it could be turned off. It is possible to have an update sent every 60 seconds or even 90 so maybe I can get some gains that way?

29 Mar 2014

For USBHost you are going to need the LPC1768 indeed.

I would first check how much everything is using, can you powerdown the dongle, how long does it take to power up again? 3G was never really intended for duty-cycling, so i don't know how long it takes to sync with the network, etc. And you might need other hardware to just cut the power line to the dongle.

Power down everything ethernet related. What also helps, but is a bit more work, is removing the voltage regulators and replacing them with low quiescent current ones.

If you reach 12 hrs also depends on the battery of course.

Can it wake up while sleeping? Definately, but I would first check how much it uses when you try to make it sleep with as little power as possible, and how much it uses when on, then calculate how often it needs to be on, and combine that to requirements for a battery.

Also does it need to send it every 30 seconds, or only measure every 30 seconds? For example measuring every 30 seconds, and sending it once in a while, costs alot less power. But of course it isn't realtime anymore.

29 Mar 2014

I thought that was the case. Due to using the 3G dongle the 1768 was the only option. I see what you mean, it would depend on the time it takes to power up, connect, send info and then disconnect again. I haven't decided on battery yet so maybe a car battery will give me the 12Hrs!! :) I'll have a look at what it all pulls now and work out how long I can get. Like you say, if I start extending it to 60 or 90 mins it then isn't real time. Thanks very much for the advice. Rob