Prop's sleep mode
Philldapill
Posts: 1,283
How do you make the prop enter sleep mode? I am building a battery logger, and need to sample the battery voltage about once a minute, or longer. Once I take a sample, I will write it to an SD Card and then shutdown any peripheral power consumption. I need the power consumption to be as low as I can get it in between samples. How should I do this?
Comments
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
Yes, that is one very effective way of conserving power, but it also helps to stop the other cogs, and do nothing but waitpne or waitpeq.
1) Shut down all unnecessary cogs. This can be done by stopping them or having them wait for something using WAITCNT, WAITPNE, or WAITPEQ.
2) Turn off all unnecessary peripherals
3) Switch to using the RCSLOW internal clock
4) Make the remaining (main) cog wait using WAITCNT. This will make your timekeeping inaccurate because RCSLOW is inaccurate, but it may be good enough.
5) When it's time to log something, switch back to the crystal clock, power up the peripherals, and do the logging.
As for slowing the clock down, I've looked in the manual and don't have any luck getting it... example code anyone?
I've been investigating this same problem and concluded, as Mike and others suggest that the best thing to do is to shutdown all possible cogs and leave a single cog in a WAITPNE/PEQ state. However, when I tried the following code, attempting to get the LOWEST possible power consumption by basically shutting down the entire chip, I still get >27milliAmps. Interestingly, current consumption doesn't change when the chip stops toggling pin 16 and shuts down. A FAR, FAR cry from what the datasheet suggest one should get. I ran this test on the Proto board with my DMM wired in as an Ammeter. Since I don't see a change in current consumption between the active part of the code and the stopped part, I assume that drop is hidden behind the nearly 30mA I'm measuring. Is this simply parasitic consumption of the protoboard? The wall-wort? Are the regulators on the proto board that bad? Has anyone else actually measured the "low power" state of a proto board? If so, what did you find, and how did you get there?
pgbpsu
1) You don't have to do the COGSTOP. When Main exits, the Spin interpreter will automatically do a COGSTOP.
2) Where are you measuring the current? Remember that the Protoboard has a power LED (maybe 5mA).
Post Edited (Mike Green) : 6/23/2008 8:06:13 PM GMT
Thanks for your response.
I didn't realize that reaching the end of Main, would automatically perform a cogstop. I was just trying to do everything I could to get consumption down.
I put my DMM in the power supply line to the board (before the board). So I am seeing the current draw from the LED and the regulators and anything else that needs power on the board. However I'm still surprised that consumption sits around 27mA.
Thanks,
p
Untestet! :
Andy
I know the proto board is not sold as a low power design. I was just hoping it would be low enough power. That hope was rooted in the small parts count on the board and overall simplicity of the board, not in anything expressed or implied. It would have been great luck to have a chip capable of "sleeping" so quietly on a board that allowed for one-off low-power systems that were quick to build (and change).
I'm thinking of low sample rate stuff (1/hr or day). It would be nice to put the prop to sleep, wake up, record, go back to sleep and to build that system right onto a proto board. Here I'm thinking of quick and cheap systems that would be more like 1 offs than 10,000. I guess that's one of the trade offs between simple, cheap, and low power.
Thanks for re-assuring me that the prop itself can be low power.
Regards,
p
The question would be then: is the boot sequence more power hungry than just waiting?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Post Edited (Paul Baker (Parallax)) : 6/23/2008 9:52:28 PM GMT
Thanks for your post. I agree that the concept of "low power" varies from one customer/application to another. Unfortunately, a design that drains a 9V battery, even when the prop is in sleep mode, over the course of a few days isn't "low enough" power for our current application. My attempts at getting low current draw from the proto board in sleep/stop mode were efforts to prove that a sleeping prop is indeed low enough power. It seems from the datasheet, from what Mike has written, and from what you've said that it will be if we design a board to go with it. My attempts with the proto board only reveal that the proto board won't meet our needs, but it seems like a custom board, with switching regulators and no LED, will.
I hope I didn't sound like I was complaining. I love my proto and demo boards. And they are the right price. But I'm cheap enough to want it all from them. Add to that I'm not a hardware guys and it all makes sense....
Thank you for the suggestions.
Regards,
Peter
I recently built a project which used the main Cog running as an RTC, plus 6 Cogs doing various things externally .
Of course it required a battery backup to retain the Time accuracy when not powered from the Mains.
To implement this with the smallest battery (the power outages are a maximum of 2 days) it was necessary to shutdown all Cogs other than the Main one.
I found that running on 1 Cog with no external load, at 5mHz (Xtal) the current drawn by the Prop was <1mA.
Of course, this was on a purpose built board, not a Protoboard.
The Prop's Specification on current drawn says : 0.5mA per MIPS (MIPS = Freq in MHz / 4 * Number of Active Cogs)
kenmac
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Perth, Western Australia
Time Zone = GMT + 8
Assume the following:
-PIN_MIC841_Output is the output of a voltage comparator that monitors the voltage of a battery
-When PIN_MIC841_Output is low, the batt is too low to operate
-When power is applied to the battery for charging, the prop is automatically reset.
-readStatus is a method that reads a tri-state input
Thanks,
Marcus
How often does the voltage need to be monitored?
If you could wait a few minutes between checks, you'd save a lot of power by using "waitcnt(cnt)" or some other wait amount. The longer the cog can be waiting, the less power it will use.
You need some sort of loop in your code. Does some other method call "Main"?
Thanks,
Marcus