This post will describe the hardware you need to build your own WiFi controllable LED dimmer! This post will list what you need, why and where I bought it from!
–update 2015-02-02
I have added a zip file with the Fritzing files and gerber files you can use to make your own boards. I have also included a link to dirty PCB’s where you can order them directly and help me out a little bit!
–update 2015-04-09
I have created a v2 of my board. It is optimized in every way and a LOT smaller then the original. I advise everyone who is looking at creating a board to make the v2 version! You can find it here, including an order link and a Fritizing design if you wish to re-use it.
–update 2016-07-06
I tried to update most links so that you can fill your shopping carts easily!
–update 2016-07-09
–update 2017-02-07
–update 2018-01-31
Make sure to check the updated hardware list post. The hardware in this post is mostly NOT maintained!
Chinese Retailers
Since a few years I have been a fan of sourcing small electronic supplies in China. Although not always ‘as good’ as the products you can buy here in the store, they are often not quite bad either and very much sufficient for the task. The price difference is the biggest reason though, it’s just unbeatable, whatever way you look at it.
The main sources for me are http://www.dx.com (Dealextreme) and since recent years http://www.aliexpress.com (Largest Internet retailer in the world). Especially the last one takes some skill to navigate, but when you get the hang of it, it can even be a bargain over Dealextreme!
Aliexpress buyer protection system is unmatched. They have their own payment processor and the seller only gets their money if you acknowledge you have received your package in good order. If you do not, or something else is wrong with it, they see no money, so the seller is very motivated to send you a correctly working product!
So, very much recommended. A word of warning though, use some common sense when buying in China… too good to be true? Well, it probably is. Things work differently over there, there are no copyright laws for instance. See a MicroSD card of 128GB for 11$? Well, it’s 100% fake.
All the items listed in this post have been linked to the respective stores I bought them from and I had a positive experience with!
Components for the ESP8266 soldered prototype board
|
The assembled soldered prototype board |
1. 0,30$ A solder ‘breadboard’. The one I used is the following: Aliexpress Link
2a. 0,93$ A voltage converter (from 12v to 3.3v). The one I used is the following: Aliexpress Link. It has a little screw to adjust the voltage to the desired output (do this BEFORE hooking it up!)
2b. I have since starting using the a different voltage converter. It is a lot smaller which suits the v2 board well (You can read about the v2 version of the QuinLED here). If you wish to order this voltage converter you can find it here!
|
New mini voltage converter |
3. 2,71$ A ESP8266 ESP-01 module. The one I used is the following: Aliexpress Link
4. 0,25$ Some terminal blocks. The one I used is the following: Aliexpress Link
*These do NOT fit well into the solder breadboard, I made them work but the pins are a bit too wide, try and find better one’s! I have since bought some blocks that do fit the board well. You can find them here, or check out the section below where I have 3 colors listed.
5. 2,00$ Two MOSFET’s. The ones I used are type PWRMOS 60V 16A STP16NF06L [STM] and I bought them here: Conrad webshop (It seems you can find them cheaper on Aliexpress now). Look out when shopping for these MOSFETs, I often receive wrong types that only trigger at or above 5v and you need to them trigger under 3v!
6. 0,15$ Solid core wires for the soldered connections (Also work in normal breadboards!). The one I used comes from: Eleshop link
7. 0,10$ Solder tin to link everything together. The one I used comes from: Eleshop link
That brings the grand total of all the material used to aprox ~6,50$! That’s even better then I thought myself. 😉
In the future, when I receive my PCB design from http://dirtypcbs.com the above price will change a little bit. The board will then cost 1,40$ a piece but since I don’t need so much wire and solder anymore total price should be around 8$ total. The amount of time to make the board (and how it will look) will decrease from a few hours to 30 minutes though. So well worth it. 😉
8. 7,90$ The LED strip I use are 5630 (chip size) 5m non-waterproof 12v LED strips. They use about 10 watt per meter at 100% brightness and provide ample light. They are a warm-warm white (~2800K) instead of warm white which you most often get (~3200K) giving it a nice and yellowish warm white light. It took me a while to find a strip I liked because the all give you different colors. This one is the best I have been able to find! You can find them on Aliexpress here. Be sure to specify you wish to the 2800K-3000K version otherwise you will get the normal ~3200K warm white version!
A Tip! Feed your LED strips at both ends of the strip for longer lengths (1.5m+). When using long LED strips something called voltage drop occurs. The copper that inside of the PCB of the LED strip is very minimal and thin. Over the length of the cable it will lose it’s power and thus decrease the brightness of the LED’s at that part. I have seen it as bad as a 5 meter strip having half the brightness at the end of the strip as in the beginning. That is VERY noticeable.
The solution? Feed your LED strips on both sides. This way the total voltage throughout the cable becomes much more stable which means the light the LED’s produce is much more consistent throughout the cable, even with 5m of length. Worst case this means pulling a thicker 1.5mm (14 to 15 AWG) copper cable besides it, but the results will be much more pleasing!
9. ~12$ You will need a 12v power supply. This will power the whole board and it’s components + the LED strip itself. The ESP8266 can only take 3.3v (although mine wants 5v it seems?) and we regulate this down with the above mentioned voltage converter. You can regulate the converter using the little screw on top of the blue tower, use a multi-meter to measure it and set it to the correct output BEFORE you hook the rest up!
5 meters of LED strip will use about 50w to 60w 12v when properly fed.
I often get my power supplies from Aliexpress and although some have failed, most have worked perfectly fine for the last few years. These slim 120 watt power supplies should be sufficient to run the strips. I always advise to overprovision the power supplies so you will not be running them at 100% load at any point.
For smaller requirements I tend to use these 12v 70w versions or even these 12v 36w for if I’m only driving 2 to 3 meters max! It depends on you usage. Limiting the amperage effectively limits max brightness so a low wattage power supply does not have to be a bad thing. I do tend to keep myself to the general rule of always staying in between 20% and 80% of continues usage of a power supply though. Any lower or higher will drastically lower efficiency and lifetime while increasing heat output!
MOSFET?
A MOSFET is basically a switch and a power amplifier. It has 3 pins. A gate, drain and source. The drain goes to your LED’s and provides the switched signal, the source provides your constant voltage (or ground in our case). The gate controls when power flows through the MOSFET and when it does not, it gets hooked up to the PWM pins on your Microcontroller (ESP8266 or Arduino).
There are several important factors which this MOSFET has to confirm to.
1. Voltage range
The MOSFET has to be able to handle the voltage your giving it. In our case the selected MOSFET can handle 60V max, we are using 12V so safe
2. Amperage constant/max
The MOSFET can handle op to 16A of flow with an outside temperature of around 25 degrees Celsius. If that temperature reaches 100 degrees Celsius it can only sustain 11A of flow. Should be plenty. 😉
3. Switching Speed
The switching speed determines how fast the MOSFET can raise and lower it’s voltage on the drain pin, thus letting the LED light up. Although these specs are a bit hard to read for me too, the MOSFET I have selected (STP16NF06L) seems to work very well.
Itss spec sheet lists the following:
Raise time + turn-on delay: 47 ns
Fall time + Turn off delay: 32,5 ns
So one pulse would take around 79,5ns.
Since 1 milisecond (our switching rate) is 1000000ns, we should be VERY safe in our switching rate. 😉
4. Gate input voltage range
The input voltage determines how much voltage is needed to fully open the MOSFET output/drain. In our selected MOSFET this range is from a min of 1v to a max of 2.5v, our 3.3v from the ESP8266 should be more then sufficient.
The way I interpret this is that it states which voltage is needed to fully open the drain, not what it can sustain at maximum. I’ve had 5v on one of these for a while now (using the Arduino v1.0) and it has caused no problems.
Wiring Diagram
I will provide a better wiring diagram later on. For now please take a look at the PCB design I made. You should be able to figure out all the connections and replicate those in your soldered design! The PCB design will become available when I have tested (and maybe revised) it!
|
First PCB design, click to enlage |
I also made a breadboard overview of how to connect everything. Hopefully that explains it a little bit better.
Basically, the + is connected right from the 12v power supply to the LED’s. The minus or ground runs from the ESP8266 to the gate pin of the MOSFET. Ground is directly connected to the source pin and then the middle drain pin is connected to the LED.
That way when the gate receives an open pulse, it opens the source to the drain and the LED gives light.
(The ESP8266 takes 3.3v (it will run briefly on 5v but that will kill it after longer usage!) but sure NOT to put 12v on it!)
Tools needed
Besides needing components, you also need some tools to accomplish the task!
1. A soldering iron or soldering station. I used to have a crappy soldering iron from Dealextreme but recently I threw it away and bought a decent soldering station with digital temperature readout. BIG improvement. I got mine from Eleshop. They sell this 70w station for a very very decent price. A model without the digital readout costs even less!
2. A third hand. This tiny little gadget that holds your project for you so you can use the tin in one hand and the soldering iron in the other. Just makes life easier. Mine has a built-in magnifying glass to check your work with a little LED light. I recommend getting one!
4. 3,85$ Get some dupont cables. This cables come in three different forms and they can help you make easy and temporary connections. They are also often used on breadboard’s to make connections. The female variant fit perfectly on the pins of the ESP-01 and of the serial board making it very easy to get started! I recommend getting a set like this on Aliexpress
5. 3,90$ To help test your setup it might be handy to have some LED’s which can run directly from the ESP-01’s power. I use some small multicolor LED’s for this which can be connected directly into a female dupont cable. Very handy and it simulates what is going to happen with a mosfet and LED strip connected perfectly! You can get them on Aliexpress here
6. 10,12$ A multi-meter. To measure the output of your power supply, voltage converter and to check your soldered circuits. I have one from a few years back but in my experience cheap one’s from Aliexpress seem to work fine for basic tasks!
7. Crimping tools and plugs! Wire crimping allows you to use multi-strand wire in terminal more easily, they also ensure a good connection and are often used in the automotive world to prevent vibrations from loosening cable connections.
First, I recommend getting the following:
|
Crimping tool |
|
Box with ferrules |
The first is the crimping tool, it pushes the metal together in a hexagonal pattern to provide ample grip and a solid connection between wire and terminal. The second is a box is ferrules of smaller sizes. Since we are not walking with a giant amount of Amp’s, these ferrules should be well suited for the job at hand.
In my work you can see them being used here:
|
12v power to board, no messy wire strands and a secure connection |
Both the box with ferrules and tool came from Aliexpress! Tool Aliexpress link , Box Aliexpress link. Total cost 43,71$
Second, I recommend getting some connecting ferrules as pictured below. They allow you to make an isolated detachable connection. This requires a different tool then before.
|
Secure cable connection and detachable |
For this you will need a tool with the right inlay bit and the plugs. Officially the plugs are color coded per size (red, then blue then yellow) for different size of cables, I like to use them also to differentiate plus and minus. To fill the plugs up I use the above crimping tool first and then crimp that connector inside of this one making it a very strong and sturdy connection.
|
Mind the color coded bit inlay! |
You then also need the plugs. The red and blue (bigger) should be able to accommodate all of your 12v work. If you wish to use it for bigger stuff too, also get a set of the yellow one’s. I very much prefer the fully insulated versions as shown!
8. ~0,15$ Terminal Blocks
Terminal blocks are little connector terminals which you can use to connect your wires to your board. The one’s in the picture where of the wrong kind but I didn’t have any other lying around. I got new one’s and these work perfectly! The spacing of these should fit breadboards, prototype boards (Like I used in this example) and PCB’s.
You can find the three different colors I bought here: Green 0,08$ , Blue 0,07$
|
Terminal blocks |
And I think with that you are all set! Most of you will probably already own a soldering iron and some wire, plugs and maybe even a soldering breadboard. Or might want to use different components, that’s the fun of this hobby, everyone can use the stuff they will best suited for it! You think you need/want a different MOSFET? Awesome, go for it! 😉
9. ~0,08$ 2×4 Pins Double Row Female Straight Header Pitch Socket
You can use these pin headers to solder onto your board so you can still easily remove the ESP-01 to do flashing or something else with it!
You can buy them here: 10pack on Aliexpress
PCB files
–update 2015-04-09
I have created a v2 of my board. It is optimized in every way and a LOT smaller then the original. I advise everyone who is looking at creating a board to make the v2 version! You can find it here, including an order link and a Fritizing design if you wish to re-use it.
I soldered another board yesterday and it fully worked on both channels. That means now I have more working PCB’s then not working PCB’s, so I feel confident enough to share the design. It’s a bit of a clunky design and v2 will be a lot better, but also more complex (using ESP-12). If you are going with my blog posts and the components listed there, this should work quite well.
A word of warning though, I give no guarantee this will work in your case and that the design of this board is perfect. It certainly is not and the way the voltage converter is connected with little wires is beyond clunky… It works though, no problem!
As always, comments and tips are welcome and appreciated!
Ignore previous posting, only saw the 2014 postings! 😀 Thanks for your efforts.
Thank you for a very thorough and detailed blogpost.
Thank you for the comment! Happy it helped you. 🙂
You mention on esp8266.com that you are working on v2 of your PCB, using an ESP with more GPIOs (ESP-07 or ESP-12)? I am very interested in this PCB, could be very useful. Is this how you intend to make it? http://tinypic.com/r/2wlu73p/8
If I may suggest: Make two RGB outputs (6 GPIOs), the remaining GPIOs directly to terminal blocks so user can use as needed. ADC pin to terminal block. +3,3V/GND to termail block, enabling "plug on".
Could you use this DC/DC for 12->3,3V conversion? It is smaller: http://www.aliexpress.com/item/1pcs-Mini-3A-LM2596-Power-Module-DC-DC-Buck-Converter-Step-Down-Module-LM2596/1991453959.html
Hi, I'm very interested in your PCB, just one question though, which type of resistor do you use?
I'm fairly new to electronics, and this seems like a very nice start 🙂
@John: Those resistors see virtually no current, so small standard-type will do. Typically that would be 1/4 W metal film resistors.
Thanks Egil, I'm guessing that a 470Ohm will do just fine?
I have also started redesigning the board to be able to "click-on" a new dc converter I've bought on ebay as a replacement for the "bulky" LM2596: http://www.ebay.com/itm/291353891841 (basically the one you've also mentioned). Now it's just waiting for components to arrive.
Hi John,
Yeah, as I mentioned I'm desiging v2 boards myself. I want to use the same voltage converter as you mentioned (mine have not arrived yet either) but I've been trying to find a fritzing or eagle part for it so I can integrate it with my design but so far, no luck. I'm really bad at making a part design myself sadly enough. 🙁
Fun stuff though, when you have a good design for a bord, be sure to show it off or at least pass me a link!
Thanks for posting this, just ordered 2 pcs of this module on eBay, looks very promising 🙂 Will you provide an instruction for setting these up in some next post? I'd really appreciate that!
I couldn't find any part either, plus designing a fritzing part is way to complicated to start with to my opinion.
I did however find the exact dimensions of the converter and have tried placing dupont pins on the board at the exact location, which is quite the hassle. If I finally receive these converters I will try to print the pcb design and see if the holes line up. For now with a printed version and measuring the placement of the pins, it all seems to be perfect. I will share the board if it actually fits. Maybe we can make a good board this way 🙂 (je bent ook op GoT actief?)
"The MOSFET can handle op to 16A of flow with an outside temperature of around 25 degrees celcius. If that temperature reaches 100 degrees celcius it can only sustain 11A of flow. Should be plenty. ;)"
This is so naive. Your knowledge in heat dissipation on mosfets is completely wrong. Powering anything above 1A+ without a heatsink you risk starting a fire.
Hi, thank you for this awesome and insightful comment. I believe I already stated I don't know too much about MOSFETs myself. Your comment has made things much clearer and is clearly a much better explanation that I have given about the subject. So helpful, wow!
Also, I don't set a direct current on the MOSFET but always pulse it, so the heat build up is a lot less. And, I've easily used 4A to 5A through these MOSFETs without a problem or them even getting warmer then luke warm to the touch. I know why this is, can you also explain it?
Looking forward to much of your very helpful and insightful comments!
i think I have a board design that is half the size of yours now let me know if you need the files
I think you might need to look a little bit further on my blog. A while back I released a v2 which is half the size of the v1. Since then I have made a v3.0 and v3.1 which have each shrunk in size again (I have not released those yet). I'm also working on a sensor board of only 2.5cmx2.5cm fed using Micro-USB too.
So I already have smaller types. But looking through your board files is always interesting! You can mail me using quindor @ google mail
I'll be interested to see your v3 PCB. I just started thinking up a design for an ESP8266 LED dimmer and did a search and you've done exactly what I want to do! Probably saved me a week of effort.
I want to do some things differently from your PCB though.
One thing is to use an ESP-12. It solders directly to the PCB rather than using a 2×4 header.
Secondly, incorporate the 3v3 power supply onto the PCB. I'm not sure why the cheap 3rd party PSU designs you are using have so many components. I would think just a simple surface mount LDO voltage regulator and a couple of capacitors should suffice.
The third change is to use surface-mount MOSFETs rather than the TO-220 packages you are using. I switched to surface mount components for my PCB designs whenever possible and never looked back; they are so easy to solder and often much cheaper than through-hole components. Also I think the surface mount MOSFETs can switch more current because you can solder their metal plate to the PCB.
I note a previous commenter mentioned the current capacity of the TO-220 without heat sink. As far as I know they are right; you can't switch the total rated current of the device without attaching a heat sink. On the datasheet it should be possible to calculate the maximum current flow while allowing the non-heat-sinked device to warm up to, say, 20 degrees above ambient temperature.
Hi,
I'd like to follow your instructions and build a led dimmer myself. However, I have two questions, maybe you can lend me a hand here.
My LED strips are 24V. From what I understand, I can use all the components as they are. Is this a correct assumption?
I'm also interested whether the ESP8266 is able to keep state over power cycle, i.e. does it have an EEPROM or so?
Btw. I have a LED strip which is slightly longer than 10m. It does not get darker towards the end. I think that's maybe because of the 24V, which causes less power loss over the distance.
Yes, I use the exact same design with 24v strips or even 33v COB LEDs.
Currently it's not implemented that it returns to the old value after a reboot but in my experience the ESP is easily stable for months or more. You could implement this if you want though?
24v does cause less voltage drop and a high quality strip also helps a lot with voltage drop. Still, if at all possible, try to feed from both sides because then the strain on the strip will be a lot less. Now you can probably notice the beginning of the strip where you feed the voltage getting a lot hotter then the end.
Yes, I use the exact same design with 24v strips or even 33v COB LEDs.
Currently it's not implemented that it returns to the old value after a reboot but in my experience the ESP is easily stable for months or more. You could implement this if you want though?
24v does cause less voltage drop and a high quality strip also helps a lot with voltage drop. Still, if at all possible, try to feed from both sides because then the strain on the strip will be a lot less. Now you can probably notice the beginning of the strip where you feed the voltage getting a lot hotter then the end.
This comment has been removed by the author.
While I'm waiting for my "official" boards to get here, I figured I'd try to mock it up on a breadboard with an RGB strip (LED1 and LED2 connected to red and green). They only light up dimly, but I think it's sorta working. Sorry if I missed it, but what is R1 and R2 on the PCB board pic above? The layout pic doesn't show any resistors. Thanks!
Hi there. I have never used dirtypcbs before. I notice when I add the boards to my cart I can change various options (color, thickness, etc.). Changing these has no effect on the functionality of your board correct? (i.e., I like the black boards you show but the default is red in the cart)
That sounds like your MOSFETs might have a too high trigger voltage.
Could you try turning the voltage regulator from 3.3v to 3.7v or even 4.0v? If the LEDs then shine brighter at all the dimm levels, the trigger voltage for your MOSFETs is too high.
Don't run the ESP8266 above 3.3v for any length of time! Get different MOSFETs with a full trigger voltage of lower then 3.3v
Changing the color or thickness has no effect whatsoever. I use 1.6mm (thickest) and black myself. 🙂
I'm currently awaiting the newest v2.5 design, I should have it and have it tested in a few weeks. I'll make a post about it if successful. You could hold off if you want the newest version. 🙂
Thanks for the article and sharing your experiences.
I'm curious, did you use Fritzing to design the PCBs, or something else?
Looks great, but I am sure this is not entirely correct: "The minus or ground runs from the ESP8266 to the gate pin of the MOSFET. Ground is directly connected to the source pin"
The gates no doubt are not connected to the ground like the sourcepin
Hi
how is it possible to connect the MOSFET direct to the esp?
The esp has an inverted output and I always have to use a pnp transistor bevor a MOSFET to get a HIGH signal.
I just measured between the GPIO2 and VCC. The result was as expected 3.3V
It would be a big advantage if I don't have to use the transistor any longer.
Can you please help me out?
Cheers
Ingo
Ah, no, those are connected to the GPIO pins, I will see if I can clarify better
I don't know in High/Low mode, but in PWM mode the above design works?
You got some things wrong when reading the MOSFET datasheet:
Turn-on/turn-off: The delays are not relevant here, only the rise/fall time. But the rise/fall times specified in the datasheet can *only* be achieved if you have a very powerful IC driving the gate. The datasheet specifies a gate voltage of 4.5 V and a driver output impedance of 4.7 Ohms.
This output impedance results in a driver peak current of ~1 A. The ESP8266 can sink about 12 mA and source about 20 mA. For a similar spec’ed MOSFET I have measured about 120ns for each tr/tf, for 10%/90% off/on.
Another important factor is the 3.3V V_GS. If you look at the “Output characteristics” graph in the Datasheet, you can see the “3V” graph crosses 1V at 7A, i.e. it acts like a resistor with 140mOhm (U = R*I). E.g. if you connect a 12V light strip, thats 11 V for the light strip and 1V dropping over the MOSFET, or 7 Watt of heat. If the strip only draws 3.5A, you have voltage drop of 0.5V, and 1.8W of heat.
Now if you drove the MOSFET with a very high frequency (in this case at ~4MHz), it would no longer at as on/off switch (few mOhms/many MOhms) but as a resistor or linear regulator. Considerably more power would be dissipated in the MOSFET.
Awesome explanation, I think I get what your saying mostly! If I read it all correctly the way I’m using the MOSFETs is actually the correct way, it just has some side effects I’m not aware of. Or should the implementation change?
About the voltage drop over the MOSFETS, you might be correct there, it’s hard to measure total light output with or without the MOSFET.