Author Topic: Single button uC control  (Read 9065 times)

0 Members and 1 Guest are viewing this topic.

Offline Mr Smiley

  • Frequent Contributor
  • **
  • Posts: 324
  • Country: gb
Re: Single button uC control
« Reply #25 on: October 11, 2012, 02:44:52 pm »
Hi,

Please correct me if I'm wrong.

From post #21, in the diagram, you have PB4 pulled up to 9v via a 10k resistor.

First problem is, relative to ground pb4 will be at 9v and 10k will pass 9/10k=0.9mA.

It's been known for pic's to be powered through their input pins, and 0.9mA is plenty if its running at 32khz.

Also 9v on an input referenced to ground will forward bias the intrinsic protection diodes.

You could clamp the pin with a zener to protect the micro but that would still draw power from your battery and still power the micro when you think it's off.

Also, if you thought it was working, setting the output pin to a 1 to keep the circuit powered, and someone comes along and presses the power on button, you now have a output pin shorted to ground  :-\ you'd need another series resistor to the input pin to protect it from a short to ground.

Just an observation  :o

Mr Smiley  :)
« Last Edit: October 11, 2012, 02:50:20 pm by Mr Smiley »
There is enough on this planet to sustain mans needs. There will never be enough on this planet to sustain mans greed.
 

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 895
  • Country: us
Re: Single button uC control
« Reply #26 on: October 11, 2012, 04:05:25 pm »
If you have a microcontroller and a DC-DC converter with enable input, it really is as simple as producing an OR gate with diodes for power button and a microcontroller output. Connect the output of this makeshift logic gate to the enable input of the DC-DC converter. When MCU starts, it should pull the beforementioned output high. When it's time to shut down, the MCU should bring the output low.
Hi ju1ce,

In my last experiment, I did use two diodes. In the new one, I decided to actually switch VIN because the MCP1640 requires 90% of VIN to appear on the enable pin to turn the thing on.

If the circuit is using two fresh alkaline batteries, @1.65v each, that puts VIN at 3.3v and the enable threshold at 2.97v. No problem for a mcu running at 3.3v, right? However, with a diode in the way, the enable signal will lose up to 1v which would mean the mcu wouldn't be able to keep the boost converter running. A Schottky diode with a .25v drop would probably work, but there wouldn't be much room for error.

A diode *would* work in place of Q3, but it seemed simpler to use the same transistor twice. The N-MOSFETs are pretty cheap too. The only other embellishment on the soft power part of the circuit is a capacitor to de-bounce the switch.
 

Offline ju1ce

  • Regular Contributor
  • *
  • Posts: 96
  • Country: fi
Re: Single button uC control
« Reply #27 on: October 11, 2012, 07:00:26 pm »
If you have a microcontroller and a DC-DC converter with enable input, it really is as simple as producing an OR gate with diodes for power button and a microcontroller output. Connect the output of this makeshift logic gate to the enable input of the DC-DC converter. When MCU starts, it should pull the beforementioned output high. When it's time to shut down, the MCU should bring the output low.
Hi ju1ce,

In my last experiment, I did use two diodes. In the new one, I decided to actually switch VIN because the MCP1640 requires 90% of VIN to appear on the enable pin to turn the thing on.
That's a valid point. Well, it just goes to show there's no hard-and-fast solutions.
 

Offline perfect_disturbance

  • Regular Contributor
  • *
  • Posts: 144
  • Country: us
Re: Single button uC control
« Reply #28 on: October 11, 2012, 11:35:56 pm »
Hi,

Please correct me if I'm wrong.

From post #21, in the diagram, you have PB4 pulled up to 9v via a 10k resistor.

First problem is, relative to ground pb4 will be at 9v and 10k will pass 9/10k=0.9mA.

It's been known for pic's to be powered through their input pins, and 0.9mA is plenty if its running at 32khz.

Also 9v on an input referenced to ground will forward bias the intrinsic protection diodes.

You could clamp the pin with a zener to protect the micro but that would still draw power from your battery and still power the micro when you think it's off.

Also, if you thought it was working, setting the output pin to a 1 to keep the circuit powered, and someone comes along and presses the power on button, you now have a output pin shorted to ground  :-\ you'd need another series resistor to the input pin to protect it from a short to ground.

Just an observation  :o

Mr Smiley  :)

I'm planning on running an ATMega328 at 16Mhz I'm not sure if it would have the same problem as being powered through the input pin.

Thanks for the catch on shorting the output to ground.

So would the circuit in 17 be better? I'm honestly more comfortable with how it works anyway.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf