Chat freely about anything...

User avatar
By lingyueqing
#73250 I've recently gotten interested in electronics and so after doing some reading I've decided to have a go at building my own simple electronics circuit to control a 12V RGB LED Strip with wifi. I've chosen the ESP8266 chip, but at the moment I'm still focussing on getting it all connected.

I have a question and a problem:

About the MOSFETs:
I decided on mosfets after having read rants against the commonly used TIP120s, but for my application do I need to worry about the difference between standard mosfets and logic level mosfets?

I've found these two at local store: IRLZ44N(PBF?) and IRLB8721(PBF?) Apparently one is logic level and one's standard? Which do I use? They're the same price.

Problem with voltage input:
My LED Strip needs 12v, and the breakout board has a voltage regulator on board that takes in 4-6v. This means that I either hook up the strip directly to a 12v supply and find a way to step it down to 5v for the chip, or power the strip directly from 5v and then find a way to step up to 12v for the strip. Which way would you recommend? I assume stepping down is easier.

And with the chip drawing up to 500mA and the strip up to 1A, I don't think a linear regulator like a LM7805 would suffice; would a buck converter like the LM2596 work? Only thing that's stopping me is I've heard that due to the switching nature of buck converters they introduce a lot of noise and input voltage ripples to devices sharing the power supply. Do I need to worry about this if they're both connected to a 12v power supply and in the same enclosure?

Image

EDIT2: Updated Circuit

Image

EDIT1: Links for MOSFET datasheets as requested:

IRLB8721 - http://www.kynix.com/uploadfiles/pdf0125/IRLB8721PBF.pdf

IRLZ44N - http://www.irf.com/product-info/datasheets/data/irlz44n.pdf
User avatar
By eriksl
#73282 Actually this question would be better suited on an electronics specific board. Having said that, I think you're pretty good underway, already you did some research, it just needs a bit of fine-tuning.
lingyueqing wrote:I decided on mosfets after having read rants against the commonly used TIP120s,

There is nothing wrong with TIP120's, I've been using them for years and years, driven from all sorts of microcontrollers. It's just that if you step up to higher power requirements (think > 1 A) they waste some energy and need to be cooled properly. You need to have quite a bit of (power) led strips to get there.

MOSFET's are suited for very high currents, but you need to pick the right one. For small currents/voltages it doesn't matter that much though, if you go higher on them, study the "safe operating area".

MOSFET's have the disadvantage they need to be driven properly. As in: make sure they switch between wide open and fully closed and make the transition fast. There are a few problems here:

- the transition between off and on can be made fast, but it always takes "some" time, so if you increase the (pwm) frequency, it will go through the "grey" area more often and so it will generate more heat. So keep that in mind when picking the PWM frequency (if applicable).
- as the gate of the MOSFET is very high impedance, it will get charged when voltage is applied. This charge won't disappear by itself. So unless you use a "totem pole" or push-pull output, the MOSFET will go on and "never" go off again.
- this also means the driving output will need to charge and discharge the gate, this can go quickly, but it needs to be taken care of (think of mostly nanosecond, but it may be as large as milliseconds in some cases).
- the quicker you're charging and decharging the gate, the more power you need to do so

but for my application do I need to worry about the difference between standard mosfets and logic level mosfets?

Yes you do. Most MOSFET are "wide only" only from 8V on the gate or even higher. If you want to connect MOSFETS directly to the ESP8266, you NEED to use logic level MOSFET's. And even then they won't be maximally efficient.

The ESP8266 does have push-pull outputs and actually they can sink/source a decent amount of current (30 mA) so they're able to drive a logic-level MOSFET directly.

Still I propose you take another route, which will take all "MOSFET worries" away and which wich always make the MOSFET work optimally, even if they're not logic-level (not even recommeded to use these then).

Have a look here: https://www.infineon.com/cms/en/product ... ic/ir4427/

It's called a gate driver. There are more variants of them, from different manufacturers, but this one is easily to come by and also nicely priced. What they do (in short) is to create an interface that's very easily driven (TTL input with Schmitt trigger, look like you're connecting a base from a bipolar transistor with a very high gain, no worries there) to the gate of the MOSFET, where it makes sure, with some built-in MOSFET's, that the gate is charged and discharged at maximum speed. You see it can sink and source about 3.5 A for that purpose, much much more that your average GPIO output. Connect the Vcc to your 12 V and your MOSFET's will get driven at 12 V, which is perfect for most of them.

My LED Strip needs 12v, and the breakout board has a voltage regulator on board that takes in 4-6v. This means that I either hook up the strip directly to a 12v supply and find a way to step it down to 5v for the chip, or power the strip directly from 5v and then find a way to step up to 12v for the strip. Which way would you recommend? I assume stepping down is easier.

My BoB's don't have voltage regulators so I do it this way:

- I have a laptop power supply (because it can deliver a lot of power at a decent efficiency) and connect "everything" to it, lots of ESP's, LED spots, etc.
- that means step down from 19 V.
- for the first part, from 19 V to 5 V, I am using a DC/DC buck converter, they're very efficient and can supply a lot of power (mostly 3A or even 5A). They can be bought from "china" for about $ 1.50 a piece.
- for the second part, from 5 V to 3.3 V I use a low-drop linear regulator, to smooth out any noise from the switching mechanism of the buck converter.

In your case you could leave out the last step and use the internal regulator.

And with the chip drawing up to 500mA and the strip up to 1A,

As I understood it, the LED strip is powered with 12 V so don't needs to be regulated? For 500 mA, over 5 V to 3.3V, a simple lineair regulator will do.

would a buck converter like the LM2596 work?

Yes it will, buy a BoB with one on them for ease, or with one of the cheaper alternatives from XL semi.

Only thing that's stopping me is I've heard that due to the switching nature of buck converters they introduce a lot of noise and input voltage ripples to devices sharing the power supply. Do I need to worry about this if they're both connected to a 12v power supply and in the same enclosure?

The LED strips won't care anyway. If you worried about noise in the output (towards the ESP8266), add a lineair regulator in the output (as explained). I can recommend LM3940, it's specifically designed for this purpose.

Are you going to use PWM? Many implementations are really bad, but you'll know shortly ;-) The ESP8266 doesn't have a hardware PWM module.
User avatar
By btidey
#73286 Personally I much prefer using MOSFETs for switching applications. They are a much superior switch for most uses and very easy to drive providing you pick the right type.

You don't have to worry about providing enough base current to keep them in saturation, they have very low on-resistance leading to very low voltage drop in the on condition, and low power dissipation because of that. The gate can be directly connected to ESP GPIO pins.

You do have to worry about the voltage used to turn them on at the 3.3V logic level coming out of an ESP8266, and this does mean using logic level devices. Not all logic level devices are fully characterised at 3.3V. They may have a low threshold voltage (e.g. 2.0V) but this is the voltage when they just start to turn on but still have significant resistance. The IRLZ44 is like this; at 3.3V it is fairly well switched on but may not yet have achieved its lowest on resistance.

If you get comfortable with soldering small components then there are some great choices with smd mosfets like an AO3400. This is characterised as having an on resistance of 0.05Ohm with gate voltage of 2.5V so is perfect for this type of application. They are also super cheap. Although in a small package, even with a 1A load they would dissipate very little power. The small package can seem daunting to handle but with a decent fine point soldering iron they are fairly easy.

I power most of my ESP8266 from buck converters which are also very cheap and eliminate any worries about heat losses in linear regulators.. The noise is still pretty low and does not cause problems with the esp8266 module, although it is advised to have a decent decoupling capacitor (say 220uF) near the ESP module no matter what type of supply is used.
User avatar
By eriksl
#73325 I forgot to mention a third alternative. If the current drawn is moderator (IIRC below 2A), you can use the gate driver in itself, in place of the MOSFET for the switching. They have a couple of pretty power MOSFET's inside, they just can't be properly cooled when dissipation becomes too high.