pic16f628a sleep mode

Thread Starter

gatoulisss

Joined Jan 23, 2015
69
hello everyone,
im using an pic16f268a microcontroller to build an security alert system witch is powered with 9v battery the problem is that after 3-4 days that my system is working the battery is going off...
after a little search ifind out about the sleep mode but because im new to this i dont know how to use it.
any help? how i can wake and sleep my processor? can i wake it up when a button is pressed or something like this happens?

thank you very much!
 

Papabravo

Joined Feb 24, 2006
21,159
Dyslexia -- It is probably the PIC16F628A, the successor to the PIC16F84A
The best way to wake it up is with the watchdog timer. When the watchdog timer expires it wakes the device up from sleep. Putting the processor to sleep is simplicity itself, there is a dedicated instruction for that purpose. Also there are bits in the STATUS register that allow you to determine how the processor was started. So you can do different things one initial power up and wakeup from sleep.
 

JohnInTX

Joined Jun 26, 2012
4,787
Deja vu.
I put some good low power application links in these two posts. 1 2
Compared to the XLP stuff (in the first link), the F628 is not the best choice if you want maximum battery life. But if that's what you have, the other links cover things you can do to minimize battery use for any PIC. Like PB says, sleep the processor using a wakeup-on-change and/or the watchdog. The INTOSC clock speed is software selectable so run it slow when you can, faster only when you have to.

Good luck.
 

RichardO

Joined May 4, 2013
2,270
How are you getting the voltage to power the PIC from a 9-volt battery? If you are not using a very low quiescent current regulator then that could be part of the problem.
 

Thread Starter

gatoulisss

Joined Jan 23, 2015
69
i am using th LM7805 regulator and yes the microcontroller is the PIC16F628A sorry for my mistake
how i can use the mikroC to put my micro to sleep and wake it up when the sensor for example become from 0 to 1??
 

joeyd999

Joined Jun 6, 2011
5,234
i am using th LM7805 regulator and yes the microcontroller is the PIC16F628A sorry for my mistake
how i can use the mikroC to put my micro to sleep and wake it up when the sensor for example become from 0 to 1??
The 7805's quiescent current is greater than the PIC's running full speed. And it will continue to consume current even when the PIC is in sleep. You need a modern switching regulator with 'pulse skip' mode, or a low Q current LDO.
 

Thread Starter

gatoulisss

Joined Jan 23, 2015
69
The 7805's quiescent current is greater than the PIC's running full speed. And it will continue to consume current even when the PIC is in sleep. You need a modern switching regulator with 'pulse skip' mode, or a low Q current LDO.
so which switching regulator would be good for what i want? which one i have to buy? how many compoments more i will have to add? because now im using the lm7805 and two capacitors for what i want and searching in google for switching regulators gives me bigger circuits.. sorry for all this questions :/
 

joeyd999

Joined Jun 6, 2011
5,234
so which switching regulator would be good for what i want? which one i have to buy? how many compoments more i will have to add? because now im using the lm7805 and two capacitors for what i want and searching in google for switching regulators gives me bigger circuits.. sorry for all this questions :/
Questions you have to answer first:

1. What is the desired min/max input voltage?
2. What is max output current?
3. What is max p-p noise acceptable?
4. Can you use surface mount? Or thru-hole only?

Can you show a schematic of your circuit?
 

ErnieM

Joined Apr 24, 2011
8,377
Before you go down the road looking for a switching regulator you should look into using a different battery, say three AA batteries for around 4.5 V so no regulator at all is required.
 

Thread Starter

gatoulisss

Joined Jan 23, 2015
69
Before you go down the road looking for a switching regulator you should look into using a different battery, say three AA batteries for around 4.5 V so no regulator at all is required.
i am using piezo buzzer for the alarm so i need the current that 9v battery gives to have the loudness that i want

Questions you have to answer first:

1. What is the desired min/max input voltage?
2. What is max output current?
3. What is max p-p noise acceptable?
4. Can you use surface mount? Or thru-hole only?

Can you show a schematic of your circuit?
1. i dont have problem with the input voltage i have with the capacity of the battery and the size thats why i use 9v
4. im using thru-hole equipment only to test the circuit the final board will be with surface mount parts so yes i use surface mount parts

i will upload the schematic later
 

joeyd999

Joined Jun 6, 2011
5,234
1. i dont have problem with the input voltage i have with the capacity of the battery and the size thats why i use 9v
Ok...so I'd call Vin,max to be 10V. What is Vin,min (i.e your minimum operating voltage)?

And what is the I,max of your circuit at full power?
 

RichardO

Joined May 4, 2013
2,270
i am using piezo buzzer for the alarm so i need the current that 9v battery gives to have the loudness that i want
When you say piezo buzzer do you mean a piezo that makes sound when you apply a DC voltage or a piezo that you drive with an audio signal?

If you are driving audio into the piezo from a single port pin of the PIC then driving it differentially from 2 port pins will increase the loudness. A piezo with more capacitance will generally be louder as well. Finally, don't forget the the acoustics of the case have a huge effect on the loudness of the sound.

In extreme cases, I have had to go to a magnetic transducer (instead of a piezo) to get the loudness I needed.
 
Top