Let's say I have 4 AVR MCU's All hooked up to VCC. And let's say they're all connected to ground through an NPN transistor or NMOSFet. Can I use that transistor to switch the MCUs on\off? I'm pretty sure I can but just want to make sure. Thanks!

EDIT: I guess the concept wasn't simple enough, so I'll make it simpler.

You have an MCU. You have a transistor. If I place an NMOS transistor between the MCU and GND, OR if I place a PMOS transistor between VCC and the MCU, can I switch the MCU on and off physically? Do not tell me to do it with code. I need to be able to do it physically.

And please do not post if you're just going to berate this concept. I design for people. I don't always get creative reign. All I wanted to do was see if I could or not, bot get a lecture on the mechanics of microcontrollers. Sorry for being blunt, but I can't win on this site. Thanks

  • \$\begingroup\$ Are you trying to solve a specific problem? \$\endgroup\$ – Ignacio Vazquez-Abrams Jun 6 '16 at 3:42
  • \$\begingroup\$ Like, controlling the transistor from the AVR it's connected to? \$\endgroup\$ – Passerby Jun 6 '16 at 3:45
  • \$\begingroup\$ I did. I said I wanted to switch between MCUs. But only one can be active at any given time. There is a 5th MCU controlling the group. I don't want to have power switches and extra regulators laying around. So transistors seem appropriate \$\endgroup\$ – Dominic Luciano Jun 6 '16 at 16:04
  • \$\begingroup\$ Answer: Yes. No. Depends on the Circuit. But generally, No. The simply reality, which you persistently refuse to acknowledge is that if you are going to break the circuit by switching power or ground, you must also add a switching element to disconnect any I/O which could provide an alternate path to the disconnected power or ground, thus re-completing the circuit through a protection diode not rated to power it, and drawing power from an external circuit also probably not rated to power your MCU. Only if you have no such I/Os will simply disconnecting power be workable. \$\endgroup\$ – Chris Stratton Jun 9 '16 at 7:21

You can do it that way if you are not hooking the AVRs up to anything else. I doubt that's the case.

If you try to control power to the AVRs at the ground side, you will be both raising the AVRs ground above the ground of other devices, and lowering the total voltage powering the AVRs. You don't want to go there.

Instead, switch at the high side. Keep the ground clean. Make sure you have enough margin in Vcc to power the AVRs

| improve this answer | |
  • \$\begingroup\$ High side switching is only workable if no I/Os can complete a circuit to the positive supply bypassing the switch. And low side switching only works if no I/Os can complete a circuit to the negative bypassing that switch. You are somewhat correct in the original assertion that the I/O connections matter. And also that a voltage drop across a switch on the low side is more likely to cause issues with interpretation of signals than a drop on the high side. But the primary issue with switching power while leaving I/Os connected can exist in either case. \$\endgroup\$ – Chris Stratton Jun 9 '16 at 7:17
  • \$\begingroup\$ @ChrisStratton - Agreed. \$\endgroup\$ – Mark Jun 9 '16 at 8:14
  • \$\begingroup\$ See, Chris, this is how you should've answered. Clean, to the point, intelligent, and without arrogance. Thanks, Mark. This one goes to you \$\endgroup\$ – Dominic Luciano Jun 12 '16 at 21:56
  • \$\begingroup\$ You can pick an answer to accept, but you can't choose which device physics apply. You might also note that many including Mark explicitly agreed with the issues raised that you seem so determined to ignore. So, ignore the facts if you wish, but you do so at your own peril, and apparently that of your customer, whose secrets you would in no way needed to have spilled to ask an appropriate question here. \$\endgroup\$ – Chris Stratton Jun 12 '16 at 22:08

I said I wanted to switch between MCUs.

That is not something you can properly achieve by switching their power or ground while the I/O signals remain connected. Like most current chips, AVR devices are not designed to tolerate voltage on their I/O pins more than a small mount outside the range of their power pins. Attempting to do so will end up back-powering the chip through the protection diodes, which likely means exceeding their current rating, loading the I/O signals to ambiguous voltages, and achieving an uncertain "quasi operation" of the MCU. None of that is good.

Instead, you should design a way to keep the MCU power supplies applied, but inactivate the deselected MCUs to reduce power consumption and release the shared I/Os to be driven by other devices.

Normally a simple way to force this externally would be to hold the deselected devices' reset lines low, though this will consume a small amount of power in the internal pull-up resistor. On AVRs configured for ISP there is the more serious problem that holding the reset line while the ISP programming lines (which are typically the SPI lines) are allowed to transition can accidentally mimic an ISP programming operation enough to end up accidentally altering the flash memory contents (this is not a merely theoretical risk, I have seen it happen).

So instead, you may want to build a shutdown mechanism into the software of each MCU. This would tri-state all the I/Os (set them as inputs) and then suspend operation, either permanently (until reset/power cycle) or until some wakeup condition like the assertion of a signal or pattern unique to each MCU.

| improve this answer | |
  • \$\begingroup\$ I can't inactivate the MCUs. Only one can be on at any given time. I have another MCU controlling the EN function of the 4 MCUs. So they have to be off completely \$\endgroup\$ – Dominic Luciano Jun 7 '16 at 15:31
  • \$\begingroup\$ That is a false requirement that arrises from not understanding the technology. If you want to depower them you will also need circuitry to disconnect the signals which you will probably find impractically complex. \$\endgroup\$ – Chris Stratton Jun 7 '16 at 16:08
  • \$\begingroup\$ No, they really have to be off completely. Only one can be on at any given time. I understand the tech, and I understand how to "inactivate" the MCU, but I need them to be completely off, no juice, no anything. Like they don't exist. I just don't think you're understanding my requirements. Thanks. \$\endgroup\$ – Dominic Luciano Jun 8 '16 at 2:08
  • \$\begingroup\$ Unfortunately, your insistence suggests you do not yet understand the technical issue. An IC such as this which includes protection diodes is when depowered most definitely not one which acts like it "does not exist" but is rather one which heavily loads its I/Os, preventing other circuitry from using them. If you want one to be a ghost, you need to power it, tristate the I/Os, and suspend it with the clocks stopped, at which point it will consume a few microamps and load the I/Os as lightly as can be achieved without inserting some other switching mechanism to literally disconnect them. \$\endgroup\$ – Chris Stratton Jun 8 '16 at 2:54
  • 3
    \$\begingroup\$ No, you haven't got the point about protection diodes, unless the MCU s have no inputs. \$\endgroup\$ – pjc50 Jun 9 '16 at 7:10

You can do that so long as you have no loads to ground on the outputs, if all your loads are to VCC or between MCU pins (including from a GPIO to MCU ground) then yes you can turn it off my cutting the ground connection.

But why? These chips have a low power sleep mode that's probably as efficient as your transistor switch.

| improve this answer | |

I agree with the previous commenter that using a power supply with an enable is probably a simpler choice. Connect the output of that regulator to only those chips you want to switch off. Of course, you would still need some other power source for whatever is controlling the switched supply.

However, if you can't do that (for example, you can only have one power supply chip), then there's nothing wrong with switching the ground on and off*** instead of the supply. When implementing power gating inside silicon chips, there are both "header" PMOS switches and "footer" NMOS switches available. In fact, since electron mobility is about twice hole mobility, an NMOS can handle roughly twice the current as an equivalently sized PMOS transistor. In practice, despite this ground switching can be a little more difficult to implement, however, for a variety of reasons. You may want to stick to switching power instead with a PMOS, especially if you multiple power supply rails with different levels (e.g. 3.3 V for this chip, 1.8 V for that).

***This applies to low voltage electronics only, say <5 Volts, NOT to high voltage line-power (e.g. 120 V) distribution. In that case, because circuit ground/neutral is what's tied to actual earth ground outside your house, you would not want to leave the the switched off circuit floating at Hot potential.

| improve this answer | |
  • \$\begingroup\$ I don't work much with PMOS, and I've noticed some have negative numbers rather than the usual positive. Is that significant in any way? \$\endgroup\$ – Dominic Luciano Jun 6 '16 at 20:21
  • \$\begingroup\$ I've noticed positive supply applications with PMOS that have negative numbers instead of positive \$\endgroup\$ – Dominic Luciano Jun 6 '16 at 20:21
  • \$\begingroup\$ Well yes, whereas an NMOS requires a positive Vgs (gate is at a higher voltage than source) in order to turn on and conduct, a PMOS requires a negative Vgs (gate is at a lower voltage than source) to do the same. However voltage is always relative, you could instead talk about Vsg and then we would just flip the signs. In practice, this just means that to turn on a PMOS (allow current flow between drain and source), you connect the gate to a logic 0, ie ground/VSS. To turn on an NMOS, you apply a logic 1 to the gate, ie power/VDD. To shut them off, it's the opposite. \$\endgroup\$ – Evan Cox Jun 6 '16 at 21:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.