Continue to Site

Welcome to

Welcome to our site! 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.

N-Channel mosfet switch for ATMega328

Not open for further replies.


Member level 5
Sep 29, 2009
Reaction score
Trophy points
Activity points
Hello all,

I need some help with the following issue: i am trying to control the power state of an arduino by using a BSS138 transistor connected between the GND and AGND of the ATMega328 and the main ground. By applyng a 3.3V to the gate of the transistor i should have the MCU power switched On/Off.
Unfortunately this doesn't work, the 328 cip works even if the transistor gate is connected to GND.

I have noticed that this works only if i disconnect the AGND from the circuit, but because i need to do analog reads i guess that this is not an option.

Can anyone help me to solve this issue? I have attached a screen shot of the schematic.


  • Capture.JPG
    103.8 KB · Views: 99

It is a very bad practive to leave mcu without proper ground connection. It is supplied by pin drain voltage. Don't do this. Switch power or reset pin.

I agree with Easyrider83's comment, severing the device's connection to ground (GND) should be avoided, switching the VDD would be preferable. Although if limiting power consumption is the ultimate goal, a better option might be to utilize the six sleep modes offered by the ATMega328, essentially the ATMega has several switching devices incorporated into its design, with the added benefit of being able to wake from any of these six modes with the appropriate stimulus.

Reference: ATmega48A/PA/88A/PA/168A/PA/328/P Datasheet, Section: 10. Power Management and Sleep Mode, Pages: 39-46
10. Power Management and Sleep Modes
Sleep modes enable the application to shut down unused modules in the MCU, thereby saving power. The AVR
provides various sleep modes allowing the user to tailor the power consumption to the application’s requirements.

When enabled, the Brown-out Detector (BOD) actively monitors the power supply voltage during the sleep
periods. To further save power, it is possible to disable the BOD in some sleep modes. See ”BOD Disable(1)” on
page 40 for more details

The appropriate sleep mode will significantly reduce the power consumption of the device, with the "Power Down" modes typically requiring less than a µA of current.

Another option, although probably unnecessary in this case, is utilize an external CPU/System supervisor device to control the state of the ATMega, which could either power down or hold the microcontroller in a reset state. Of course, as Easyrider83 pointed out this could also be accomplished via a MOSFET and supporting circuitry.


I am using a Olimex A20 to control the transistor, i think i will turn off the VDD for the ATMega using a transitor

Not open for further replies.

Part and Inventory Search

Welcome to