User avatar
yv1hx
Posts: 372
Joined: Sat Jul 21, 2012 10:09 pm
Location: Zulia, Venezuela
Contact: Website

Re: N-channel MOSFET on GPIO

Tue Mar 18, 2014 2:49 am

GregWoods wrote:
pksato wrote:Hi,
How to power lamp, relay, motor, solenoid, and other power device are very common question. I drawed four way to do it.
Image
http://img259.imageshack.us/img259/8032/cu2.png
For reactive devices, like a relay, motor a diode is necessary to absorb flyback current.
@pksato
I like the diagrams. Extremely useful.
Could you provide a little info on the purpose and relationship of the two resistors to the MOSFETs?
I had assumed that for the Raspberry Pi, I would be able to connect a GPIO pin directly to the MOSFET Gate-Source. Is that a bad thing to do?
GregWoods:

I hope this link can be useful for you: http://www.homofaciens.de/technics-comp ... navion.htm Scroll down to the Driving the small signal transistors section.

Good luck! :D
Marco-Luis
Telecom Specialist (Now Available for Hire!)

http://www.meteoven.org
http://yv1hx.ddns.net
http://twitter.com/yv1hx

Sicarious
Posts: 1
Joined: Mon Aug 10, 2015 10:06 pm

Re: N-channel MOSFET on GPIO

Mon Aug 10, 2015 10:34 pm

I'm still a novice when it comes to code and the Pi in general (only had mine a little over a week) However I have just enough knowledge about N-channel MOSFET's to recognize what you're talking about and if someone has already said this then sorry but I've seen this post a few times in my research and may have missed a reply.

I have built my own vaping mods and I seem to recall in my research on those that the FET once activated stays on until source is grounded. I'm not completely sure why yours activates right away unless there is a small current that runs through at start but from what I remember of the post what you have is strictly an on switch. as soon as enough charge is applied then your latch is activated and that's the end of it, it has no way to deactivate. The answer could very well be a very large resistor between gate and source. That's the same way a box mod for vaping works, it allows you to run massive current (we're talking easily over 30A depending on the build) and only use a little 1A switch. Without that resistor bridging gate and source the mod would continue to fire until the batteries are removed once the button is pressed. So what I'm getting at after that long and probably unneeded explanation is that you should perhaps take a detour in your research on your exact situation and look at how diy box mods work and why they work like they do because that's essentially what you want to accomplish but you want to use your Pi as the switch.

Note: I also remember seeing in my research that you can use an external source of power in the setup for the switch but could not find a schematic. That would be the equivalent of your Pi.

ryanlondon76
Posts: 3
Joined: Sun Mar 26, 2017 6:37 am

Re: N-channel MOSFET on GPIO

Sun Mar 26, 2017 6:54 am

I am also thinking of using MOSFTs to control 12V lights or magnetic door latches, so I appreciate all of the info in this thread.

My idea to solve the, "Where do I put the negative terminal from the 12V supply," question is to get a computer power supply (or something similar) which makes +5 (for the Pi) and +12 VDC (for everything else), this way both voltages already share a common 0VDC.

Thanks.

User avatar
yv1hx
Posts: 372
Joined: Sat Jul 21, 2012 10:09 pm
Location: Zulia, Venezuela
Contact: Website

Re: N-channel MOSFET on GPIO

Sun Mar 26, 2017 3:49 pm

ryanlondon76 wrote:I am also thinking of using MOSFTs to control 12V lights or magnetic door latches, so I appreciate all of the info in this thread.

My idea to solve the, "Where do I put the negative terminal from the 12V supply," question is to get a computer power supply (or something similar) which makes +5 (for the Pi) and +12 VDC (for everything else), this way both voltages already share a common 0VDC.

Thanks.
You can use almost any PC power supply to feed your Raspberry Pi and accessories, be sure to use the RED wire (+5V) for feeding the RasPi and the YELLOW wire to feed any devices you need to power with +12V.

The BLACK wire is the common negative for all outputs.

I believe this can be a good starting point: https://en.wikipedia.org/wiki/Power_sup ... (computer)

Good luck and please post your progress.
Marco-Luis
Telecom Specialist (Now Available for Hire!)

http://www.meteoven.org
http://yv1hx.ddns.net
http://twitter.com/yv1hx

dcarothers
Posts: 3
Joined: Tue Jun 14, 2016 8:46 am

Re: N-channel MOSFET on GPIO

Wed Jun 14, 2017 11:43 pm

I know its about 4 years too late, but maybe this will help someone else understand what is going on. N channel MOSFETs, are weird, they require a V+ signal to open the voltage gate. Now how in the holy heck you get a V+ signal out of a raspberry pi, I have no idea. Does someone else have any ideas on this?

User avatar
yv1hx
Posts: 372
Joined: Sat Jul 21, 2012 10:09 pm
Location: Zulia, Venezuela
Contact: Website

Re: N-channel MOSFET on GPIO

Thu Jun 15, 2017 1:41 am

dcarothers wrote:I know its about 4 years too late, but maybe this will help someone else understand what is going on. N channel MOSFETs, are weird, they require a V+ signal to open the voltage gate. Now how in the holy heck you get a V+ signal out of a raspberry pi, I have no idea. Does someone else have any ideas on this?
Never is too late ;)

They operate in a similar way that the Bipolar Transistors in the Switch state (from open to saturation).

Those are a good points for start learning about this:

http://www.electronics-tutorials.ws/tra ... ran_7.html
https://electronics.stackexchange.com/q ... nel-mosfet

Good luck!
Marco-Luis
Telecom Specialist (Now Available for Hire!)

http://www.meteoven.org
http://yv1hx.ddns.net
http://twitter.com/yv1hx

pcmanbob
Posts: 6403
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: N-channel MOSFET on GPIO

Thu Jun 15, 2017 6:27 am

dcarothers wrote:I know its about 4 years too late, but maybe this will help someone else understand what is going on. N channel MOSFETs, are weird, they require a V+ signal to open the voltage gate. Now how in the holy heck you get a V+ signal out of a raspberry pi, I have no idea. Does someone else have any ideas on this?

To get a high or V+ from the gpio you just need to set the particular pin to output and then set it high.
examples
https://thepihut.com/blogs/raspberry-pi ... -gpio-pins
https://sourceforge.net/p/raspberry-gpi ... i/Outputs/
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “General discussion”