PDA

View Full Version : 12F683 battery powered remote - energy consumption question



silentwol
- 12th April 2007, 19:50
Hi,

I'm using a 12F683 to make a remote to control my TV, stereo system and media center PC.

I have finished writing all the code to send the correct IR signals and I'm now working on reducing the power consumption, so I don't have to change the batteries every week :) Anyway, here's a little description of what I have so far:

For the keypad, I bought this:
http://www.targus.com/us/drivers_manuals_archive.asp?SKU=PA745U

When sleeping it uses around 50uA and when a button is held down it uses about 600uA. When a key is pressed a 9600 serial signal is sent. This is read by the PIC and the correct IR signal sent. This is done using a hardware PWM on GPIO.2 and then making IO.1 high/low to form a signal. The two are then combined using a two transistor AND gate which powers the LED.

Hopefully that gives you a fair idea of what is going on - if more info is needed I'll draw up a circuit diagram and post the code.

My question is, what is the best way of reducing power usage?

Both my current ideas revolve around some sort of wake on interrupt routine. Once the SERIN timeout has been reached (i.e. no input for 15 minutes), the PIC is put to sleep using @ SLEEP, and then woken up by a pin going high... here are the two ways I was thinking of doing it:

1. Have two small metal contacts where your hand holds the device and use a transistor to pick up small conductivity of skin. This is fed into an IO pin.

2. Wake up the PIC when the pin receiving the serial data from the keypad goes high. This means you'll miss the first keypress to wake the PIC up.

The beauty of #1 is that when the PIC is sleeping, you can turn the keypad off (i.e. have V+ of the keypad on GPIO.5 and set this low before sleep and high upon waking). It's slightly more complicated though. 2 is simpler, but will use slightly more power in the long run.

Is there a better way?

Also, what is the best way to wake a PIC from sleep? I've read about using interrupts, but it all seems a little dauting! I was hoping someone could point me in the right direction, so I don't research the wrong thing!

silentwol
- 12th April 2007, 20:30
Hmm... just digging around - another possible option seems to be setting the clock speed to 32khz (apparently uses 11uA?!).

Once the SERIN reaches timeout, it branches to a tight loop:

1. turn everything off
2. set OSCCON = 0 for 32khz clock speed
3. NAP 0 sleep for ~18 ms
3. check if 'turn on' pin is high (e.g. from touch sensitive transisor circuit)
4. if on, turn everything back on and goto main routine
5. else loop back to #1

Seem reasonable?

skimask
- 12th April 2007, 22:03
One thing to keep in mind when using coin cells...
They may be rated at 200mah (give or take), but that's at a very low current draw, say 50uA. If you pulse it at 600uA, that 200mah battery will most likely act more like it's only a 50mah battery.
In other words, 10 seconds of 600uA is a lot more drain than 100 seconds of 60uA, and that's a lot more than 1000 seconds at 6uA.

Don't ask me why, it just the way it is :)

silentwol
- 12th April 2007, 22:22
Thanks for that, but I forgot to mention that I'm planning on using 2 AAA rechargables (1.2V each), so hopefully that wont be a problem :)

skimask
- 12th April 2007, 23:23
Thanks for that, but I forgot to mention that I'm planning on using 2 AAA rechargables (1.2V each), so hopefully that wont be a problem :)

Check the datasheets on the battery discharge characteristics. I'm sure the same thing applies, just not nearly as bad as with a coin cell.

ardhuru
- 13th April 2007, 09:07
Hi,

This is done using a hardware PWM on GPIO.2 and then making IO.1 high/low to form a signal. The two are then combined using a two transistor AND gate which powers the LED.



Not directly related to your question, but concerning transmitting of an IR signal; here's my experience. I had in the past tried pretty much what you are doing (hardware PWM on one pin, and the data on another). I then modified the code to control the PWM itself as per the data bits, and got a much better sinal (in terms of shape and amplitude). So much so that I could even get rid of the transistor, and drive the LED directly (in series with a resistor) from the pin. Additional bonus being saved an IO pin as well.


Regards,

Anand Dhuru

silentwol
- 13th April 2007, 11:09
That's interesting... so you can switch PWM on and off that quickly?

would the following be sufficient?
PWM off:
CCP1CON = 0
T2CON = 0

PWM on:
CCP1CON = %00001100
T2CON = %00000100

Thanks for your help :)

ardhuru
- 13th April 2007, 13:23
I think so.

Alternately, just configure the HPWM pin as an input when you want the LED off.

Credit for this technique goes to Darrel Taylor, who helped me make it work.

THANKS, DARREL.

Regards,

Anand