Proper use of MOSFET with wittyPi

Hey Guys.

I want to turn on the wittyPi via my Arduno using this code:

void setup(){
    pinMode(7,OUTPUT);
}

void loop(){

    digitalWrite(7,HIGH);
    delay(350);
    digitalWrite(7,LOW);
    delay(100000);
}

I set it to 350ms because of this section in the user manual (http://www.uugear.com/doc/WittyPi2_UserManual.pdf - page 30/31):

Alternatively, if you wish to trigger Witty Pi 2 with external signal, you can use a N-channel MOSFET to achieve this:
[/color]
The signal should be a positive pulse, and the pulse length should be longer than 300ms. Processing a pulse will be equal to taping the switch once, so it will turn on your Raspberry Pi if your Pi is off, or turn off your Raspberry Pi if your Pi is on.[/quote]

If I use it without the MOSFET it quickly boots up, but then immediatley shuts down. But if I use a MOSFET to seperate the voltage-potentials of the devices nothing at all happens. So my question is: How do I have to wire the "Arduino - MOSFET - wittyPi" setup that everything works properly? A diagram or just a quick explanation would be very useful. I am planning to use a 2N7000 transistor for this purpose I hope this one suits my needs. Unfortunately my knowledge on MOSFETs is very low. If you want to know any further details feel free to ask :slight_smile:

Please make links actually be clickable! http://www.uugear.com/doc/WittyPi2_UserManual.pdf

And its pages 27 and 28 of the manual…

Looks like any small signal BJT or nFET will do the job, just has to pull the switch pin to ground for > 0.3s

You might even get away with the poor-mans open-collector and drive directly from a pin:

void drive_oc (byte pin, boolean on)
{
  pinMode (pin, on ? OUTPUT : INPUT) ;  // drive LOW if on true, else let it float
}

void toggle_witty()
{
  drive_oc (witty_pin, true) ;
  delay (350) ;   // yes, a delay, not ideal but its to show the idea
  drive_oc (witty_pin, false) ;
}

This can only work if the device’s own supply is <= the 5V supply of the Arduino, and the Arduino is
powered up whenever the device is (due to the Arduino pin protection diode).