PDA

View Full Version : Minimize battery consumption on a 18F2550



Fredrick
- 20th June 2014, 22:26
Hi

I´m trying to build a battery powered RF remotecontrol with 8 buttons and I want to use this as the hardware http://www.mikroe.com/startusb/pic/ (plus a voltage regulator and a RF transmitter module and some buttons of course)
Everything is working fine but now I want to minimize the power consumption in the remote and I have try to do that in several ways

* Lowering the internal oscillator value which works
* Put the PIC into sleep mode and wake it from "PORTB change" when I press one of the 8 buttons, but that do only work on PORTB.4 to PORTB.7
* Put the PIC into sleep and wake it by TMR1 every second or so to poll PORTB 0 - 7 and see if a button is being pressed but I can't get that to work either, I believe I have to use an extra external oscillator for TMR1 to do that, right?

The PIC on the board i a 18F2550 and I don´t use the USB part on it.

Anyone having any tips of what I can do to reduce the power consumption more with that hardware?
And one more question, when i put the PIC into sleep it consume about 3mA and I believe that it could be lowered in some way, but I have not been able figured out that yet.


(English is not my primary language so I hope you have forgiveness with that)

Demon
- 21st June 2014, 05:12
First thing is to go through the datasheet and disable as many features as you can. That should save energy.

I have no experience with sleep feature.

Robert

aratti
- 21st June 2014, 13:27
I can suggest to switch off everything when not used, so you will have no power drain. When you press any button to activate the proper command, you will switch on the system via a small fet activated with an array of diodes so that any button will switch on the fet. Your pic as activated will retain the fet on for all the time necessary to process the comand then it will switch off the fet again.

Cheers

Al.

Amoque
- 21st June 2014, 14:07
Here is a thread on the subject: http://www.picbasic.co.uk/forum/showthread.php?t=6134

I liked the idea (coolness factor) of a "touch sensitive" case...

towlerg
- 21st June 2014, 20:39
BTW. If you're not using the USB part of the Mikro board, you can save most of the $26 ($17.10 plus $9) and make a smaller board if you build the whole thing on stripe board. Also, you might find it easier to mount the RF module securely. Just a thought, although perhaps the convenience is worth it to you.

Fredrick
- 24th June 2014, 20:46
Thank you for your replay.

How do I do that and what parts do I need?
Do you have an example or schematic?


I can suggest to switch off everything when not used, so you will have no power drain. When you press any button to activate the proper command, you will switch on the system via a small fet activated with an array of diodes so that any button will switch on the fet. Your pic as activated will retain the fet on for all the time necessary to process the comand then it will switch off the fet again.

Cheers

Al.

aratti
- 25th June 2014, 11:21
Something like this should be a good starting point.

Cheers

Al.

Fredrick
- 26th June 2014, 01:08
Thanx
Can it also be done with a N-ch FET like the 2N7000 in some way?

Fredrick
- 28th June 2014, 17:17
Will this schematic work?

When u press a button the FET will switch on the 7805 and the PIC, and then I hold RA4 low as long I want the PIC to run.
The +BATT terminal is from a 9V battery and the datasheet says that RA4 can handle up to 14 volts if I have understand it right, so 9V on RA4 will be OK?

pedja089
- 28th June 2014, 18:05
It wont work. Because if PIC doesn't have power supply, current still can be drown from pin, and that will be probably enough to turn on fet. Even if RA4 is open drain, you can put more than VDD+0.6 on that pin. If you do this, you will damage input buffer.
So you need to to put transistor to bring down gate. Depending on P FET you use and battery voltage, maybe you need to put another resistor to create voltage divider for gate.
EDIT:
7364

aratti
- 28th June 2014, 19:03
Using a voltage regulator introduce some complication. You will feed 9 volts to your inputs and this will demage your pic. You need to isolate in same way your pic (both input and output) see the attached suggestion. (remember that all the input must be pulled up)

Cheers

Al.

Fredrick
- 28th June 2014, 21:19
Will this work then?
PORTB are using internal weak-pullups, and I keep RA0 high as long as I want the PIC to run.

aratti
- 28th June 2014, 21:58
When the push button is open you feed 9 volts to the pic input. Place a diode on each input to stop this current flow.

Cheers

Al.

Fredrick
- 28th June 2014, 22:35
Does it look ok now?
I assume the standby current now will be 0uA when no button is pressed and the RA0 is not high?

amgen
- 28th June 2014, 22:58
7368

the input to pic pins (9 volt) is limited by the 100K r and those pins should have redirect diodes (inside pic) that protects pic from overvoltage.
The opto will shutdown power or the r-c on fet gate can be made to time out (any time you set) but the power to pic then just reduces slowerly? ,,,but the brownout setting also will shut down pic before too low voltage makes program unfunctional ..
don

aratti
- 29th June 2014, 06:51
With reference to your schematic of post #14, please note that if you can find a switch with two contacts (common; No & Nc) then connecting the common to ground and the Nc to pic input and No to the gate of Pchan mosfet you can eliminate all the diodes.

All you need now is to assemble the circuit on a proto-board and see if it works.

Cheers

Al.

Fredrick
- 29th June 2014, 15:19
The datasheet says this


Absolute Maximum Ratings
Voltage on MCLR and RA4 with respect to VSS .................................................. ..........................................-0.3 to +14V
Voltage on all other pins with respect to VSS .................................................. ..................................-0.3V to VDD + 0.3V

Does that mean that I can feed +9 into RA4?
And if not why should this be avoided?

amgen
- 29th June 2014, 18:11
7373
from the data sheet for 18f2550. the diode pointing to vcc holds the voltage at the pin to 5 volts (or the supply voltage) as long as the current is under max-rating, generally 25ma. So limiting current way below that is safe operation. Your 78xx volt reg will keep the vcc voltage to the 5 volts.
7374
data sheet from 16f device shows the diodes in the pin input.
don

Demon
- 29th June 2014, 22:09
The datasheet says this
...
Does that mean that I can feed +9 into RA4?
And if not why should this be avoided?

Absolute maximum means it's the limit, at your own risk, no guarantees. Avoid unless you like magic smoke tricks.

Check the other section where it says recommended or something (can't remember exact words), but it'll most likely have a range of 0 to 5 volts or so.

Robert


Edit: check up voltage dividers.

Jerson
- 30th June 2014, 04:45
Hi
Anyone having any tips of what I can do to reduce the power consumption more with that hardware?
And one more question, when i put the PIC into sleep it consume about 3mA and I believe that it could be lowered in some way, but I have not been able figured out that yet.

I will advise you to use the sleep mode exclusively without any modifications to the existing hardware. To use this board, you need to


1. configure your 8 keys as a 4x2 matrix using RB4..7 (IOC pins) and any other 2 lines.
2. Set 4 matrix lines RB4..7 high and program for interrupt on change
3. Set the other 2 matrix lines low
4. Now, clear the IOC interrupt and sleep (GIE, RBIE). You do not need to have an ISR for this to work
5. When a key is pressed, the IOC interrupt will put the MCU out of sleep and continue after the sleep command Clear INTCON
6. Turn both matrix lines which were low to high and scan which key is pressed
7. Do remote transmit function
8. Back to 3

To get the lowest current draw in sleep, you need to disable all functions that you will not use on the chip. I am too lazy to look it up now, but, if you don't need the feature, disable it to save current. Remove the power led LD1; that wastes power all the time. Before sleep, turn off LD2 and LD3 to minimize current wastage.

Your typical sleep state current should be in the order of 20-100uAmps. Anything more and you can be sure something is draining the current somewhere; double check.

I have used similar tricks and get close to the shelf life of the batteries in my product; so, go ahead and give it a try.

amgen
- 30th June 2014, 13:23
what about the voltage regulator current drain (quiescent current) a little high for 78XX regulators ???
don

Fredrick
- 30th June 2014, 13:39
I changed my mind and I will not use the PICstart board anymore, I will do all on a protoboard.

Fredrick
- 4th July 2014, 22:02
The schematic almost works, but I had to change the D and S on the P channel FET. (see the attachment)
Can someone explain for me how the D and S should be connected for a N and P channel FET?

The P channel FET is a BS250P and the N channel is a 2N7000.

pedja089
- 4th July 2014, 22:39
N Fet- Source to ground
If gate is on higher potential then source, transistor is turned on.
0V or negative voltage on gate, then transistor is off.
P Fet -Sourse to positive supply.
If gate and source are on same potential, then transistor is off. If gate is on lower potential than source then transistor is turned on.

Fredrick
- 4th July 2014, 22:55
So a N-channel FET should always have the S connected to the ground and the P-channel should always have the S connected to the positive supply?

pedja089
- 4th July 2014, 23:47
Yes, you are right.