Sanity Check of LED Controller - Page 1
Forum section: electronics / projects

author: Return Current
author_rank: Newbie
timestamp: April 18, 2022, 04:32:43 pm
content: Hello,since this is my first post in this forum I figured i should briefly introduce myself. I am a 20 year-old electronics engineering student from Germany but I also started tinkering with this stuff 4-5 years ago.I am going to start with explaining what I am trying to archive, present what I have already done and then aks a few questions about things I am unsure of.I did my best not to write unnecessarily long while maximizing the relevant details.I am currently working on a PCB that is supposed to control LED strips at my place. The target are regular WS2812B 5V strips and 24V CCT (Warm- and Cold White) strips with a common Anode and seperate Cathodes. My planned methods of controlling said LED strips, which are laid out parallelly, are PWMing the 24V strips and feeding the WS2812s a data signal from an ESP32. So far, so simple.Although I also want to only feed the Controllers 24V as an input because this makes things a lot easier when it comes to wiring and power supplies. So this project also includes not so low current Step Down converters. My general architecture for the 5V supply is to have a 5V Step Down converter on the main controller PCB (with the ESP32) and add external Step Down modules along the Led strips that are fed 24V by the controller PCB so that they can be shut down by the controller PCB. I opted for this modular architecture instead one beefier Step Down converter because I cannot really get my hands on a fitting Step Down Controller due to the DC-DC converter shortage. However, I managed to get my hands on two ICs from Texas Instruments, one synchronous 3A job and one non-synchronous with 3.5A (TPS54360 and TPS54302DDCR). Originally I intended to only use the synchronous ones in the external Step Down modules for the heavy lifting of the several Amps at 5V and chose the non-synchronous ones to only supply the controller PCB with the ESP32 since a LDO from 24V would get toasty. But while calculating the values of the non-synchronous Step Down I figured that it could definetly carry some current so I decided to use these also for supplying 5V for the WS2812s. How much exactly the non-synchronous is going to carry will mostly depend on its thermal performance but I will just see how much it can deliver because I also do not depend on these to supply anything but the ESP32 since I have the external Step Down modules for the WS2812s.Now, after I roughly outlined the underlying architecture I will no longer hold off the schematic and PCB layout (and say a few words about it):(Attachment) (I will renew the link while the thread is active and in the long term attach files to view the files)I am going to start with covering sections from the schematic I did not mention yet;You do not need to read all of this, I just wrote this to explain all what I did. I did mark questions/aspects I am unsure of.Generally:I have the feeling that this Design went a bit extensive (well I want these features) and the layout is pretty dense. While the layout is dense and I use many small trace widths/clearances between pads of different potential I did pay attention to not exceed JLCPCBs 4 layer capabilities and not to place 0402s too close to each other (I heard 0.27mm should be fine, but I mostly kept them 0.4-0.6mm apart. Of course I would be interested if you see any clearance that you think are worrying. Also: I did place some vias on pads which is suboptimal to say the least but I am assembling this myself so I can compensate for sucked away solder and this enabled me to keep the Top Layer completely free under the ESP32 module since it has traces and vias on its bottom. I also frequently used 0.1mm traces since I just did not see the benefit of using wider ones (for example for UART and FET-Gates) and I am not pushing to the minimum width (0.09mm) from JLCPCB. Let me know if you think it's not a good idea to use 0.1mm traces so frequently.All DRC Errors Altium is generating are "I think ok". I am just gonna go ahead and list all DRC errors and explain why I think they are fine but that is rather optional to read: Many of them are Silk to Solder Mask Clearance Errors but I am gonna go ahead and assume that JLCPCB won't print Solder Mask on my pads. It also generates Minimum Solder Mask Sliver Errors but this only affects Vias with to little clearance to a pad of the same potential. I know that in this case the vias can suck away the solder but I am soldering this by myself so that shouldn't be an issue. There is one exception with the clearance of pads of Q1 in the upper left of the PCB but again the conflicting pads have the same potential. I also get errors regarding Silk to Silk clearance (really dont't care) and Board Outline clearance errors but these are only due to Silk Screen so that should be fine as well.The only other DRC Errors are clearance errors of the non-plated holes of the USB C Port to the Pads left of them. But since these holes are not plated I guess that is fine?NTC Voltage DividersI included NTC Resistors near the Step Down modules to roughly sense the temperature of them. I figured a regular voltage divider will be sufficient as this NTC varies its resistance a lot with temperature (100k down to 5.4k from 25°C to 100°C). The outputs of the voltage dividers are then fed into the ADCs of the ESP32. These NTCs have a 0402 package although I did not use this as a footprint since I intend to glue them straight on the hot component and then wire it manually to SMD Pads (the used custom footprint) nearby to get the most meaningful measurement. This section also includes sensing fot external NTCs from the external Step Down modules, therefore the pin header and only the 20k Resistors down to GND.WS2812 Data Output BufferNothing much to say here, just a buffer IC to once make the output a bit more resilient than a Microcontroller IO and also to deliver 5V instead of 3.3V.USB-C Port and USB-UART and ESP32 BootstrappingI included a USB C Port and a CH340G IC in order to programm the ESP32 via USB. The ESP32 Bootstrapping section also belongs to this. The bootstrapping consists of a pullup on EN and the sort of standard circuit you find when you google after "ESP32 Auto Reset". I also used this circuit already and found it to work. The most critical aspect of this whole section is probably going to be the USB Differential pair. I did pay attention to its impedance requirements by defining the Stackup from JLCPCB in Altium with the values given from JLCPCB and then defined a differential pair with the appropriate differential und single ended impedance.The thing I am unclear about is the fact that the USB C Port has the N and D line twice. I mean I know why but I do not know how to deal with that when it comes to impedance control. I guess the extra D and N pins should be connected to their counterparts although I don't know how to while meeting the impedance requirements. I mean I can connect for example the D Signal on the right side of the pins of the USB C Port but then the N Signal would require a Via and at latest at this point I really don't know anymore how to match the impedance requirements. I also have heard that USB 2.0 is rather forgiving and I figure I would be fine if I just connected the duplicate pins as shortly as possible but I would still be interested in what you think to do.Status LED and Button and Expansion HeaderThe status LED and Button are for indicating operational statuses / interfacing with the controller in case of WiFi outage. The expansion header breaks out unused pins of the microcontroller and provides voltages for future expansions.24V LED PWMThe 24V LED strip is has two channels to control (Warm- and Cold-White) so I used two N Channel Mosfets combined in one 2020 Package (Q5). These two FETs are driven by Mosfet Gate Drivers (MCP1416T-E/OT). Additionally I also have a High Side P Channel Mosfet at the common Anode of the LED strip jut because I want wo be able to switch all outputs in a way that they will be voltage free (for safety reasons). Its gate is only switched very sporadically and just once at a time so I did not use a Gate Driver but a simple Voltage Divider which will deliver a Gate-Source Voltage of -12V when Q6 is conductive and if Q6 is not conductive the upper Resistor will pull the Gate-Source voltage "up" to about 0V. The Gate of Q6 on the other hand is directly connected to an IO Pin of the ESP32.This section also includes a ferrite to connect the PWM GND (PGND) to the general GND so that the return currents do not screw me (happened to me before, inspired my username). I placed the ferrite pretty close to the pin of the screw terminal to which the GND of the 24V supply will be connected to. When I thought about the placement I figured the return current will want to go there although I am not sure whether the ferrite is placed correctly / whether the PWM return currents will screw me again. Do you think this is fine?24V and 5V WS2812This section is for providing 5V from the Non-Synchronous Step Down Controller to a part of the WS2812B LED strip and to supply/switch the 24V for the additional external synchronous Step Down modules. This consists of a P Channel Mosfet for switching the 24V with the same Gate Driving circuit as discussed above. To switch the 5V I chose a N Channel Mosfet since I can easily provide the higher Gate Voltage with a voltage divider. With the current divider I get 9.7V, which should amount to 4.6V from Gate to Source (9.7V - 5.1V(I aimed for 5.1V with the Step Downs)) while staying under 10V at the beginning of switching it on since the data sheet lists +10V as the Maximum Gate Source voltage. I guess it would be fine to exceed the 10V (from Gate to GND) since as soon Vgs rises the potential of the Source itself will rise due to beginning conductivity but I just decided to play things safe here and the conductance losses at 4.6V Vgs are already low enough. Controlling whether the Gate is fed voltage from the divider or -5.1V is controlled by Q4.24V-5V Step DownFor designing this converter I read the data sheet and calculated the component values with the provided formulas / reccomendations. I ended up using a switching frequency of 1.412Mhz. Seems a bit high but that's what the formulas spat out (I lowered the frequency with a generous error margin). The formulas also determined the needed output capacitance which ended up being so high due to overshoot in transients (Full white to all off is a scenario with these LEDs). I also considered the DC Bias of the MLCCs. When it comes to the layout of this Step Down converter I tried to keep the runs as short as possible, keep the high current traces wide and keep the sensitive feedback and frequency compensation components close to the IC.What might be a bit suboptimal is the proximity of the USB Data Lines to the feedback and frequency compensation components. Do you think this will cause problems?Now to the heat dissipation: The main IC has six vias on its thermal pad that will sink the heat into the continous ground plane. The GND pad of the diode also sinks its heat into to ground plane. With the other pad this is obviously not an option (I do not want to spend money on thermal jumpers) so I created a plane on the bottom layer as big as there was space without moving stuff around much. Again, my goal here was just to dissipate as much as possible without making too big of an effort since the Step Down Controller is not really required to provide a minimum high value of current.5V-3.3V Step DownThis Step Down converter is for supplying the ESP32. I think this one is not so complicated, don't really know what else to say about it.External Step Down modulesThese external step down modules aren't too complicated:https://altium.com/viewer?token=kb3fapjLgEqilgri6hLomulqThe only thing I am slightly unsure of is the routing of the 5V feedback line, it is not the shortest in the world and it goes under the 24V input, which is not particularly ripple (noise) free. Although I did not see a way to route it better without a via or changing the placement of almost all other components and when the feedback line is the most closest to the 24V input line it runs mostly orthogonally to it so I guess the feedback line should be fine?A Via is no option here because I want to keep the 25*25mm² section all GND on the bottom layer since I want to be able to mount a heat sink on that and having anything but GND there would cuase shorts and having a continous GND plane also is a nice-to-have.Some additional background information (also an optional read in case you feel that this got to long):I already made a version of this LED Controller and assembled the PCBs but you can probably guess what happened - the return currents screwed me. Whenever I was PWMing the 24V LEDs the WS2812B LEDs started flickering as if random bit flips were happening. When looking at the data signal with my oscilloscope I could see noise/garbage in the data signal exactly at the time of the PWM transients. I showed the PCB of the old version of the controller to an acquaintance of me who already graduated in electronics engineering and has worked for a few years in this field. His advice / suspicion were the return currents of the PWM and their shared impedance (inductance at high frequencies) with the return paths of the data signal of the WS2812s. In the following I will write a bit about the old implementation / describe the error circumstances / observations I made. Firstly, you can see the Schematic and PCB here: (Attachment)Back then I also planned to have the 5V being supplied externally and many details/aspects might be different from the current design as for example I did not yet pay attention to the impedance control of the USB Lines. Also I used a 2-Layer PCB instead of the now 4-Layers. Accordingly to that the GND (return) paths were not resilient enough for the PWM.I already wrote that the flickering of the LEDs ocurred when the PWM was active. Interestingly it did not occur when PWMing the 24V LEDs but feeding the data signal from a seperate controller module that has its GND connected to the GND of the PWMing controller module. The flickering also did not occur while the PWM was active but the LED strip wasn't connected so the problem does not seem to lie in the Gate driving.In case you did not read the "optional read" section just above: I am highly worried about the PWM messing up my WS2812 data signal which would result in random bit flips --> flickering of the LEDs (happened already as I covered in the above section). This is also why I have seperate GNDs, used a ferrite and provided clean return paths for the PWM currents. Do you think I should take any additional actions in order to not let the PWM mess up my data signal?I will also add GND planes on the top and bottom layer except under the ESP32 but I didn't for now for better visibility.Well I think I covered pretty much everything relevant here. I hope this wasn't to long and thank you in advance for your advice.Greetings from Germany!