Jump to content

Need help chosing MOSFETs for school project

Hello fellow Linus followers (for whatever reason)

 

So in their recent RGB chair video, they did something with an Arduino, a breadboard and a few MOSFETs to control the RGB LEDstrips. I have to do pretty much the exact same thing for a school project, except for controlling them from a Raspberry Pi. The only problem is, I have no clue what type of MOSFET I need and what to look for in the datasheet. To be honest, I don't even know what the MOSFET does at this point. 

 

My question is: What type of MOSFET did Linus use in the RGB chair video, or what types can I use for this purpose? 

 

I currently have the FQP7N40, but they don't seem to work.. 

 

I found this tutorial which I followed (http://dordnung.de/raspberrypi-ledstrip/), but I can't get the ones they use as the shipping times are like a few months and the project is due in not that long..

 

Thanks in advance and kind regard,

 

Cyborgium

Link to comment
Share on other sites

Link to post
Share on other sites

The FQP7N40 should work just fine. Are you sure you are wiring the transistor correctly? Make sure the sources is connected to ground, the drain to the LED strip and the gate to the Rpi (preferably with a buffer). Also double check the pinout.

pinout.PNG.619dbb28c5d486661e806f6cbd17d57e.PNG

Capture.PNG.0a777bf2287fb8b3f9f169b9d6fcc530.PNG

Quote or tag if you want me to answer! PM me if you are in a real hurry!

Why do Java developers wear glasses? Because they can't C#!

 

My Machines:

The Gaming Rig:

Spoiler

-Processor: i5 6600k @4.6GHz

-Graphics: GTX1060 6GB G1 Gaming

-RAM: 2x8GB HyperX DDR4 2133MHz

-Motherboard: Asus Z170-A

-Cooler: Corsair H100i

-PSU: EVGA 650W 80+bronze

-AOC 1080p ultrawide

My good old laptop:

Spoiler

Lenovo T430

-Processor: i7 3520M

-4GB DDR3 1600MHz

-Graphics: intel iGPU :(

-Not even 1080p

 

Link to comment
Share on other sites

Link to post
Share on other sites

34 minutes ago, dany_boy said:

The FQP7N40 should work just fine. Are you sure you are wiring the transistor correctly? Make sure the sources is connected to ground, the drain to the LED strip and the gate to the Rpi (preferably with a buffer). Also double check the pinout.

pinout.PNG.619dbb28c5d486661e806f6cbd17d57e.PNG

Capture.PNG.0a777bf2287fb8b3f9f169b9d6fcc530.PNG

I'm pretty sure I did exactly as you said, though I do not quite understand what you mean with "preferably with a buffer" and "check the pinout", please elaborate

Link to comment
Share on other sites

Link to post
Share on other sites

58 minutes ago, W-L said:

As long as it's an N channel Mosfet that is rated for 12V or more and the required amperage for driving the LED's it will work. Here is a good guide on this:

https://learn.adafruit.com/rgb-led-strips/usage

 

-Moved to Hobby Electronics-

How do I know if the ones I have are N rated?

 

Also - I do have a seperate power input as the LEDs are 12v and the raspberry pi can only deliver 3.3.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Cyborgium said:

How do I know if the ones I have are N rated?

 

Also - I do have a seperate power input as the LEDs are 12v and the raspberry pi can only deliver 3.3.

They are N channel type mosfets, those are a little overkill since they are rated for 400V but should work regardless as dany mentioned. Are you providing enough of a switching signal from the raspberry pi to mosfet? 

http://www.promelec.ru/pdf/FQP7N40.pdf

Link to comment
Share on other sites

Link to post
Share on other sites

N or P refers to the arrangement of semiconductors inside the MOSFET dye. Without all the electronics and quantum mechanics mumbo jumbo, an N channel means that the switch "turns on" when you apply a positive voltage to the base. What I mean by buffer is actually a driver (didn't quite remember the word a moment ago), since the gate of the MOSFET acts as a capacitor that need to be charged, it can source/sink surprisingly large amounts of current when switching, which may be unsuitable for an SOC as the one controlling the pi. As for the transistor ratings, the datasheet shows its well within spec

Quote or tag if you want me to answer! PM me if you are in a real hurry!

Why do Java developers wear glasses? Because they can't C#!

 

My Machines:

The Gaming Rig:

Spoiler

-Processor: i5 6600k @4.6GHz

-Graphics: GTX1060 6GB G1 Gaming

-RAM: 2x8GB HyperX DDR4 2133MHz

-Motherboard: Asus Z170-A

-Cooler: Corsair H100i

-PSU: EVGA 650W 80+bronze

-AOC 1080p ultrawide

My good old laptop:

Spoiler

Lenovo T430

-Processor: i7 3520M

-4GB DDR3 1600MHz

-Graphics: intel iGPU :(

-Not even 1080p

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, W-L said:

They are N channel type mosfets, those are a little overkill since they are rated for 400V but should work regardless as dany mentioned. Are you providing enough of a switching signal from the raspberry pi to mosfet? 

http://www.promelec.ru/pdf/FQP7N40.pdf

Alright, thanks. I just followed the tutorial I mentioned which said I should just type the following in the bash:

 

sudo pigpiod

pigs p 23 255

 

As this didn't do anything, I didn't bother writing the actual programm yet. Though I might give that a try.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Cyborgium said:

Alright, thanks. I just followed the tutorial I mentioned which said I should just type the following in the bash:

 

sudo pigpiod

pigs p 23 255

 

As this didn't do anything, I didn't bother writing the actual programm yet. Though I might give that a try.

If you want to check the MOSFET without coding, just connect the gate to +5v or +3.3v to turn it on. Also make sure the ground for the LEDs and the pi are connected together.

Quote or tag if you want me to answer! PM me if you are in a real hurry!

Why do Java developers wear glasses? Because they can't C#!

 

My Machines:

The Gaming Rig:

Spoiler

-Processor: i5 6600k @4.6GHz

-Graphics: GTX1060 6GB G1 Gaming

-RAM: 2x8GB HyperX DDR4 2133MHz

-Motherboard: Asus Z170-A

-Cooler: Corsair H100i

-PSU: EVGA 650W 80+bronze

-AOC 1080p ultrawide

My good old laptop:

Spoiler

Lenovo T430

-Processor: i7 3520M

-4GB DDR3 1600MHz

-Graphics: intel iGPU :(

-Not even 1080p

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, dany_boy said:

If you want to check the MOSFET without coding, just connect the gate to +5v or +3.3v to turn it on. Also make sure the ground for the LEDs and the pi are connected together.

Thats an easy way of testing it, thank you! As I cant bring the pi with me, I'll have to check that on Tuesday. Will let you know the result.

Link to comment
Share on other sites

Link to post
Share on other sites

You need to use logic level mosfets, meaning mosfets which turn on completely at low voltages like 2.5v or 3.3v or 5v

In order to turn on, a mosfet needs to have a voltage between Gate (G) and (S) - or in simpler words Vgs - higher than a certain threshold, which varies from mosfet to mosfet. A logic level mosfet will typically turn on completely when the voltage is somewhere above 2.5v and 5v

However, keep in mind that there are some mosfets which can turn on fully at low voltages, but are really "optimized" to be used with higher voltages, and they'll work less great with low turn on voltages (their internal resistance will be bigger, so they'll heat a bit more)

Other things you should keep in mind when choosing the mosfets... 

 

All mosfets have some capacitance between gate and source pins, it's like having a tiny capacitor connected between those pins.  When you want to turn on a mosfet by applying voltage between those two pins, that tiny capacitor charges "slowly" so in turn, the voltage between gate and source raises "slowly" .. i say "slowly" because the turn on will happen in nanoseconds or microseconds but nevertheless it's not instant. Also, this can be a problem if the microcontroller can only provide a limited amount of energy through its pins .. for example, during those nanoseconds where the mosfet receives voltage on its gate pin and that "capacitor" charges inside, the current pulled from the microcontroller can be very high. For example, let's say the microcontroller can output up to 15mA per pin ... a high capacitance mosfet could demand up to 50mA for a few nanoseconds - if the microcontroller can't provide so much current, the mosfet will simply take its time turning on. So basically this is a problem if you have to turn on and off a mosfet hundreds or thousands of times each second... if you need powerful mosfets and high turn on / turn off switch frequency you may have to resort to mosfet drivers.

Same applies when you want to turn on a mosfet - when your microcontroller no longer sends voltage to the gate pin, the mosfet is supposed to turn off, but because there is some capacitance between gate and source pins, that energy will still keep the mosfet on for a bit of time (nanoseconds, microseconds) ... the capacitor will discharge by itself slowly.  it's not much, but it can be big enough if you need to turn on or off the mosfet thousands of times a second.

You can usually speed up the discharge by connecting a resistor between the gate and the source pins of the mosfet .. you could experiment with a 10-100k resistor.

 

So let's look at your FQP7N40 mosfet , open the datasheet.

 

Right from the start on the first page you can see that it says 7A 400v  Rds(on) = 0.8 ohm at Vgs = 10v 

This is a hint, it basically tells you the mosfet is designed and possibly optimized to work with Vgs of 10v  (voltage between gate and source pins) and if these conditions are met, the resistance between the drain and source pins will be low, at 0.8 ohm.  However, so far you don't know if it will turn on and off at lower voltages like 2.5v .. 3v which would be common on microcontroller pins.

Now if you scroll down to page 2 at "Electrical characteristics" you will see in the section "On characteristics"  the entry Vgs(th)  gate threshold voltage which is defined as minimum 3.0v, maximum 5v.  What this says is that, if you buy 100 of them, some will turn on completely with as little as 3v , some will turn on completely only if you have 5v between gate and source. It's their way of saying "we guarantee all parts will definitely turn on with 5v, but some may be better and turn on with as little as 3v"

So if your pi or microcontroller works with 3.3v on the i/o pins, then you may be unlucky and buy one of these mosfets that requires slightly higher voltage than 3.3v to function properly, and then it would suck, your project may behave erratically, the mosfet may turn on or off randomly.

if your microcontroller uses 3.3v on the I/O pins, you should pick a mosfet that turns on completely on 3v or somewhere in that range.

 

Another sign that this mosfet may not be so great is the Rds(on) resistance. One row below the above entry you see there Rds(on) = 0.62 ohm average, 0.8 ohm max when you use a Vgs of 10v and the current between drain and source is 3.5A ... note that they have no value for Vgs = 2.5 ..5v

But let's put aside the Vgs issue and have a look at that Rds(on) value of 0.8 ohm

let's say you want to turn on and off a led strip that consumes 0.5 A per color (if it's rgb) of current from 12v  ( 3 leds on a strip will use 15-20mA per color , so 500mA would be typical for a 50-75 led strip)

 

If you use this mosfet to turn on or off the led strip, when the mosfet is on it would behave like a 0.8 ohm resistor so at 0.5 A of current, there will be a voltage drop on the mosfet equal to   V = I x R  = 0.5a x 0.8 ohm = 0.4v so your led strip will see only 11.6v and the leds will be slightly dimmer (in real world you probably wouldn't notice it due to pwm )

But with longer strips and higher currents,the voltage drop caused by the high internal resistance could be big enough to make the led strip not turn on (due to too low voltage)

 

You have here huge selection of mosfets

digikey us : https://www.digikey.com/products/en/discrete-semiconductor-products/transistors-fets-mosfets-single/278

newark (us, canada) : http://www.newark.com/c/semiconductors-discretes/transistors/mosfet-transistors/mosfet-transistors-600v

farnell (europe, same company as newark just different site) : http://www.newark.com/c/semiconductors-discretes/transistors/mosfet-transistors/mosfet-transistors-600v

filter to see only  N channel mosfets , then filter to see mosfets that have a Vds of at least 12v (don't need that much but it's safer for a beginner) , then search for Vgs lower than 5v, preferrably lower than your microcontroller's pin voltage - if you can't filter exactly by Vgs you can filter by Rds(on) at x V  - try looking for low x V in the list.

 

Examples of mosfets that would work great for your project :  https://www.digikey.com/short/3wp917

It's a rough list , just some basic filters applied , so you'd still have to double check datasheets for Vgs(th) or Vgs(on)

 

For example, one of the first results in that list is a tiny sot-23  BSS316N which is surface mount but the leads are spaced far apart that you can solder wires by hand to those leads.  It can work with up to 1.4A of current, has a low resistace of around 0.2 ohm so it won't heat much and won't affect the voltage, and it has a threshold voltage of 1.2v to 2.0v

If you want something though hole, see PSMN022 from NXP (rebranded as Nexperia). Higher current capability, Vgs(th) between 1.3v and 2.45v, and a Rds(on) lower than 0.07 ohm

plenty of other mosfets there.

 

and btw.  most mosfets are static sensitive, so it's not a good idea to handle them with your fingers. You can damage some of them just by touching them with your fingers... wear gloves or handle the metal parts with something between them and your hands (an insulator) like let's say a piece of paper.

 

 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

21 hours ago, W-L said:

They are N channel type mosfets, those are a little overkill since they are rated for 400V but should work regardless as dany mentioned. Are you providing enough of a switching signal from the raspberry pi to mosfet? 

An N channel transistor or an oldschool NPN transistor turns on when there is a logic one at the gate, while a P channel or PNP transistor turns on when there is a logic zero at the gate. The easiest way I've found to remember this is that N is negative when gate is negative, and P is positive when gate is negative.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

Do you have to use MOSFETs?  Unless you have to, you should not.  You should not be driving low power LED's like these with linear devices like MOSFETs. They are going to get hot and waste a ton of power, also you are going to end up with a rats nest of wires that could be avoided.  If you are running the damn thing with MOSFETs, what is the point of the RPI or Arduino?  you could just use logic gates at that point unless you need wireless communication.

 

You should be using smart LED's like the WS2812b, they have their own switch mode drivers, no linear power wasting BS required, and each LED can be controlled individually.  This tutorial on Adafruit's site is a good overview:  https://learn.adafruit.com/neopixels-on-raspberry-pi/wiring

 

The LED chair project was just a joke.  If their implementation w/ the arduino was not also a joke, than it was a piss poor design that they should be embarrassed of. 

Link to comment
Share on other sites

Link to post
Share on other sites

31 minutes ago, Pyr0monk3y said:

-snip-

Bruh, you do realize that a 300leds 5m 5050 RGB strip is quite literally 4 times cheaper than a 5m 300 leds WS2812? And do you also realize that an average MOSFET with an RDS-ON of 40 mOhm not even gonna dissipate 1 Watt of power? Furthermore have you realized that controlling addressable LED's is not what everyone wants? You sure sound angry mate, and the idea is not to commercialize a super ultra high end product but to experiment.

Cheers

Quote or tag if you want me to answer! PM me if you are in a real hurry!

Why do Java developers wear glasses? Because they can't C#!

 

My Machines:

The Gaming Rig:

Spoiler

-Processor: i5 6600k @4.6GHz

-Graphics: GTX1060 6GB G1 Gaming

-RAM: 2x8GB HyperX DDR4 2133MHz

-Motherboard: Asus Z170-A

-Cooler: Corsair H100i

-PSU: EVGA 650W 80+bronze

-AOC 1080p ultrawide

My good old laptop:

Spoiler

Lenovo T430

-Processor: i7 3520M

-4GB DDR3 1600MHz

-Graphics: intel iGPU :(

-Not even 1080p

 

Link to comment
Share on other sites

Link to post
Share on other sites

The tiny chips inside "programmable" leds are very basic. they're not even microcontrollers, often they're just dumb state machines, a bunch of logic gates doing stuff based on the series of pulses they receive at a fixed frequency. Also, they just pwm the leds to get the amount of intensity desired out of each channel but the pwm is very low frequency which can cause problems.

 

Chips like that ws2812 are good for toys and basic things like small signage, but utterly crap when it comes to more serious stuff, or when you need less flickering, better color accuracy, more brightness levels etc. the actual leds used in the chips are crap (they're not properly specified for specific wavelengths, they have lousy CRI, the current limit can be too low for stuff like advertising signs) , the chip only refreshes the led colors 400 times a second and they only handle up to 800 kbps of data rate (if you want something like 60fps with a lot of leds, the bitrate may be too low (as the microcontroller would have to push the data for each individual led 60 times a second... and often the led strips are made with too narrow traces which makes the voltage drop as the strip increases in length, up to a point where the 5v voltage drops low enough for the chips to stop working. Some variants of these chips used in RGB leds need at least 4.5v to work, others can work from 3.5v and up. 

Also, often 256 shades of a color is often not enough. Especialy for grayscale (if you use just white leds or single color banners), the human eyes are "too good" and 8 bits is usually not enough. Most good led drivers work with 12 bits, and 14 bits would be best.

 

 

Here's an explanation of how one of those chips is designed :

 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Quote

 

Bruh, you do realize that a 300leds 5m 5050 RGB strip is quite literally 4 times cheaper than a 5m 300 leds WS2812? And do you also realize that an average MOSFET with an RDS-ON of 40 mOhm not even gonna dissipate 1 Watt of power? Furthermore have you realized that controlling addressable LED's is not what everyone wants? You sure sound angry mate, and the idea is not to commercialize a super ultra high end product but to experiment.

Cheers

 

 

Your points are valid, I might be too aggressive. 

 

The point I'm trying to make is that running an RGB strip from an arduino/Rpi with MOSFETs should be considered non-ideal.  It is not the best practice.  If you just want to run 5050 RGB strips with MOSFETs, an arduino or Rpi is overkill.  Some logic and dip switches are all you need.  The extra cost of the arduino/Rpi nets you no benefit, it just serves as a crutch for someone who does not know how to design discrete logic. 

 

If the point of the project is to learn electronics design, design logic.  If the point of the project is to learn programming, use an arduino/Rpi and some LED strips that can actually be programmed.  There isn't much experimenting to be done with an Rpi and 3 MOSFETs.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Pyr0monk3y said:

-Snip-

It's called embedded deigns and it makes a lot of sense. Would you seriously use discrete logic (or CPLD or FPGA) to control an RGB strip with an IR remote? Or with PWM signals that depend on time? Or maybe with a serial interface to connect to your PC? What if you want to do home automation? What if you use the Pi as an IoT device along with other functions? Are you gonna say "Well the proof of concept is done, now I'm gonna leave all that progress to sit around and do nothing even though I can implement it to make some cool mood-lights for a third the price Philips is asking" I'm not engineer (yet), so if there is a better way of controlling RGB channels by all means let us know because up to this point I'm controlling a 30W RGB leds with mosfets and I see no problem with that.

Quote or tag if you want me to answer! PM me if you are in a real hurry!

Why do Java developers wear glasses? Because they can't C#!

 

My Machines:

The Gaming Rig:

Spoiler

-Processor: i5 6600k @4.6GHz

-Graphics: GTX1060 6GB G1 Gaming

-RAM: 2x8GB HyperX DDR4 2133MHz

-Motherboard: Asus Z170-A

-Cooler: Corsair H100i

-PSU: EVGA 650W 80+bronze

-AOC 1080p ultrawide

My good old laptop:

Spoiler

Lenovo T430

-Processor: i7 3520M

-4GB DDR3 1600MHz

-Graphics: intel iGPU :(

-Not even 1080p

 

Link to comment
Share on other sites

Link to post
Share on other sites

+1 for logic level FETs. Lower RDSON = more better.

 

MOSFETS are absolutely best practice for controlling constant voltage LED strings.

 

The RPi/Arduino is to provide control. The MOSFETS are to drive the LEDs. These are two separate applications.

 

Finally, I'd argue that blindly suggesting addressable LED strip for an application that doesn't require individual LED control is a very poor design choice. There's negligible power dissipation in a properly specced MOSFET in this application and besides, any addressable LED tape is going to use MOSFETS internally for switching.

 

Quick e2a: I don't mean this to come across in the wrong way - currently writing dissertation and I'm very much in serious report writing mode, hence my serious tone here :P 

Edited by cameroncoats
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×