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.

How to safely turn off MCU's power by MCU itself ?!

Status
Not open for further replies.

hm_fa_da

Full Member level 5
Joined
Sep 16, 2003
Messages
287
Helped
10
Reputation
20
Reaction score
4
Trophy points
1,298
Activity points
3,217
Hi all ,


in my project :

there is a transistor series whit MCU power supply ,it's base is controlled by both MCU and a uSwich , when i press uSwich , it turnes on and after turning on , MCU keeps transistor active( writting 1 to transistor base ) , and when the circuit shold turn off , MCU deactive the transistor ,so it turns off the power itself.

there was a problem this case , if i keep the uSwich still pressed , then MCU can not take the circuit off , so
i used a 10uF capacitor series with uSwich , meaning when i keep the SW , it first turns on circuit , and during this time the Capacitor is charged ,MCU keeps power on and capacitor is charged completely, so it is like SW is not pressed ,

and MCU can turn off the circuit ,
and again if i want to turn on the circuit , i should depress the SW ( SW is NO/NC type ) , this allows Capacitor being discharged ( thorugh a low resistor ) so pressing SW again would activate the power transistor and so on ....

the problem is this :

when MCU turns the transistor off by writting 0 to it's output ,the power supply is disconnected and voltage on VCC of MCU decreases to 0V , my MCU is AVR(ATmega162 - BOD Enabled on 4.0V ) , 2.7V-5.5 V operating range ,
when voltage goes less than 2.7V (slowly) , CPU will not function well and MIGHT changes the output pin ( which connected to transistor ) high again , so it reActivate power transistor on and does not allow the circuit get off .

this problems occures morly when voltage is decreasing slowly , and in my circuit is like that and there is no way to change this ( because of the circuit design ) , like there is a big capacitor between VCC and GND .
( it does not occure always , just sometimes )
now i want to know what i can do in MCU software for a safe or at least BETTER turning off ,like going to power down mode or any other way if has a good effect .


Thanks ,
Best Regards.
 

Other option will be to use a 3V zener diode between mcu and transistor so any voltage between 0 and ≈3.6V will be treated as OFF ..
Regards,
IanP
 

you mean series between output pin and transistor base ?
How about going to power-down , power save , Idle or ... modes ,
does it affect ?

Thanks ,
Best regards.
 

Normally you have a 1kΩ-10kΩ resistor between mcu pin and the base ..
Adding 3V zener diode will prevent from switching on the transistor when the voltage drops below, say 3.6V .. you may need to add a 10kΩ resistor between the base and GND ..
If in power-down or idle modes this pin is held high (>3.6V) power to the MCU will stay ON without problems ..
Regards,
IanP
 

    hm_fa_da

    Points: 2
    Helpful Answer Positive Rating
i offer you to use
"5V Logic Regulator with 0 to 30V Regulator Electronic Shutdown" in lm350 datasheet
it will power off if input voltage riches 1.2v and in this voltage your mcu does not work.
 

Ianp's Idea helped me ,

it was true , i added a 3.0V zener series between base and out put pin , and it had a good effect ,meaning when VCC goes less than 2.7 V , MCU may not function well , this time if MCU writes high wrongly to output , it doesn't affect because of being lower than 3.6V .

Thanks and best regards.
 

The best solution is to use a voltage supervisor, such as DS1233, or MAX 809, or MCP809 to sense the voltage and reset the micro. That way, once the voltage drops to less than about 4.75V the micro will be held in reset no matter how slowly the voltage drops.
As the micro tristates its IOs when in reset, a 10k resistor between the base and emitter of the transistor is advisable to keep it off.
 

is this called Sucide of a MCU? ;)
 

I think better is to make priority circuit where one input will be your switch and another your mcu . I think the best will be D trigger connected as :

a. input to VCC
b. uswitch to clock input
c. Reset to mcu power control output
d. output to transistor controlling mcu power.

- power will be on only by rising edge of uswitch
- once mcu reset the d trigger (power off) - this operation is asynchronous and will be executed regardless of uswitch press state, and also it will be remembered irrespective of what mcu gives to its output till full capasitors discharge .


But, can you replace this ugly circuitity with powersafe mcu power modes ?
 

Will 10K resistor too large for the Zener to work?

Normally you have a 1kΩ-10kΩ resistor between mcu pin and the base ..
Adding 3V zener diode will prevent from switching on the transistor when the voltage drops below, say 3.6V .. you may need to add a 10kΩ resistor between the base and GND ..
If in power-down or idle modes this pin is held high (>3.6V) power to the MCU will stay ON without problems ..
Regards,
IanP
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top