Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Reducing Power Consumption on PIC16F628A in SLEEP mode

Status
Not open for further replies.
Ok. fine. Now, I can understand your requirement clearly. You can select the PIC MCU with the USART capability for your project. For example PIC16F628A. If you want to select any other PIC, it is no problem but ensure USART is there. It is up to you. Also, you have to select MAX232 (if +5v supply available). But, you are going to use only 3.6v/3.7v in your project. So, you can select any of MAX3222/MAX3232/MAX3237/MAX3241 IC to communicate the GSM Modem from PIC MCU thro' PIC's USART Ports.

**broken link removed**

If space is constraint, you can select appropriate package like SOP, MSOP etc.

Connect PIC MCU to GSM Modem (Serial Port) thro' USART Ports. If you need help on schematic, let me know.
 


Herewith new more detail flow chart.
Please note:
1. There will be a Tamper switch Normally Open(Equipment removed state) connected to RA2. To start the MAIN loop of the PIC program, this must be monitored, first time it changes, switch(RA2-Input) goes LOW(0), GSM UNIT MUST BE POWERED UP through setting RA0-Output LOW(0) for 1s, after 1s return to HIGH(1).
The tamper switch must be continually monitored, if RA2 changes state, that state must be set to RA1 and kept in that state for 180s. Ignore state changes during 180s hold time.
2. If the GSM unit is ON, RA0 must never be activated, the GSM unit will pull RA3 LOW(0) if ON, so if RA3 = 0 do not trigger RA0.
3. Everytime RA0 is triggered, the 8-hour sleep cycle must restart. If nothing happens for 8-hours, then check RA3 != 0, then trigger RA0 for 1s and go back to sleep.

Questions:
I need to design and finalise the hardware urgently:
1. Do I need an external CLK crystal?
2. Do I need to use RB pins to interrupt sleep mode or is RA2 correct? (Tamper switch needs to interrupt and exit sleep mode)

Thank you.

---------- Post added at 15:15 ---------- Previous post was at 15:09 ----------

No, I do not want to do comms through USART.
The GSM module runs independantly from the PIC. PIC will trigger ON input on GSM which will wake up the GSM, it will perform some processes and shut itself down (OFF).
The PIC will monitor the Tamper Switch and run through an 8-hour cycle and then switch ON the GSM again.
The GSM consumes 1mA power in SLEEP, which is unacceptable, have to switch it OFF.

---------- Post added at 15:28 ---------- Previous post was at 15:15 ----------

This flowchart does not show the operation of the GSM module, it only shows the PIC operation and Digital IO interaction with GSM.
 

Questions:
1. Do I need an external CLK crystal?
mode)

Yes. external CLK crystal required. 4MHZ crystal preferable

2. Do I need to use RB pins to interrupt sleep mode or is RA2 correct? (Tamper switch needs to interrupt and exit sleep

Yes. use RB port (Default to Digital I/O) pins instead of RA Port (Default to Analog) pins.

You can simply start with one step (Start GSM and Monitor the Tamper Switch) and go to next step (Interrupt enable, setting watchdog timer for 8 hrs, and go to Sleep mode) then. May be within 3 to 4 steps, you can complete your project. It seems no complicated method involved in your project.

Once you prepared necessary components, let me know.
 

Ok, will change to RB then and add a CLK crystal.
Thank you.
 

Herewith the updated FlowChart:

Here is the physical layout of the PIC on the PCB, please advise if this is correct and if I need to add/move components? Will use PIC16F628A

The PCB layout is important and urgent as I need to finalise that and send it of for manufacturing, then can look at the code.
Thank you.
 

I never encourage to start PCB designing before successfully tested on bread board first. So, First do complete test on bread board and if everything works fine as you expected, then you can go for PCB designing.

Left MCLR floating. connect Tamper switch to any of RB4 to RB7 (PORTB) pins. Because you can use Interrupt On Change (RBIF) Interrupt, else you can connect to RB0 (External interrupt pin - INTF).

**** I strongly recommend to use bread-board or vera-board. please do not put all your pressure on me. If so, I can pull out my leg. So, please be calm and maintain patience and give sufficient time until your project is completed.
 
Thank you, I understand your concern, I am a beginner, but as you said, very basic requirement and hardware should not be a problem.
Do you mean MCLR must be floating?
Will change the Tamper to RB0.
I am not putting pressure on you and appreciate your help and assistance.
 

Do you mean MCLR must be floating?
Yes. We can disable MCLR inside our coding.

let me know if all components are ready.

---------- Post added at 00:22 ---------- Previous post was at 00:17 ----------

Move CMOS outputs to RB1, RB2 and RB3 from RB5, RB6 and RB7. All other things OK. C3 is 0.1uF.
 
Thank you. Will do that.
C4, I use a 6800uF Aluminium Electrolytic 6.3V Capacitor, this is the supply line to the GSM as well and the current peak on that will be bigger.
I added the 0.1uF to the PIC supply, correct?
Herewith the updated drawing:
Herewith the updated Pins on FlowChart:
 

try this schematic.
 

Attachments

  • GSM Module and PIC Schematic.jpeg
    GSM Module and PIC Schematic.jpeg
    138.8 KB · Views: 80

Hi, thank you, understand the power part and will do that. But why the resistors on the IO's, those resistors will consume 3.5mA when high, which defeats the purpose of the power saving? The IO's I selected on the GSM module is internally pulled up with 47k resistors.
 
Last edited:

have used resistors to isolate the PIC MCU from GSM Module just for precaution. Leave it and can directly connect PIC MCU to GSM Module, if you desire.

Note: You have to keep all the things in your mind, like to save GSM Module and PIC MCU from high current and high voltages, not only current consumption, when designing analog circuits.
 
Thank you, will keep it in mind.
Will start writing the code this tomorrow, will post as soon as I have enough down.
 

Agree ;o) The IO's on the GSM runs 2.8V CMOS (Max 3.3V), so the 3.5V from the PIC is out of range. Inserted 10k resistors to compensate for the voltage difference, that ok?
 

I don't know much about GSM Modules. I have worked only with GSM Modem. If the GSM Module's max voltage is 3.3v, then you must use diode between PIC and GSM Module.

---------- Post added at 21:21 ---------- Previous post was at 21:12 ----------

you can use same Voltage range (Vdd) to both GSM Module and PIC MCU to avoid diode. Say, for example, you can supply 3.3v to both MCUs.
 
Thank you. The GSM module runs from same source as PIC 3.5V battery. But for some reason the IO's are at 2.8V CMOS with a max of 3.3V. I have made provision on the PCB for inline resistors between IO connections to compensate for the minimal voltage difference, but will run some tests without it first to see what happens.
 


I have not used PICkit programmer yet. But, soon I am also going to purchase. I have used only low cost PIC PLUS ICSP programmer for my projects. It is enough to purchase available low cost programmer in your nearest electronics shop for this project (You have to ensure that it will support PIC16F628A). But, in future, it will be better to use universal programmer like PICKit3 and debugger to help us to debug the code and reduce unnecessary head aches and delays.

---------- Post added at 22:26 ---------- Previous post was at 22:19 ----------

PICkit 3 looks ok, but will need an external development board or need to build it up?

Not needed for PDIP Packages. You can simply use bread board or vera board. Just connect MCLR, Vdd, Vss, RB6 and RB7 to 6 pin connector. Thats all. You can program PIC using PicKit.
 

Thanks, ordered the PICkit 3 then, 7 day delivery from US though! 8-O
 

Hi speedEC,
Ready to start writing some code, but not sure which route to take? Do I put the PIC in sleep or do I use the watcdogtimer to do my 8 hour loops?
When the PIC starts up TRISB will be set to 00000101, under normal operation RB0 will be low on start-up, the PIC should stay in sleep until 1st time RB1 goes high. (This will be used when unit is sent for installation, the tamper button will be open(low), when they install, RB0 will go high and the PIC must enter "Normal" operation.
Normal operation means:
1. Set RB3 low for 1s and then return to high.
2. Enter sleep for 8-hours then wake up and set RB3 low for 1s and then return to high and enter sleep again.
During normal operation before triggering RB3, sample RB2, if low(0) then DO NOT trigger RB3.
While in sleep, monitor RB0 for change, any change exit sleep mode and triggers RB3(except if RB2 low), always mirror status of RB0 on RB1, but keep for 180s before allowing next change.

Any help will be appreciated. Thanks.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top