pic16f628a sleep mode

Discussion in 'Embedded Systems and Microcontrollers' started by gatoulisss, Oct 25, 2015.

  1. gatoulisss

    Thread Starter Member

    Jan 23, 2015
    34
    0
    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!
     
  2. Lestraveled

    Well-Known Member

    May 19, 2014
    1,957
    1,215
    I tried to look up your chip, pic16f268a. No records. Maybe you miss read the number.
     
  3. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    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.
     
  4. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    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.
     
  5. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,553
    2,375
    The thread title is the correct No. possibly, 16F628a.;)
    Max.
     
  6. RichardO

    Well-Known Member

    May 4, 2013
    1,235
    384
    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.
     
  7. gatoulisss

    Thread Starter Member

    Jan 23, 2015
    34
    0
    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??
     
  8. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,689
    2,750
    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.
     
  9. Andrew216

    New Member

    Jun 24, 2015
    29
    2
  10. gatoulisss

    Thread Starter Member

    Jan 23, 2015
    34
    0
    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 :/
     
  11. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,689
    2,750
    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?
     
  12. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,606
    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.
     
  13. gatoulisss

    Thread Starter Member

    Jan 23, 2015
    34
    0
    i am using piezo buzzer for the alarm so i need the current that 9v battery gives to have the loudness that i want

    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
     
  14. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,689
    2,750
    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?
     
  15. RichardO

    Well-Known Member

    May 4, 2013
    1,235
    384
    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.
     
Loading...