Feedback and Discussion

You can ask questions, leave feedback, request help, or report bugs at the bottom of this page. Just type your question or comment into the edit box below and we'll get a reply to you ASAP. If you you leave your email address we'll be able to get you a personal response. You can use the buttons on the edit toolbar to format your text or to add code examples. You can use this form for any:

  • Questions
  • Comments
  • Corrections to the documentation
  • Bug reports (first check to see if it's already reported on the IDE Plus Error Messages or the original Mosaic IDE Bugs and Gotchas pages)
  • Requests for technical assistance

If you have any trouble, feel free to Contact Us. Thanks!



Konfu, 2014-08-27 09:57


I find your "Battery Operated Latching Power Switch" very useful.

I now just wonder: is there a way to modify the circuit so that only a long press (maybe 2-3 seconds) of the button will switch the circuit on and another 2-3 seconds button-push will turn it off again? I need to prevent someone from accidentially switching on the circuit. ;-)

Any help would really be appreciated and I guess a valuable add-on to this circuit.

Nick Guerette, 2014-10-01 03:26

Hi Konfu,

It is difficult to introduce a delay in both turn-on and turn-off using the simple dual-MOSFET circuit you referred to. However, adapting one of the circuits based on logic gates under Latch and Toggle Power Circuits, it should be possible to create a delay in both turn-on and turn-off. Try the following circuit:

Circuit schematic of two NAND gates with positive feedback creates a delayed toggle latch.

This is a simple example, and has its limitations, particularly that if the user holds down the button too long, the circuit will switch states again after a shorter delay, possibly causing undesired behavior. However, it's a useful starting point. The circuit above lists surface-mount components, but if you wish to use through-hole components, you may select from the following based on your power supply voltage range:

Robert, 2014-08-17 11:03

I use code from Pi Supply (, It's works, but I have problem with hardware shutdown Raspberry PI after software shutdown. I created code "gpio.setup(7, gpio.OUT, initial=gpio.LOW)"- responsible for hardware shutdown, but I don't know how to put into code from PI Supply and get sequence software shutdown > next hardware shutdown. Please help :)

Robert, 2014-08-17 19:55

Ok, I use this code from site Is it possible to set a time delay switch off hardware shutdown ?. I set runlevel 0 for halt, but it still too fast for shutdown system.

Nick Guerette, 2014-08-27 00:31

Dear Robert,

I am glad you solved the voltage drop problem. I've re-hosted your schematic here (click for full size). forum_2014-08-04t1331_pi_power_sch.jpg The easiest way to delay the hardware shutdown is to increase the size of the 10 μF timing capacitor. For instance, if you increase it to 100 μF, it will take about ten times longer for the power to turn off after the output pin has been set low. There are two side effects to this, however:

  • It will also take ten times as long to force power off by holding down the button.
  • After power is turned off, it will take a comparable amount of time until power may be reliably turned on again, due to the time it will take the larger capacitor to discharge. During this time, pressing the power button may turn the circuit on only briefly, possibly causing undesired behavior.
Robert, 2014-08-27 07:21


To safely software shutdown I used in code: call('umount /boot', shell=True), In next lines: gpio.setmode(gpio.BOARD)gpio.setup(7, gpio.OUT) gpio.output(7, gpio.LOW).

Best Regards, Robert

Robert, 2014-08-11 20:20

Problem with drop the voltage to 4,7V solved, I changed USB cable and GPIO4, I use /boot/cmdline.txt and add config parameter bcm2708.w1_gpio_pin=<GPIO_pin_number>, and release GPIO4 for smart power :)

Robert, 2014-08-04 13:31

I have a problem with your solution when I use it, I drop the voltage to 4,7V. When connecting directly from the DC adapter is OK (5V), maybe its problem becouse I used SMD adapter (SO8 to DIP8) with precision dip socket, below pictures designed PCB:

Is it possible use a different GPIO than GPIO4 ? Do you have some program to use software shutdown ?

Best Regards Robert

Seppo Nurmi, 2014-06-25 12:29


I have High voltage push button toggle switch with inrush current limiter . Dual FET is AUIRF7343Q. N-mosfet feedback is wired from high voltage and zener diode (15V) limits the gate voltage. The problem is that it stays on as long as I press the ON button. What is the problem with it? What is the purpose of R8? Is it needed at all if I remove the inrush control from the circuit (D6, R7, C7)?

Nick Guerette, 2014-07-30 21:36

Dear Seppo,

I've re-hosted your schematic here (click for full size).


I do not see any problem with it; it seems faithful to the example circuit using-high-side-mosfet-switches-at-higher-voltages, except for using another 15V zener diode to limit the voltage to the N-MOSFET gate instead of the regulator output, which I do not see a problem with. I suggest verifying the wiring; as the circuit is designed, if you hold down the power button, the circuit should turn on for a few seconds, then turn off and remain stable in that state until the button is released, at which point the 1 μF capacitor will discharge and it will be possible to turn it on again. If the power output is on only when the button is held down, this suggests a wiring problem somewhere; perhaps the gate and drain of the N-MOSFET are reversed, such that the button is directly controlling the P-MOSFET.

Seppo Nurmi, 2014-07-31 17:42

I'm using printed PCB With no errors on DRC. It works for a while with some modifications. R5 300k –> 100k, R7 100k –> 10k, remove D6 and C7. At the moment the circuit does not work with capacitive loads (forgot the diode next to the feedback resistor R4). Also there's issues with higher voltages. The circuit does not handle 28VDC input voltages. Probably my Design does not filter the voltage peaks well enough in load dump situations.

Robert, 2014-06-23 14:03

Of course for 10 uF use electrolytic capacitor ?

Best Regards Robert

Nick Guerette, 2014-06-23 17:55

Hi Robert: Regarding the Controlled Turn-ON and Shutdown of Microcontroller Products circuit, the 10 μF output filtering timing capacitor may be either ceramic or electrolytic. The other smaller capacitors must be non-polarized ceramic.

Ed Slate, 2014-06-16 13:05

Hi, do you have mechanical drawings for the PDQ board? I was able to locate them for the QCard, but not the PDQ board. Thanks!

Nick Guerette, 2014-06-20 03:37

Hi Ed,

There are basic mechanical drawings of the PDQ Board and Wildcard form factor hidden under the Accessories section:

Robert, 2014-06-16 06:46


1. I would like to make a similar circuit, maybe you know a replacement for the IRF7319 (SMD - Surface Mounted Devices) version DIP (THT - Through-Hole Technology) ? 2. Testing the "switch ON" be done without a connected GPIO? (if set to auto-off). 3. Questions to parts - diode: 1N4001, 1uF capacitor: what type ?, 0.1uF capacitor: ceramic, 10uF capacitor: electrolytic 4. Do you have a PCB design?

I try to make a version THT, SMD is too difficult for me.

Best Regards Robert

Nick Guerette, 2014-06-20 03:32

Hi Robert,

The Controlled Turn-ON and Shutdown of Microcontroller Products circuit requires both an N-MOSFET and a P-MOSFET, both provided by the surface-mount IRF7319. It seems that multi-MOSFET chips are uncommon in through-hole packages, so you'll need to use two separate discrete components instead. Discrete through-hole MOSFETs are generally intended for high-current switching, so will be larger than necessary for this application. MOSFETs with otherwise similar characteristics you could use in a push-on hold-off circuit are:

Edited to add components with higher VGS

The circuit will work fine without using an I/O pin, but the microcontroller will have no way to detect that power is being shut off, or to shut itself off. 1N4001 or any other silicon diode will work fine. All capacitors used should be non-polarized ceramic -Edit: except for the 10 μF timing capacitor which may be electrolytic. If you are using through-hole components, I recommend using a simple prototyping "perf" board.

Robert, 2014-06-25 09:50


LastLast, one question :), Is it possible use a different GPIO than GPIO4 ?

Best Regards Robert

Ed Slate, 2014-06-03 16:36

I'm a new user to Mosaic+ and Mosaic Terminal and seem to be getting frequent "blue screens of death" while downloading files to my PDQ board from an XP host. After getting a blue screen of death, I can reboot the host and successfully download the very same file to the target. Any suggestions?

Nick Guerette, 2014-06-03 20:58

Dear Ed,

I'm sorry to hear that you're seeing a BSOD! For technical support with our products, feel free to Contact Us directly. We've never seen a Windows crash during usage of Mosaic Terminal before, but there are several things that may be at fault. This may be a bug in Mosaic Terminal itself, but it's best to rule out other possible causes. The other software that is heavily exercised in downloading code to a controller is the serial port driver, and driver problems are more easily able to cause a Windows crash than application software as well.

If you are using the usb-to-rs-232-adapter sold by Mosaic, then follow the link above and then click the link for the FTDI driver update page, and try downloading the latest driver from FTDI. If you are using another USB to RS-232 adapter or a built-in serial port, try updating the driver from Windows Update as follows:

  1. Right-click on "My Computer" and select "Properties".
  2. On the "Hardware" tab, click on "Device Manager".
  3. Expand the entry for "Ports (COM and LPT)".
  4. Right-click on the COM port you are using with Mosaic Terminal and select "Update Driver…"

You may also check the website of the manufacturer of the adapter (or for a built-in serial port, your computer or motherboard manufacturer) for updated driver software that may contain a bug fix.

If that does not work, we will need to isolate the cause of the BSOD using information provided on screen or in the crash dump. The first place to start in investigating a BSOD after the fact is to look at the Windows Event Log:

  1. Open the Control Panel under Start→ Settings.
  2. Click on "Administrative Tools", and then "Event Viewer".
  3. In the navigation pane on the right, select "System".
  4. In the list of logs that appears, look for an error at the time of the BSOD. Double-click on that error and see if it provides information about the nature of the error or any files related to it.

When the BSOD happens, there is information on the screen about the error that may also be useful, but by default Windows XP restarts immediately, making it difficult to read or record that information. To prevent the automatic restart:

  1. Right-click on "My Computer" and select "Properties".
  2. In the "Advanced" tab, in the "Startup and Recovery" box, click the "Settings…" button.
  3. Under "System Failure", un-check the box labeled "Automatic Restart". The next time the BSOD happens, you'll have time to read and write down the information it provides, which will include an error code and may also reference files that may be related to the error.

The dialog box above is also where you can ensure that Windows will create a Kernel Dump or Complete Dump, usually at C:\Windows\MEMORY.DMP . As a last resort, if the problem cannot otherwise be isolated, we may be able to set up a way for you to transfer the memory dump file to us to analyze using the Windows debugger, WinDbg.

Jose Lindo, 2014-05-11 18:14

Our Mosaic Template for dokuwiki is the best i can see.

Is possible download this greater template


Paul Clifford, 2014-05-14 22:47

Dear Jose,

Thank you. We are currently working on making a downloadable version of our dokuwiki template so that others can use it. We've got a few tasks to do: we made some changes to the kernel that we'll need to migrate to plugins instead, and we need to test it with the newest dokuwiki version. But we're eager to get the template into others hands so they can use it too.

Ruedi Heimlicher, 2014-05-10 10:21

Hi I am experimenting with the ON/OFF-switch. It works as it should, with one exception: I have an EDIMAX WLAN-adapter that works great when the raspi is powered via the micro-USB, but not with tho ON/OFF-switch. I cannot ssh to the raspi. Adding a big capacitor - 1000uF - to the power-output after the MOSFET helps sometimes, but not always. Any ideas? Thanks Ruedi

Paul Clifford, 2014-05-14 22:52


My guess is that the power supply you are using can't sustain the current required by both the RPi and the WLAN adapter. That adding the capacitor sometimes helps indicates that it is smoothing ripple or providing peak current that you power supply can not. The P-channel MOSFET adds a little voltage drop through the circuit, but just a little, so my only guess is that the power supply you are using has marginal capability to begin with. Let me know what else you find.

Ruedi Heimlicher, 2014-05-15 15:04

Hi and thanks for your response. The problem was the P channel MOSFET I was using on my breadboard. I read somewhere that the circuit also works fine with discrete MOSFET's, but the P type I had lying around had a threshold voltage of 2 to max 4V, and that apparently was too much. The PCB with the IRF7319 works now fine. I used a regulated power supply delivering 5V, and the output looked fine on the (100MHz)scope.

Paul Clifford, 2014-05-15 19:59

Reudi, Glad it's working now. Yep, the MOSFET specs really do matter! Using a supply of 5V, the P-channel of the IRF7319 will drop well less than 0.1V with currents up to 3A, so it's a good choice. Many newer MOSFETs have very low rDS_ON, much lower than MOSFETs available ten years ago.

Alex, 2014-03-20 23:15

Fantastic schematics and explanations, but I would like to find out if:

1. This circuit would still function at 3.0 to 4.2V supply voltage (used to drive the ENABLE line of an LVDO)

2. A 1s delay Power-ON delay could be introduced instead of a short press

3. Does this switch configuration effectively debounce it?

Thank you so much, Alex

Alex, 2014-03-21 05:38

Apologize for not referencing the circuit in question - the Raspberry PI ON/OFF controller:

Thanks again!

Paul Clifford, 2014-05-14 23:12


1. The circuit should still function down to 3.0V. The MOSFET pair specified, the IRF7319, has gate threshold voltages of about 1V for both MOSFETS. The IRF7319 datasheet shows detailed specs down to 3V. The series pass MOSFET can provide 1.5A with a 5V supply, but considerably less than 1A at a 3V supply. That won't work very well if you want to get a lot of power through it, but if it's used just to drive an ENABLE line it would work fine, even at much lower voltages. If you want to pass a lot of current at lower voltage then it's best to use separate MOSFETs. You can choose a series pass MOSFET that can provide more current at a lower gate-source turn-on voltage, and operate down to much lower voltages. For example, the SSM3J304T can provide more than 2A current with a voltage drop of less than 0.2V, at a power supply voltage of 2.5V.

2. You can add a 1 sec turn on delay (requiring that the switch be pressed for 1 sec before the circuit responds) if you use separate on and off switches, but it's trickier if you want to retain only one switch. I see if I can come up with a reliable circuit; if so, I'll post it.

3. Yes, this switch configuration debounces the turn ON/OFF perfectly.

Best regards!

J. Lane, 2014-02-28 23:32

What kind of caps are those in figure 6? Are they ceramic? I noticed they are not polarized.

Nick Guerette, 2014-03-13 20:40

Yes, in general non-polarized capacitors on our boards are ceramic chip capacitors, most commonly 0603 package X7R type with 20% tolerance, but sometimes larger packages for higher capacitance or higher voltage limits, or tighter tolerance for timing circuits.

K. Nelson, 2014-02-08 00:00


Thank you for the instructive circuits and tutorials. I intend to build an on/off circuit for an RPi - 2 questions

1. The diode is labeled as a BAV99, which is a switching diode array, not a single diode as pictured in your circuit. Is this really the correct part number? 2. The Auto ON/Auto OFF jumper is not quite clear as it is explained, although I think I am reading the diagram correctly. If the switch is set to ground, then the circuit will always default to ON, until it is turned off with the momentary button. Is that correct?

Thank you for your help.

-K. Nelson

Nick Guerette, 2014-03-13 20:59

1. Yes, in this case we're just using one of the two diodes in the BAV99 part. It's inexpensive enough that from an inventory management perspective, it's simpler to use this part both where two diodes in series are needed and where a single diode is needed, rather than stocking a separate part for single diode applications. From a technical perspective, any silicon diode will work in this application.

2. Yes, you are correct. The Auto ON/Auto OFF jumper only affects what happens when external power is initially applied; shortly after power is applied the 0.1uF capacitor charges and then the circuit is controlled by the On/Off switch.

mustafa bayraktar, 2014-02-06 21:27

Dear Sir;

I have a program about writing & reading from RS232 however it drops bytes and I really cannot read what i write what can be the issue? Can it be related to my low ram which is only 1024 best

Nick Guerette, 2014-03-13 21:01

For this issue I suggest looking to online forums for general programming questions, such as:

Enter your comment. Wiki syntax is allowed:
If you can't read the letters on the image, download and play this .wav file so they will be read to you.