I'm trying to understand how the schematic from this github repo works. It uses an RTC to turn on an arduino, via a npn transistor and a mosfet.

fritzing from github

I'm novice with electronics, so this might be a simple circuit. Specifically, I don't understand the combination of the npn and the mosfet. I get that the RTC pin is turning on the npn transistor to allow current to flow, and that somehow that connects the arduino to ground, but I don't get how the grounding part works.

  • how does connecting the mosfet drain to arduino ground permit current to flow?
  • how is current flowing back from arduino ground to vcc ground?
  • what is the role of the capacitors?
  • why is the npn emitter connected to mosfet collector?

I'm sure I have some basic misconceptions, hopefully the above is enough for y'all to help me identify them?

Also, if y'all can help me identify the names of patterns used in this circuit, it'd help me.

Also, ps, what tools might I use to simulate circuits like this one and learn on my own how/what/why? I'm aware of sparkfun's tutorials and some courses on udemy, but what are other go-tos?


Edit: related, Using a DS3231 RTC alarm + MOSFETS to turn on a MCU

  • 1
    \$\begingroup\$ I'm sorry if I'm being blunt, but: that whole idea is bad, and the original author should feel bad. The microcontroller on that board has a built-in RTC which can wake up the arduino itself. No need for an external one. The arduino can power down the radio chip itself, so that it does not used power. The description of sleep modes in that page you link to reads like the author doesn't really understand low-power operation of microcontrollers... \$\endgroup\$
    – mmmm
    Commented Jun 28, 2021 at 1:23
  • 2
    \$\begingroup\$ That NMOS is drawn in a super confusing orientation, but all it does is disconnect the Arduino GND (which isn't a good way to power down an IC, by the way). It should be drawn under the Arduino ground where it would be rotated in the opposite orientation vertically for readability \$\endgroup\$
    – DKNguyen
    Commented Jun 28, 2021 at 1:23
  • 2
    \$\begingroup\$ Also, the switching approach is a really bad idea: it switches the arduino's GND, which means now anything attached to the pins of the arduino can become the reference voltage - with effects like a pin being lower in potential than GND, which can (and quite possibly will) damage the device. \$\endgroup\$
    – mmmm
    Commented Jun 28, 2021 at 1:27
  • 4
    \$\begingroup\$ All in all: don't copy this. \$\endgroup\$
    – mmmm
    Commented Jun 28, 2021 at 1:27
  • 1
    \$\begingroup\$ Agreed with the above sentiments. Poor choice to switch the GND node of the UC. for ANY active silicon device this is a bad idea. For a simple resistive/dumb load it's fine. Sometimes because it's online doesn't mean it's high quality. Good job for asking questions here with people who know! \$\endgroup\$
    – KyranF
    Commented Jun 28, 2021 at 2:07

1 Answer 1


As the comments say, this circuit is terrible. More importantly, it's poorly-drawn. The MOSFET is upside-down, and both the MOSFET source and the BJT emitter are connected to ground. Here's what's going on:

  • R3 and Q1 form a simple inverter that inverts the square wave output from the RTC.
  • The inverted square wave is connected to the gate of Q2.
  • When turned on, Q2 connects the Arduino's ground pin to the circuit ground. When turned off, Q2 disconnects the ground, (theoretically) powering off the Arduino.

Switching an IC's ground connection is a bad idea for a number of reasons. Don't do it!

I'm not sure if the capacitors are really meant to be 0.1 millifarads or if they're the standard 0.1 microfarads. It's standard practice to have a 0.1 microfarad capacitor between a digital IC's power and ground pins to ensure a steady supply voltage during switching. If they really meant 0.1 millifarads (100 microfarads), the capacitor is probably a bad attempt at keeping the Arduino running after its power is switched off.

Microfarads should always be written μF or uF. In old schematics, mF was used as an abbreviation for microfarads. For this reason, it's best to avoid millifarads and the mF abbreviation and just use microfarads.

UPDATE: The intersections between wires are unclear -- another way this schematic is poorly-drawn. The normal way to show this is to have a dot at connected intersections. Another way is to have one wire curve to the side to show an unconnected intersection. Here are some examples:

Wire junctions in schematics

The thickness of the lines shouldn't matter and is probably an artifact of converting the schematic to a PNG.

In your schematic, dots are used only to show some pin connections (which is wrong). Based on the function of the circuit, here are the actual connections:

  • RTC SQW is connected only to the base of Q1, not to VCC..
  • The gate of Q2 is connected only to the collector of Q1, not to ground.
  • The emitter of Q1 and the source of Q2 are both connected to ground.
  • \$\begingroup\$ Oh wow okay, first big whoosh, looking back I didn't think crossed lines necessarily meant a connection. Now I see how at least the circuit is actually a circuit. I'll keep chewing over the rest, thanks to everyone so far for spelling this out. \$\endgroup\$
    – deargle
    Commented Jun 28, 2021 at 4:36
  • \$\begingroup\$ I actually still can't tell from the drawing whether crossed lines actually connect-- I suspect it's only true in some cases above. Which speaks to the criticism of the drawing, if I'm right. Had to look at the other fritzing image on the repo to see what you meant about both being connected to ground. \$\endgroup\$
    – deargle
    Commented Jun 28, 2021 at 4:45
  • \$\begingroup\$ @deargle I think the line that is connecting Q1-E(3) to Q2-G(1) is supposed to connect at the top intersection and not the bottom one. Either way it's BS that it isn't explicit which is reason enough to not trust anything else in the schematic. \$\endgroup\$
    – DKNguyen
    Commented Jun 28, 2021 at 4:58
  • \$\begingroup\$ I guess the lines and intersections are twice as thick in some places... ಠ_ಠ \$\endgroup\$
    – deargle
    Commented Jun 28, 2021 at 5:20
  • 1
    \$\begingroup\$ @deargle I updated my answer with an explanation of the wire junctions. \$\endgroup\$
    – Adam Haun
    Commented Jun 28, 2021 at 5:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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