Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Battery power for long periods

Status
Not open for further replies.

demestav

Member
Hello everyone,

It's nice to see everyone again after some time :)

I was wondering what do you use to power a small 16F627A PIC based circuit projects.

My circuit consumes about 12mA on 5V supply. Until now I was using a 9V because it was convenient for me and I was playing around testing the circuits.

However now I made a useful device that a friend of mine will use regularly at his job.

After looking around I bought 4 rechargable Ni-MH AA batteries 2500mAh. Unfortunately I forgot that these batteries are 1.2V (instead of 1.5V that I originally thought!). So in series they will give 4.8V.

(Q1) The PIC and my other components work with 4.8V (I think!). For how long do those batteries keep that voltage?

Let's suppose this is my solution. Please review my calculations of battery lifetime on my circuit.

Battery Pack Capacity provides 2500mA for 1 Hour
If I am using 15mA they should last for about 166 hours.

(Q2) Is this correct ?

I need my device to take a measurement every 5 mins. So having it operating continuously is a SERIOUS waste of energy. I read the datasheet about putting the device to SLEEP and then waking up using the watchdog timer. But this period is too short.

(Q3) Is there any other way of putting a device to sleep and waking it up after minutes (instead of msec).


Thank you for reading!
 
For a longer period you simply count the number of wakeups, and only measure when enough have passed.

However, what is your circuit doing to draw 12mA?, that sounds a LOT for a PIC.
 
Hi Nigel and thanks for the reply.

Well the circuit doesn't do much actually except for taking a measurement from DS1820 and stores it in eeprom. However current is about 11mA when my program is in idle mode (you know doing a while(1) loop). How much current should the PIC draw? I got lost in the datasheet.

EDIT: You got me thinking so I removed the PIC from the board and measured again. It draws 9mA!!!! Forgot to mention that I have an LM7805 regulator and a MAX202 (RS232). I guess the power is dissipated in the regulator. What do you suggest?

Thank you
 
Last edited:
Engineering low power circuits takes a lot of thought. While you can reduce the power consumption of a uC, you have to consider the whole system as you have discovered.

Linear regulators waste a lot of energy. If you can live with just running off battery power, do it. Some micros have brownout features that allow you to determine when your power is getting low or you can build a sample circuit to watch your battery level. If you need regulated power, consider using a switching power supply.

You might want to look into the ability to turn off chunks of circuitry. For example, your max202 draws power and you will only need it when communicating so figure out to way to power it down during sleep periods. You might consider switching to a version of the part that has shutdown capability.

Google has lots of information on battery discharge, here's one example. https://shdesigns.org/batts/battcyc.html
 
Hi Nigel and thanks for the reply.

Well the circuit doesn't do much actually except for taking a measurement from DS1820 and stores it in eeprom. However current is about 11mA when my program is in idle mode (you know doing a while(1) loop). How much current should the PIC draw? I got lost in the datasheet.

EDIT: You got me thinking so I removed the PIC from the board and measured again. It draws 9mA!!!! Forgot to mention that I have an LM7805 regulator and a MAX202 (RS232). I guess the power is dissipated in the regulator. What do you suggest?

The regulator is a big problem, you need to either remove it all together, or use a much lower consumption regulator. Also the MAX232 is likely to take more power than the PIC does - you might try powering the MAX232 from a PIC pin, so you can turn it off entirely when not in use - or, easier still, don't use one, you can feed RS232 directly from a PIC, and feed in with a simple series resistor, but you can't use the USART.

As for the PIC itself, you can drastically reduce current by lowering the clock speed.
 
I agree, loose the regulator. You don't need it with your 4.8v battery supply. This is using most of your power right now.

If you're using a crystal oscillator get rid of it and switch to 4 MHz INTOSC which provides excellent timing for one-wire and serial comms in environments that don't experience wide temperature variations.

Loose the MAX232 chip and replace it with a couple 2N7000/2N7002/BS170 N-channel MOSFETs as the level translator which will use practically no power. I actually just install a 3.5mm stereo jack on my projects and use a serial cable with 3.5mm plug on one end and a db-9 connector on the other end with the 2N7000 transistors inside of the db-9 shell. This actually allows me to install a serial port on any PIC project by simply installing a 3 or 4 pin header or a 3.5mm jack on the PIC project board.

Last suggestion is to look into recent devices which include a ULPWU (ultra low power wake up) module (12F683, 16F690, etc). These devices use a resistor and capacitor on one pin to achieve reasonably accurate short or long term wake up timing which can be calibrated and even temperature compensated if need be.

Mike
 
Last edited:
You can run from 3 cells not 4. 4 freshly charged NiMh cells will give a voltage too high for the PIC so you would need a regulator, so 3 cells avoids that. The PIC will take less current at lower voltage.

If you can spend most of the time in sleep mode, the power consumption while measuring and storing the reading doesn't really matter.

If you do have a regulator, there are plenty that take much less current and have lower drop out voltages than a LM78L05
 
I agree with Mike K8LH. You can then use a LF series chip and it will run fine at 2VDC. With the 4MHz setting it will keep an accurate clock setting too.
 
Wow! There are a lot of great advices there!!!
Thanks everyone!

So let's make a quick checklist
(1) I should remove the 7805 regulator

-One alternative is to remove it completely and run the circuit directly from the batteries. Diver300, you said that I should run it with 3 instead of 4 cells. However, the batteries peak at 5.6V (thanks philba for the great link!) which is within the limits of the PIC. Unfortunately I dont have an LF here.

-The second alternative is to use a switching regulator. I did not know about these so its a good thing to learn!

(2) I should do something about MAX202
-Thanks Nigel! Indeed MAX202 needs 3~8mA so I could use the PIC pin for sourcing current.
-As Mike suggested I could use MOSFETs to level shift the voltage (thanks! MAX202 costs!). I googled for 'MOSFET level shift' but could not find something quick. If you have a link it would be nice!

(3) Clock frequency:
-Mike suggested to remove the crystal oscillator and use the internal oscillator. Now why didn't I think that??? :)
-Nigel suggested to reduce the clock frequency. I dont think I can do this for this project but I will add it to my library of good practice!

(4) PIC sleep:
-As Nigel suggested I could do multiple short sleeps which will add up to the long one. Actually I thought of that (hooray!) but I was wondering if I could make it with one sleep only (or two!)
-Mike, I hadn't had the time to look at the ULPWU devices you suggested but it sounds like is what I am looking for!


I am using forums for many years now but I never had any GOLD advices in one place like this thread!!!! Thanks again guys! I will try few things and I will let you know how it went.
 
rs232-easy-pic-serial-port-jpg.8376
 
ok, I am confused now...

The RS232 says that valid signals are :
-LOW 3 up to 15 volts
-HIGH -3 down to -15 volts

So 3 questions:
(1) What do you achieve by using the MOSFETS? PIC output is 5V so why not use that directly? (does it need more than 20mA?)
(2) What happens with the negative voltages?
 
Last edited:
ok, I am confused now...

The RS232 says that valid signals are :
-LOW 3 up to 15 volts
-HIGH -3 down to -15 volts

So 3 questions:
(1) What do you achieve by using the MOSFETS? PIC output is 5V so why not use that directly? (does it need more than 20mA?)
(2) What happens with the negative voltages?

You don't need to that concerned, Mikes circuit allows you to use the PIC USART (because it inverts in both directions, which is why the FET's are there). As long as you use a software UART, like I said before, you only require one resistor - and that's just to limit current entering the PIC input pin. Check parallax's BASIC STAMP - this is how that works.

There's no need for RS232 to go negative, and a 0-5V swing is perfectly fine for almost anything you might connect to, certainly PC's.
 
Last edited:
And..... since the MOSFETs are open drain with a pull-up on each side, this interface works for a PIC that may be powered from 2.5v or 3.3v or 5.0v.

I normally use 19200 baud but the interface also works at higher baud rates.

Mike
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top