NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Support Forum » P-MOSFET
February 04, 2011 by kvjohnso |
If I had a little 9V circuit with a few LEDS and wanted to use a MOSFET to control it, wouldn't I have to use a p-channel MOSFET if I'm only sending +5V to my MOSFET's gate since the gate would be less positive than then the source pin? Thanks, Ken |
---|---|
February 04, 2011 by hevans (NerdKits Staff) |
Hi Kvjohnso, If you are looking too put the MOSFET on the positive rail, then yes, you would need a p-mosfet. My suggestion is to use an n-mosfet (which are included with the USB NerdKit) and put it on the low side of the LEDs, to "sink" the current down when the voltage at the gate goes high. It would be quite similar to driving a motor off a 9V power supply like we do in our motors and microcontrollers video. Hope that helps. Humberto |
February 04, 2011 by kvjohnso |
Thank you. Sorry, but what do you mean by the low side of the LED? Ken |
February 04, 2011 by Rick_S |
The low side of the LED is the - side or the cathode. The anode would be the + or high side. Rick |
February 04, 2011 by kvjohnso |
Thanks for writing back Rick. I guess I don't know what I'm doing. I'm trying to use pin 24 of the MCU from the led_light project to trigger the gate of my MOSFET to control a 9V batter and two led circuit. I'm really missing some key concept with the MOSFET. I just have a 9V batter lighting up two LEDS and I wanted to cut the circuit and insert the MOFSET's source and drain. I have zero clue what I'm doing wrong - or doing :). Thanks, Ken |
February 04, 2011 by kvjohnso |
Here's what I've done so far. Any ideas what's wrong (or right :) ) ? |
February 04, 2011 by mongo |
You might want to tie the negative of both power sources together. The signal is probably making it out but there appears to be no return path. |
February 04, 2011 by kvjohnso |
Thanks for the reply but it didn't seem to work. The LEDs are just staying on even though the meter shows that +5 volts is only coming from the MCU in 10 second intervals (on 10 sec off 10 sec). Thanks again, Ken |
February 04, 2011 by n3ueaEMTP |
Ken, you’re on the right track. I did have this all written out but I think pictures work better: The resistor is just the first one I grabbed, I think it's a 1M ohm resistor so its there just to show where it would go. The MOSFET is a 2N7000, exactly what comes in the Nerd Kit.
I hope this helps Chris B. |
February 05, 2011 by kvjohnso |
This really helped. Thank you so much. The pictures were perfect. I replaced the LED with a 9V relay and now the relay "clicks-on" but it won't turn off after I send the "off" signal from the MCU. It will only turn off if I pull the mosfet out (bad idea I know) or undo the relay's 9v source.. Any ideas? Sorry for the trouble. |
February 11, 2011 by BobaMosfet |
kvjohnso- What is the part number(s) on the solenoid, so we can look at a datasheet? BM |
February 13, 2011 by n3ueaEMTP |
Kvjohnso Here’s what I see: 1.It looks like you are using one 9V battery for your nerd kit and another for your relay. Not entirely necessary but it will prolong your battery life. 2.If you are using the MOSFETs that came with your kit, it appears you have everything wired to the GND of the circuit. 3.I noticed the two batteries do not have their respective GNDs tied together. 4.It also appears that you have the 9V of one battery tied to the GND (blue rail) of the circuit. Here is what I would do: 1.on the battery at the bottom of the picture, match the colors to one another (RED to RED and BLACK to BLACK) To test this, tie the middle pin of the MOSFET to 5V(Don't forget to disconenct the MCU first). The relay should energize until you disconnect the 5V. Whenever I use a MOSFET, I try to involve an LED so I am sure the MOSFET is working correctly. Basically what I just typed is already shown in the pictures above, just substitute the relay for the LED. DISCLAIMER: I may be WAY off base and if I am, I’m hoping someone smarter than me can correct my error :-) Chris B. n3ueaEMTP |
February 15, 2011 by kvjohnso |
Chris and Company. I was on travel for a bit so sorry about delay getting back to you all. I took your advice and a "clue" from Chris and now everything is working. The relay needs 9V to engage. I Liked your LED idea. A lot easier to trouble shoot. Thanks. Question (again), if my DC power supply gave enough volts, how would I wire it to run both the MCU and the 9V relay. Thanks again for all your help. Ken I cleaned it up a bit and here is the latest - that's 9V coming in from my DC power supply. |
February 16, 2011 by mrobbins (NerdKits Staff) |
Hi Ken, I think that the reason that the relay coil won't turn off is that the MOSFET may be wired "backwards" -- with source and drain reversed. That is, I believe that the photos posted by n3ueaEMTP actually are actually showing the 2N7000 MOSFET in a configuration where it would be permanently on, and wouldn't be able to turn off. Basically, you should have the 2N7000's "Source" pin to ground, the "Gate" pin to the microcontroller pin, and the "Drain" pin connecting to the "low side" of your load. The "high side" of your load would then connect to +9V or similar. If source and drain terminals are inadvertently reversed, you'll find a undesired behavior which has to do with something called the MOSFET body diode, which is basically a built in diode which is simply a byproduct of how the MOSFET is manufactured. For an n-MOSFET body diode, anode = source, cathode = drain. Therefore, when the source terminal is at a higher voltage than the drain terminal, current will flow, regardless of the gate-source voltage. However, looking closely at the most recent photo that you've posted, I think you've actually got it OK in that regard -- source terminal to ground. But the way that the second power supply and relay are connected do not look exactly right. Try this:
If you then want to run everything from the same power supply, then you can simply remove the 9V battery and connect the positive supply of your power supply to the input of the 7805 voltage regulator. Hope that helps! Mike |
February 16, 2011 by kvjohnso |
Perfect. Once again, your help is incredible. It's working nicely..... I do have one last question. I'm learning a lot of EE stuff these past few months thanks to everyone here. All the source code is great. However, I now know how to program the MCU and read data from the serial port, but one little part is missing... Is there any NerdKit C examples on a standalone program to send signals via the USB/Serial cable? I'd like to be able to override the sensor that's controlling the MOSFET gate (PC4) from the command line. I've tried googling for some explanations but my search words weren't too successful :(. Thanks again!!!!!! Ken |
March 26, 2011 by esoderberg |
I'm working on a similar problem. I'd like to run a 12v/5A linear actuator, controlled via PC1 and PC2. I just want to run it all the way to its limit switch with PC1 and then all the way to opposite limit switch with PC2. Just running in one direction seems easy enough, with an N channel transistor on the low side completing a circuit. But as I want to be able to reverse the direction, I need to control the high side as well. Below is the circuit I came up with. Any comments on whether or not it should work appreciated. |
March 27, 2011 by esoderberg |
Does posting images hosted on Google docs work? Thought I followed the instructions on the above post for posting an image, and the image comes up if you right click open in new tab, but obviously shows as broken. |
March 27, 2011 by esoderberg |
Well I suspect that one could direct link to a google doc, but I couldn't get it to work and just followed the recommended method. |
March 27, 2011 by esoderberg |
A little off thread topic, but I finally figured out how to post an image hosted on Google Docs after several failed attempts seen above. Upload and open image on Google Docs. Instead of copying the link that says "link to this page" on the right side of the screen, right click on the Download menu in the upper left. It will give you an option to "copy link address", the link you get this way works per NK instructions, the other "link to this page" does not. Eric |
Please log in to post a reply.
Did you know that our USB NerdKit comes with everything you need to get started with microcontrollers? Learn more...
|