• Heatsink musings

    WJCarpenter7 days ago 0 comments

    I said earlier that the 7805 got warm but not hot. That was true of my breadboard experiment. When I put one on the actual PCB, it was sometimes warm and sometimes really, really warm. I don't know what temperature it reached, but it was a bit uncomfortable to the touch. It was still possible to keep touching it with my finger indefinitely. I'm not sure how the 3D printed case will feel about that permanent source of heat after a few months.

    I'm not sure why there was a difference on the breadboard compared to the PCB (it happens to be exactly the same 7805 device). I'm thinking about ways to reduce the ESP32 power draw (maybe by reducing the clock frequency or whatever other tricks I can come up with while staying in ESPHome), but I will probably add a heatsink to the BOM.

    Meanwhile, I have been exploring homebrew heatsink stuff. Here is what I have found so far:

    • The hole in the tab of the TO-220 package is 3.7mm +/- 0.1mm.
    • 3.7mm +/- 0.1mm works out to 0.1417 to 0.1496 inches, or about mid-way between 9/64 and 5/32 inches.
    • JEDEC (registration required) gives the dimensions in inches, min 0.139, max 0.161. 
    • I don't know how closely manufacturers adhere to any of those specifications.
    • I found that an M4 screw just barely fits into the devices that I have. It doesn't slide in and out, but it can be easily threaded into the hole. It's not snug enough that it doesn't need a nut.
    • In North America, the standard screw for holding an electrical wall plate in place is size #6-32. The major diameter for #6-32 machine screws is 0.138 inches / 3.505mm. These are readily available in the US. I've got about 5 billion in various places in my junk box. Because of the way they are used, you usually find them without matching nuts, though the nuts are also readily available at any hardware store.

    I was able to cobble together a makeshift heat sink using loose nuts and washers from the junk box. The only (tiny) challenge was finding a nut that was small enough in outer diameter to avoid the body of the TO-220. I wanted to insert the screw from the back side of the TO-220 so that any excell would point up and away from the ESP32 if I leaned the voltage regulator backwards to reduce its height, and also because any of the nuts and washers I used would also interfere with that body.

    Here's a picture of my Frankenheatsink (M4 screw and nut, loose-fitting junk draw nuts and washers):

    So far, it's staying just warm and not getting really, really warm.

  • A powerful follow-up

    WJCarpenter01/14/2023 at 20:51 0 comments

    Replacing the AMS1117 regulators on the ESP32 modules was a wash-out. I had two board with what I hoped were just burned out AMS1117 regulators. On one board, replacing it made no detectable difference. On the other board, I heard some snap-crackle-pop for a few seconds, and then smoke appeared. So, I'm giving up on that idea. I've got a small quantity of AMS1117 chips for some future project.

    My 7805 regulators arrived. I've breadboarded one of them to power an ESP32 through the 5v pin. The ESP32 is running the ventbot firmware. Except for not connecting the BMP280 over I2C, this is exactly what will be running, so the current draw should be pretty close. I've already had it running for 15 minutes or so. With my finger, I can feel some warmth on the 7805, but nobody would reasonably call it "hot". So, I think I won't need to worry about a heatsink for the 7805 for this project. Yay!

  • PCB 3rd iteration, with more DFM

    WJCarpenter01/12/2023 at 20:09 0 comments

    I made the decision to revise the PCB again, to correct one definite (non-fatal) mistake and another arguable mistake. At the same time, I made a number of smaller changes in the name of "design for manufacturability" (DFM). In this case, the "manufacturer" is mostly me. If someone else builds some of these, they will also probably be a hobbyist. They'll be sourcing parts in small quantities, maybe taking what they can find or using what they have on hand. They'll be doing assembly in a dungeon-like work area that doesn't want to have computer equipment and lots of paperwork strewn about. OK, I'm really talking about me.

    Here are the changes I made:

    • Added the footprint for the 7805 (U2). I placed it so it wouldn't block the USB connector on the ESP32 module. There should still be enough room for the 7805 to "lean back" a bit if it doesn't need a heatsink.
    • Corrected the pin ordering for the JST-PH connector (J22). This was backwards in the first two iterations of the board, so you couldn't directly use it with STEMMA or Grove components. I added a bit of marking on the silkscreen so that it's clear which pin is which for the wiring for it and the JST-SH (J24) connector.
    • I changed the footprint of the other I2C connector (J25) from two separate (but conveniently spaced) 1x4 pin headers to a single 2x4 right angle pin header. That makes it more obvious what's going on, and someone could still use separate straight-through pin headers if they wanted to.
    • Along the same lines, I changed the footprints of the fan connectors (J11, J12, J13, J14) to be those same 2x4 right-angle pin headers. To use those, you have to snip off the bottom row of horizontal pins, but the pad spacing and physical dimensions are otherwise compatible with the official friction-fit fan connectors. Someone could still choose to use either vertical insertion or right-angle versions of those.
    • For the power and PWM option jumpers (JP12, JP13, JP14, JP22, JP23, JP24), I have previously populated boards both ways: with a 3-pin header and jumpers, and with wires soldered across pins 1-2. Given that the choice will almost always be connecting pins 1-2 for all six options, I wanted to simplify that for the common case. I left the footprint as a 3-pin header, but I put a trace between pins 1-2 on the front of the board for all six options. If someone wants to select pins 2-3, they can cut that trace and then join pins 2-3 with either a jumper or a soldered wire.
    • I added some text to the silkscreen as a reminder of which option jumpers control power sharing and which control PWM sharing. Unfortunately, there wasn't room near those footprints, so it's all the way across the board. Tolerable.
    • Most of the resistor values were not critical. I changed the 100 ohm current limiting resistors to 4.7k ohms. That reduced the number of distinct resistor values from 4 to 3.
    • One of the resistor values was 27.4k ohms. I had copied that value from a reference design. 27.4k is not a standard value, and I had been using 27k when assembling boards. I formalized that by changing the design to 27k ohms.
    • I moved some resistor placements around so that the one long row of resistors is now all 4.7k values. That should eliminate some opportunities for making a mistake. That made the R1x resistors appear out of sequence, so I changes their references to the previously unused R4x series.
    • I added reminders of values for the various resistors on the silkscreen. That matters most for the two values that are not 4.7k.
    • The redone trace routing conveniently allowed me to extend all the way to the edge of the PCB the keepout area for the ESP32 antenna position. I still don't know how much difference that makes, but I have done my duty.
    • I added a redundant footprint for the capacitors. The second footprint has a closer lead spacing, which I think is more common these days. Depending on the capacitors you actually have, you can pick whichever footprint gives the best physical fit.

  • Puff the magic dragon smoke

    WJCarpenter01/10/2023 at 02:32 0 comments

    While putting one of my assembled boards through its paces, smoke started coming out of the grill vents in the case. I quickly opened it up and was able to definitively see that the smoke came out of the ESP32 module's on-board voltage regulator. It's an AMS1117. I've come to the conclusion that asking it to drop 12v input to 3.3v is just too much heat to be dissipated. (I've also since read some unkind words about the part.) I allow for the possibility that the ESP32 modules I have might be tainted by supply chain counterfeiting problems, but I don't know that in any concrete way; it's just generic paranoia.

    The voltage regulator is a surface-mounted SOT-223 package (3 terminals plus tab). I've ordered some replacements and will try my hand at repairing the ESP32 module. However, that's more or less a tangent, just to see if I can do it. Who's to say the replacements won't also blow at some point? I don't want that puff of smoke coming out in the middle of the night. Also, I don't know if the blown voltage regulators will have led to catastrophic damage to other things on the module, including possibly the ESP32 itself.

    So, what to do about this? I want to continue powering the board with a single power supply. The fans want to run at 12v, so the 12vdc input seems like it must stay. 

    I'm thinking of adding a 7805 regulator to the board to feed the 5v input of the ESP32 module. That will still have to dissipate the heat in getting from 12v to 3.3v, but:

    1. it'll be two devices doing it instead of one
    2. the 7805 will be separate from the ESP32 module, and only 3 pins, so simpler to replace
    3. if necessary, I can add a heatsink to the 7805

    I'm hoping to get away without a heatsink. The ESP32 will probably run at 250mA or so. The typical application circuit puts capacitors on both the input and output voltages. I hope to be able to avoid that because the 5v output will be feeding into the ESP32 on-board regulator. I'm not worried about power consumption, per se, so the only worry I have is about the need for a heatsink.

    Another possibility would be to use a switching regulator, which should reduce the dissipation into heat. There are some that are pretty cheap as standalone modules, but I don't want to end up with a separate board or redesigning my board to be much larger. CUI Devices makes a series of switching regulators in a 3-pin package, and I think there are other manufacturers of similar devices. The idea is that they can be a direct replacement  for a 7805 on a PCB. I could either feed that into the ESP32 on-board regulator use a 3.3v regulator to directly feed the Vcc pin of the ESP32. If I did the latter, I would probably have to be more careful about the capacitors. It would also be a design-time decision instead of an assembly-time decision.

    OK, I've decided. I'm going to do another revision of the PCB to add a footprint for a 7805 and feed the output of that to the 5v pin of the ESP32 module. No capacitors. If someone wants to feed the 12v directly to the ESP32 on-board regulator, they can just jumper the Vin and Vout pads together. Or, they can use a 7805 or one of the pin-compatible switching regulators to drop the voltage to 5v. They can also make a late-binding decision about whether they need a heatsink for the 7805. (It turned out that I didn't have a 7805 on hand, but I will have some soon. I'll do some breadboard experiments to see how warm it actually gets when powering the ESP32.)

  • The enclosure with YAPP_Box

    WJCarpenter01/02/2023 at 02:50 0 comments

    I started fiddling around with OpenSCAD to make a custom enclosure for this project. I did what I thought were some reasonably clever things with the base on which the PCB would rest (3D-printed stand-off with threads and matching nuts ... yummy!) However, when it came time to create the top of the enclosure and figure out a way to fasten it together, I came across mrWheel's YAPP_Box project. It was so far ahead of what I was tinkering with that I set my custom enclosure aside and started working with YAPP_Box.

    The way YAPP_Box expects you to work is to start with a template of settings and then reference a generator module to actually create the enclosure based on those settings. You could just measure locations on a board with calipers or even a ruler, but I did my board design in KiCad and was able to get precise footprint numbers from property sheets in KiCad. The only thing I actually had to measure was the Z height of a populated board (both front and back), and those did not need much precision.

    Just in case I later revise the PCB, I created a bunch of local variable with numbers expressed in KiCad coordinates, and then I set the parameter values for YAPP_Box mostly in terms of those KiCad variables. For things like text labels and grillwork, which didn't correspond to anything on the PCB, I used a combination of measuring, educated guessing, and trial and error. OpenSCAD is a great tool for that kind of iteration since the preview mode is really, really fast at showing what any changes look like. It was a little challenging to keep translating KiCad's idea of coordinate systems to the multiple different YAPP_Box orientations, but, again, OpenSCAD's rapid previewing was very helpful for keeping things going in the right directions.

    In the end, I made cut-outs on two sides for fan connectors, power connector, and I2C connectors (for the temperature sensor). I tried putting text labels for those things on the sides as well, but it came out looking pretty awful when 3D-printed. Instead, I put all of the text on the top and bottom surfaces. I had to go with rather large Arial Black typeface in bold to get reasonable looking text.  YAPP_Box text is done an engraving, so you are mostly depending on shadows to make it visible. Lighter colors work better for that, though these things will be shut up inside furnace vents for the long term.

    On the top, in addition to some text, I also put some grillwork. I don't think it's needed for ventilation, but it was easy to do and looks pretty nice. I also put a couple of small holes to allow pushing the ESP32 buttons when the enclosure is snapped shut. A thin TORX screwdriver is good for that since the flat nose helps you find and press the buttons. (One of the buttons is the reset button, which obvious behavior. The other button is configured in the firmware to let you temporarily toggle the fans on or off for testing. You can do a similar thing with Home Assistant integration.)

    On the bottom of the enclosure, I wrote the URLs for this Hackaday project and the gitlab repo where the design files live. I don't think I am likely to ever lose track of that information, but I know I often lose track of that sort of thing after a couple of years on equipment and components I get from random sources. The URLs on the case are just in case somebody like me builds one and then loses track of me. (The URLs are also silk-screened on the PCB, but that's the kind of thing I might forget to look at after a couple of years.) 

    There are some "poke holes" in the bottom to help get the PCB back out of the enclosure. I wrecked a couple of trial iterations of the base by prying the board back out with a tool. With the poke holes, you jam that same TORX screwdriver in and push the PCB up from underneath.

  • PCB 2nd iteration works

    WJCarpenter12/30/2022 at 23:08 0 comments

    I received the shipment of revised PCBs from PCBWay a few days ago. I immediately populated one completely and tested it. I wanted to have one copy of the board that populated everything, including things that I don't plan to actually use myself. I'm pretty pleased with the little tweaks in the revised layout. And, it works! Here's a picture of it resting on a 3D-printed enclosure base. (I'm still fine-tuning the enclosure.)

    I noticed one blunder that was also present in the first revision. The JST-SH and JST-PH connectors use the same order for the wires for I2C. I didn't notice that JST-PH connector was flipped over from what I was assuming. This is completely my mistake. Once I noticed it, the Adafruit article was clear enough. I just wasn't paying attention. Consequently, this PCB is not directly compatible with Adafruit STEMMA devices. For myself, that's not a huge deal since I am wiring up generic BMP280 breakout boards and soldering the wires from the JST-PH cable directly to the boards. I just had to ignore the wire colors (which were not applicable anyhow) and pay attention to the signal order from the board. In the generic JST-PH cables that I have, pin 1 is red, pin 2 is black, pin 3 is yellow, and pin 4 is white.

    If I ever revise this design, it will be easy to correct this. If you use a "vertical insertion" JST-PH connector, you could just turn it around (notch facing the edge of the PCB), and then it would be directly compatible with STEMMA devices and probably also Grove devices. You could turn around a "horizontal insertion" JST-PH connector, too, but there isn't really enough space to insert the cable connector into it with that orientation.

  • Another iteration of the PCB

    WJCarpenter12/20/2022 at 02:33 0 comments

    There were enough annoyances (described here) in my design of the PCB that I decided to do another revision. In addition to those earlier -described annoyances, I thought of a few other improvements.

    • I put a keepout for the ESP32 antenna area. No copper pour under that area on the back side, and not traces routed through it on the front side.
    • The ESP32 module was hanging a couple of millimeters over the edge of the PCB. That didn't matter much, but it made creation of the enclosure slightly awkward (more about that later). I repositioned it to be fully within the PCB outline.
    • The problem I had with the less expensive power connectors was just the size of the hole for the ground pin. The hole for the 12vdc pin was big enough, so I just replicated that hole and pad for the ground pin, the original (better but more expensive) connectors will still be fine because they have a couple of soldered mounting tabs and a plastic pin for stable placement. I also checked into a couple of no-name connectors, and they look like they will fit the same pair of holes.
    • Rather than switch to one horizontal and one vertical orientation for each of the JST-SH and JST-PH connectors for I2C, I decided to remove half of them. I now have just one footprint for JST-SH and one for JST-PH, both horizontal insertion. I decided that anybody who wants to use multiples of each can just use a passive fan-out hub. Also, as expected, soldering the JST-SH SMT device is a pain in the neck. My decision of this was accelerated by the move westward of the ESP32 module. There's still enough room on the layout for both pairs of connectors, but it's pretty cramped.
    • (previous) cap holes
    • I changed the PCB mounting holes to 4mm and moved them a little bit further from the PCB corners. I also fixed the non-symmetrically-placed one.
    • I changed the wrong footprint for the MOSFETs to be the correct TO-220. I also rotated the footprint 90 degrees so that they MOSFETs can be bent to lay on their backs (so to speak). That can reduce the overall height requirement for the enclosure since the MOSFETs are the tallest.
    • I removed the two 0-ohm resistors coming from the power jack. In all my testing so far, the 12vdc power supply has been working just fine for the ESP32 module, so I guess the on-board power regulator is happy enough.
    • I moved all of the connectors on the edges of the PCB closer or even beyond the edge. The enclosure template I am using has rounded corners, but that means I need to put a little gap between the enclosure walls and the PCB. The movement is not enough to cancel that out, but it makes things a little easier to work with.
    • I tried various things to provide additional through-holes for the electrolytic capacitors, but I couldn't keep KiCad's design rules checker happy. This is due to my limited experience with KiCad. I decided to leave them as they were in the original revision.
    • Placing the ESP32 module on the board was a really snug fit, so I slightly increased the hole size on the pads while keeping the copper the same.
    • This isn't really a change to the layout, but I'm going to use standard 4-pin right angle headers for connecting the fans to the PCB. The vertical insertion was kind of awkward considering the dimensions of the enclosure. I haven't found any horizontal insertion fan connectors, and standard headers have the same pitch. I just have to be careful to have enough clearance since the thick part of the connector on the fan cable will face down when I use horizontal insertion. I didn't change the footprint on the PCB; it still shows the vertical insertion connectors.

  • It works!

    WJCarpenter12/18/2022 at 19:01 0 comments

    When I populated one of the boards and fired it up, it actually worked as designed. I'm pretty happy about that. Based on experience, I was prepared for disappointment, but I guess I got a Christmas miracle.

    There are a few non-fatal changes I would make to the board if I did another run, but it looks like I won't need to do that. I'm contemplating doing another PCB iteration to clear up some of the physical layout things I described in an earlier project log.

    The photo above is a fully populated (well, mostly) board. It's resting on one of the iterations of a 3D printed enclosure I'm working on. 

    I also need to design some brackets for putting the fans in place inside the vents, but the electronic design is pretty much done, and the firmware is pretty well settled.

  • Changes I would make if I revised the PCB

    WJCarpenter12/15/2022 at 21:06 0 comments

    I haven't yet had a chance to populate one of my boards and test things. Naturally, I am supremely confident that it will work first time. But if I did, hypothetically, need to make more PCBs, here are a couple of things that I would change. None of these are fatal.

    • In the KiCad footprint for the ESP32 module I am using, the antenna circuitry is off the end of the main board. I placed it on the PCB so it would hang over the edge. The idea is to reduce any degradation of radio signals from proximity to other components. I can't believe I didn't notice this earlier, but the actual antenna placement is between the last couple of pin headers on that end of the module. In my PCB layout, there is part of the bottom layer copper pour under the antenna. I would revise that to avoid copper directly under the antenna.
    • The 12v power connector footprint is an excellent fit for the connectors that I have on hand and plan to use. I thought that it was also a good fit for some less expensive connectors (which I also have on hand) made by the same company, but it's only close and not a good match-up. I would rework that so that both of those connectors fit easily, and I might put in some additional power connector footprints so that dime-a-dozen unbranded power connectors could be used more readily. However, even without using the exact part that I selected, someone could use the kind of power connector that attaches to the PCB with wires and is then secured to the enclosure with a nut or something. I'd lay down some more obvious "+" and "-" markers on the silk screen for that possibility.
    • I used right-angle horizontal footprints for the I2C JST SH and PH connectors. Those connectors come in horizontal and vertical entry formats. Since I laid out two of each footprint, I would probably change that to one horizontal and one vertical footprint for each. Too late, I discovered in my accumulating parts bucket that I had vertical connectors for both. For the JST PH connectors, it's a simple matter to use the same footprint as long as you are careful with the orientation. With the JST SH surface mount connectors, it's not really a good match-up.
    • The footprint I choose for the electrolytic capacitors was a bit arbitrary, except for being radial. Hobbyists buying a few capacitors won't always have a good selection of lead spacing. I would probably lay down some additional lands for one of the leads to more easily accommodate different spacing. With a radial capacity, you can make almost anything work by bending leads. It just won't be as tidy looking as a straight-in exact fit.
    • I would make the mounting holes a little bigger. They look nice and big when I'm looking at the layout in KiCad, but on the real boards they are smaller than my mental image of them. (They were manufactured exactly as I designed them. It's not a manufacturing flaw.)
    • There are a couple of jumpers for some optional features. The jumpers have to be set in pairs to either "A" or "B". I laid out the 3-pin headers side by side, so it would be easy to think it was 3 pairs of 2-pin jumpers instead of 2 sets of 3-pin jumpers. I would offset them from each other a little bit so that the orientation would be obvious, and you wouldn't connect the wrong things with a jumper since it wouldn't fit.
    • The placement of the connector for Fan 4 is slightly off compared to the placement of the other fans, for both the X delta and the Y absolute position. It's only a fraction of a millimeter, but it's annoying.
    • Mounting hole Ref2 has some strange offset in the drill hole in the footprint report. I can't see where that comes from, but I'd try to track it down and zero it out. The other mounting holes don't have it, and the location of the overall center point is correct.
    • The biggest change, which is a minor blunder, is that I somehow selected the wrong footprint for the MOSFETs. I didn't realize it until I finally went to place one on the PCB. I intended to use a TO-220 package. In some way that I can't recall,...
    Read more »

  • The boards are back in town

    WJCarpenter12/13/2022 at 03:11 0 comments

    Today is an exciting day because my manufactured PC boards arrived from China. As I expected them to be, they are gorgeous. Don't be fooled by my poor photography. All the silk screen is crisp and clear, and all the plated copper lands are bright and shiny. (The purple posts are a PCB holder of mine and not part of the board.)

    This round of PCBs was sponsored by PCBWay.com, by which I mean they contacted me and gave me a coupon to cover the cost of making them and shipping them to me.

    It took less than 2 weeks from uploading my design files to getting the boards in my hands. That was with "global standard shipping", which is pretty reasonably priced. They also have DHL shipping, which I know from experience to be significantly faster, but it's quite a bit more expensive. (I live on the US west coast, and many China shipments come in through Los Angeles, so things get to me pretty fast once they are turned over to in-country carriers.)

    It takes 1-2 days to actually manufacture the boards, and you can follow the progress as your design moves from stage to stage during the process. If you like to geek out on that stuff, it's pretty fun.

    I designed the schematic and board in KiCad. I'll be uploading the KiCad design files in a bit. Here's a screenshot of KiCad's rendering of the layout:

    And here is what KiCad's 3D model of the (mostly) populated board looks like.

    Due to "day job" priorities, I won't be able to tinker with this too much for a few days, but here is my plan:

    1. Populate the board with enough components to operate Fan 1. If I find mistakes on the board, I won't have wasted too many parts.
    2. Prove the ESPHome firmware that I used with the breadboard still works with the PCB.
    3. Populate the rest of the components on the board. Even though I plan to only use 3 fans, I want to have a reference copy of the board with everything populated.
    4. More firmware testing with 4 fans hooked up.

    Assuming all that works without discovering any design blunders, I'll finish up design of the project case and fan mounting brackets.