# 8051 On/Off Circuit

Discussion in 'Electronic Design' started by mpm, Dec 28, 2007.

1. ### mpmGuest

This is general enough to be of use to several folks.

Anybody got a simple momentary keypad-switchable ON-OFF circuit for a
8051 (or similar)?
Figure about 100 mA MAX, and will be battery operated (9-Volt).

Program will run for a minute or so, then the device should shutdown
(under uPC control) until the next time it's needed. Probably do

MINIMUM cost, and minimum parts count would be nice too!

The only thing I can think of is a FET controlling the input to a
switch mode power supply / regulator. (But admittedly, I don't do
much battery-only stuff, and my solar design are higher current and
not easily adaptable for low cost.)

Thanks.

2. ### Henry KieferGuest

A self-holding thyristor in series to the 8051.

- Henry

3. ### JamieGuest

P channel enhanced high side switch.
The remote signal will pull the gate low. Use one output from the uC
as a open collector config that also connects to the gate. When the Uc
boots, it shall pull this output low. when the uC wants to turn it self
off, just lift this output to high.
if you want to manually turn the device off, use another input that
you simply pull low which will have the uC turn off the output line.
etc..
that's just as basic run down.
you can use a low voltage logic level P channel.

4. ### Nico CoeselGuest

If battery lifetime is important, the MSP430 from TI is definitely the
way to go. Since it has interrupts based on its I/O pins it is very
easy to have the device to wake-up when a key is pressed. The MSP430
alone can consume less than 1mA while running. An MSP430 running at
6MHz will beat a 40MHz 8051 hands down when it comes to processing
power.

5. ### Frank BussGuest

A nice part is the MAX4715 digital switch:

http://datasheets.maxim-ic.com/en/ds/MAX4715-MAX4716.pdf

The key can switch it on and decoupled with 2 diodes the CPU can hold
itself on. And an additional pull-down at the input: When the CPU releases
the output, it turns off itself, with very low quiescent current.

I've used this part in a customer product and works great. Only drawback is
that it is from Maxim, but at least the Maxim store has it in stock and the
customer uses this part for some years without delivery problems.

But for minimum price a FET solution might be better. Part count might be
better with the MAX4715.

6. ### Spehro PefhanyGuest

I think it's non-trivial. The micro will do undefined things as its
supply voltage drops, and there are protection diode networks that can
come into play. 8051s have those awful pseudo-bidirectional ports
(sometimes).

The easiest solution, assuming a modern CMOS micro with sleep mode and
"wake on port pin change" or "wake on interrupt" function is to power
the micro continuously and shut down the internal clock oscillator.
Usually you can leave port pins and so on in such a state as to draw
microamps or better during sleep. There are potential safety issues
with this approach, and you might need to hide a "hard" reset switch
somewhere.

Best regards,
Spehro Pefhany

7. ### EeyoreGuest

Why use an 8051 ?

A monostable driving a power device would seem to be all you need.

Graham

8. ### Anthony FremontGuest

What he said. Seems to me that most modern parts should have sleep
modes that draw negligible amounts of current, yet can wake up instantly on
an input pin state change. IOW, use a PIC. ;-)

9. ### Henry KieferGuest

Think about the thyristor idea a second time.
Start it by pressing a button parallel to the thyristor. Stop it by let
the CMOS MCU going in sleep state. Reducing the current let the
thyristor go open.

Of course, there are other possible solutions too.

- Henry

10. ### EeyoreGuest

Actually you need to feed some gate current to initially turn the thyristor
on. Shorting it out ought to take it out of conduction too as it won't any
longer have its holding current.

OK as long as the OP doesn't mind the supply voltage varying by ~ 0.7V.

The sleep idea sounds good too.

Graham

11. ### mpmGuest

Agreed, but in this particular design (data collection & storage),
it's unlikely undefined startup conditions or flake-y power would
actually cause a problem. The device just won't appear to operate...

But back to the issue:
The device is battery powered (single 9-volt) and the 8051 is NOT the
only thing consuming power. So while "sleep" mode and/or power down
mode will work for that, it won't necessarily power down everything
else. (LCD display, serial EEPROM, communciations circuits, etc..)

Additional note: You know, I really did want to use the LCD
backlight, but at 160mA it does seem like you'd be replacing the 9V
battery pretty often. Bummer.

And I did not mention it but the same circuit board will power both a
wall-mount version AND a portable, handheld version. The former being
could just leave it running constantly).

But on the handheld unit, power conservation is really rather
important.
I was already thinking along the lines of switching P/S, etc...

Ideally, I'd just like to turn the device completely OFF, until the
user presses a momentary keypad switch to turn it ON. Then let the
8051 device do it's thing and shut off.

I will look at the Thyrister and high-side suggestions. Also the
MAX4715 idea.
I am aware of several regulators that have an "enable" line, and that
would of course solve the problem.

I was just wondering how everyone else does this, and as I suspected,
there are lots of good ideas out there.

-mpm

12. ### Spehro PefhanyGuest

It might not shut off, and drain the batteries for you, or just annoy
the user because they have to hit the key multiple times to get it to
shut down. You may be able to design it so that a hardware supervisory
circuit holds the micro in a defined /RESET state to low enough supply
voltage (eg. 1V) that nothing bad can happen below that, if your
on/off circuit is designed to work thusly.
You have control over those things if it's your circuit.
You could use AAs and maybe a SEPIC, but 160mA is still pretty
thirsty. More  = a more efficient backlight.
I don't think that's necessarily ideal.
Would it? Only with some careful design.

Best regards,
Spehro Pefhany

13. ### MooseFETGuest

The switching is done with a P-MOSFET

The logic is only a little tricky.

You need a comparitor or something on the reset to keep the micro from
running when the voltage is low.

The button has a direct method of turning on the P-MOSFET and can be
read by the micro. Usually this involves two small N-MOSFETs or NPN
transistors. One pulls down the gate of the P-MOSFET and the other
goes to an IO pin.

There is also a flip-flop driving another NPN or small N-MOSFET. This
flip-flop is set by an RC when the voltage rises because the button
was pressed. This is what latches the power on. To switch off the
power, the micro polls the power button to make sure it isn't pressed
and clears the flip-flop.

14. ### Henry KieferGuest

Oh sorry. Yes, the gate must be triggered by the button.

Sleeping is best solution if the circuit draws almost nothing in this state.

- Henry

15. ### Henry KieferGuest

My next idea woild be a OptoMOS relais in series to the voltage
regulator/mcu. The LED driver side is controlled by an mcu output pin.
To start the circuit just press one button parallel to the relais.

It is more efficient than the thyristor.

- Henry

16. ### Nico CoeselGuest

You should avoid using switchers since these use quite a lot of power
even when disabled. Powering your device from a 3.6V battery makes
much more sense; you won't need a regulator (especially when using the
MSP430 I proposed before). The LCD backlight can be controlled by a
pulsating current (perhaps a small inductor in series) rather than a
switching regulator.

IMHO any solution with a switching regulator or an external power
supply switch element is going to draw more power than a (sleeping)
microcontroller which is directly powered from the battery.

17. ### EeyoreGuest

There's no shortage of low-voltage 8051 family members.

The 89C51 goes as low as 2.7V for example.

Graham

18. ### petrus bitbyterGuest

"mpm" <> schreef in bericht
\
\Agreed, but in this particular design (data collection & storage),
\it's unlikely undefined startup conditions or flake-y power would
\actually cause a problem. The device just won't appear to operate...
\
\But back to the issue:
\The device is battery powered (single 9-volt) and the 8051 is NOT the
\only thing consuming power. So while "sleep" mode and/or power down
\mode will work for that, it won't necessarily power down everything
\else. (LCD display, serial EEPROM, communciations circuits, etc..)
\
\Additional note: You know, I really did want to use the LCD
\backlight, but at 160mA it does seem like you'd be replacing the 9V
\battery pretty often. Bummer.
\
\And I did not mention it but the same circuit board will power both a
\wall-mount version AND a portable, handheld version. The former being
\could just leave it running constantly).
\
\But on the handheld unit, power conservation is really rather
\important.
\I was already thinking along the lines of switching P/S, etc...
\
\Ideally, I'd just like to turn the device completely OFF, until the
\user presses a momentary keypad switch to turn it ON. Then let the
\8051 device do it's thing and shut off.
\
\I will look at the Thyrister and high-side suggestions. Also the
\MAX4715 idea.
\I am aware of several regulators that have an "enable" line, and that
\would of course solve the problem.
\
\I was just wondering how everyone else does this, and as I suspected,
\there are lots of good ideas out there.
\
\-mpm
\

I don't like the idea of a processor switching itself off, but the principle
looks not too difficult. The circuit below can be considered standard.

+9V----+--------- ------------
| \ ^
| ---
| ___ |
+---|___|--+
| ___ |
+---|___|--)----+
| |
| o |
| |=|
| o |
| | to
\| | ___ processor
|--+-|___|-- pin
<|
|
|
GND--------------+-------------
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

Problems may arise when the switch is pressed too short so you will need
some additional circuitry. Starting a micro is always surrounded by unwanted
side effects anyway. I'd make the processor switch off all components but
itself by a circuit like the one above and then go to sleep. This way the
micro keeps control.

petrus bitbyter

19. ### Henry KieferGuest

There is always a transitional problem, so any scheme must be tested at
least several hundreds time for reliable switching the state.

- Henry

20. ### MooseFETGuest

On Dec 29, 12:08 pm, "petrus bitbyter"
[....]

I think you wanted a PNP as the pass device. As drawn it doesn't
work.
(org. drawing)

I also think you may need a pull up on the processor pin. The 8051s
don't pull up very well.
Modified: