BasicMicro - Forums

www.basicmicro.com
It is currently Sun May 20, 2012 11:16 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Lowering power use of Atom 40-M
PostPosted: Fri Feb 12, 2010 3:12 pm 
Offline
Citizen

Joined: Wed Feb 10, 2010 1:09 pm
Posts: 16
Quick rundown of what I'm looking for information on.

I am tasked with finding a solution to lower the power consumption of a device my company designed, built, and is being used out in the field. The device is basically one that sits on a pressure line(in the oilfield), monitors pressure, shuts in the valve(if pressure exceeds setpoints) and displays info such as pressure, batt voltage and alarm state via a small LCD screen.

The setup is fairly simple: a 12v 2.8ah battery, a pressure transmitter(WIKA E-10), solenoid, toggle switch for manual override, and the circuit board, in which we are using the ATOM 40-m microcontroller to handle all functions. These units are placed remotely out in the field and the battery is kept powered by a solar panel. Only problem is, during these winter months when the sun may be blocked by clouds for periods of 1-8 weeks, the batteries can die due to lack of charge from the panel. I am looking to lower power consumption of the device, starting with the microcontroller so that we get more usage when the weather is not sunny. I am one week into looking at the code and hardware so I am still learning the ins and outs of this device and this is my first time working with Micro Basic hardware/software. Any tips/suggestions are greatly appreciated.

Thanks!


Top
 Profile  
 
 Post subject: Re: Lowering power use of Atom 40-M
PostPosted: Fri Feb 12, 2010 4:05 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Hello Brock. Welcome to the forums.
For those who want to follow along, here is a data sheet for the E-10 pressure transmitter:
http://www.thermx.com/WIKA/WIKA_E_10.htm

The Atom BASIC has two commands that put the PIC into a low power setting, NAP and SLEEP. I include the section from the Atom Manual that explains these. BasicMicro has been changing timing settings, so timeouts may have changed. It's best if you add one of these to the code using the timings given here and check that they are correct. Some experimenting may be in order. If these work to your satisfaction, you only have to determine how long you want to disable the pressure monitoring because the PIC is out of action in low power mode. NAP gives the shortest periods. SLEEP is good for several seconds or minutes. This is the easiest, fastest way to achieve power savings. If disabling the chip like this worries you, contact us again for other possibilities.
BTW, are you using 5V out or 4-20ma for monitoring?

Quote:
NAP
The NAP command executes the processor's internal sleep mode for
the specified time period. Power consumption is reduced to about 50
μA if no outputs are being driven high.
Syntax
nap period

period is a variable or constant that determines the duration
of the reduced power nap according to the following formula:
duration = 2 period x 18 ms
Period can range from 0 to 7, which gives the following nap
times:
Period 2 period Nap time
0 1 18 ms
1 2 36 ms
2 4 72 ms
3 8 144 ms
4 16 288 ms
5 32 576 ms
6 64 1152 ms (1.152 s)
7 128 2304 ms (2.304 s)
Notes
Times are approximate and may vary with temperature, supply
voltage and manufacturing tolerances.
The nap command uses the Atom's internal sleep timer (watchdog
timer). The maximum nap time is 2.304 seconds. For longer periods
use the SLEEP command instead.
The Atom will immediately wake up from a nap if an interrupt occurs.
126 Basic Atom
The NAP command does not affect internal registers so your program
will continue executing when the time expires.
Example
nap 3
will put the Atom in low power sleep state for 144 milliseconds

SLEEP
The SLEEP command is similar to the NAP command except that it
can be used for longer time periods. To achieve minimum power
consumption set all I/O pins to output and in the low state.
Syntax
sleep seconds
seconds is a variable or constant (up to 16 bits) that specifies
the duration of the sleep in seconds.
Notes
The SLEEP command operates by simply looping the internal sleep
timer as many times as required to achieve the desired time interval.
In other words, it is similar to executing the NAP command multiple
times.
The internal sleep timer is set to a value of 64, which gives an
approximate time of 64 x 18 ms or 1.152 seconds for each execution.
Note that the Atom will wake up briefly each time the timer loops, i.e.
every 1.152 seconds.
As with NAP, an interrupt will terminate the current cycle of the
internal sleep timer. However, the SLEEP command will simply
resume execution with the next scheduled cycle, so interrupts will
only have a slight effect on the overall time.
The SLEEP command does not affect internal registers so your
program will continue executing when the time expires.
Example
sleep 60
will put the Atom in low power sleep state for approximately 1 minute.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Lowering power use of Atom 40-M
PostPosted: Mon Feb 15, 2010 7:45 am 
Offline
Citizen

Joined: Wed Feb 10, 2010 1:09 pm
Posts: 16
Hello Kenjj, thanks for the response.

I am familiar with the NAP/SLEEP commands. There are some of these commands placed in our code but I believe we have maxed out our usage. Problem is, these devices can't afford to go into sleep mode for more than a few seconds. The pressures these devices are monitoring need to be looked at 24/7 with the least downtime as possible. So unfortunately we can't utilize the SLEEP command for more than a few seconds at a time during our code. Right now I'm in the early stages of a new product design that will lower power consumption. I am open to suggestions for alternative microcontrollers as well.

By the way, we're using 5v output on the transmitter.

Thanks!


Top
 Profile  
 
 Post subject: Re: Lowering power use of Atom 40-M
PostPosted: Mon Feb 15, 2010 8:54 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 527
Hi,
I have not played as much with an Atom, done most of my stuff with the Atom Pro, but if it were me, I would try things like:

a) as Ken quotted in his earlier response about sleep/nap. The processor uses less power for IO leads that are set to output and set low. So I would make sure that all of the IOs that I could set this way I did...

b) You mention an LED. Can you turn this off? Is it backlit? If so can you turn this off?

c) Your sensor, how is it read? AtoD? I don't have the experience here with the PIC, but does changing the freqency of the reads does it change the power consumption? If you set up to use interrupts at the end of the AtoD conversion and Nap does that help?

d) How is the selenoid controlled?

Sorry that I am not much help. But good luck!


Top
 Profile  
 
 Post subject: Re: Lowering power use of Atom 40-M
PostPosted: Mon Feb 15, 2010 11:54 am 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
If you're allowed to make changes to the design, consider using the PIC's built in comparator:
Attachment:
PIC comparator.JPG
PIC comparator.JPG [ 101.66 KiB | Viewed 570 times ]

This is from the data sheet for the PIC16F887, which is used on the Rev D version of the Atom40-M. The earlier Rev B use the PIC16F877A. I provide the link to the -887 here for reference:
http://ww1.microchip.com/downloads/en/DeviceDoc/41291F.pdf
As you can see in the list of features, you can set this device (there are two) to "fire" on a preset voltage which can be supplied internally or externally. It also has the ability to produce an interrupt that will wake the PIC from sleep. So, you can now drop the processor into low-current mode and forget it; the comparator will wake it up. An added bonus is the comparator's output to a pin: connect this to a FET to activate the solenoid the instant the trip point is reached. The only "gotcha" with this is the comparator can oscillate as it nears the trip point, thus turning the FET on and off at a rapid rate, thus threatening to burn something out. If the sensor's output is rising slowly, this could easily happen, so you'll want to leave solenoid activation to the discretion of the processor.

If you want to monitor pressure on a timed basis, just use a timer to wake up the processor. And you can include an external switch to wake it up on demand as needed. Otherwise, just let it sleep.

None of these features is supported natively from the Studio compiler. However, you can set bits in the appropriate PIC registers to implement all these functions. The register names are stored away so you don't have to define them ahead of time. Just use conventions like
Register.1 = 0 ; we set the second bit of "Register" to 0
to define which bit to set in the register and the level (0 or 1) you want to set it to. You can even set entire registers using
Register = $FE (or 254, or %11111110)

Have a nice project.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Lowering power use of Atom 40-M
PostPosted: Mon Feb 15, 2010 12:04 pm 
Offline
Citizen

Joined: Wed Feb 10, 2010 1:09 pm
Posts: 16
That is a lot of helpful info. Thanks a lot Kenjj!


Top
 Profile  
 
 Post subject: Re: Lowering power use of Atom 40-M
PostPosted: Mon Feb 15, 2010 2:50 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
You are quite welcome.
Have a nice project. ;)

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO