Browsing posts in: Holiday Lights

Holiday lights and GFCI Trips

December in Seattle is very damp and that means I need to deal with GFCI outlets tripping for my holiday lights. I’ve come up with some ways of improving the situation and that’s what this post is about.

The Point of GFCIs

How does a Ground Fault Circuit Interrupter (GFCI) work?

The whole goal of GFCIs is to keep dangerous amounts of current flowing through human bodies, and the electrical standards set that current to 5 milliamperes. That is a good thing.

The problem that we run into is that light strings are not waterproof, and that means there is a possibility of a current path between the electrical wiring in the light string as a ground. That current is normally known as “leakage current”, and if you get more than 5mA of leakage current on your GFCI, it will trip.

Measuring leakage

One of the biggest frustrations dealing with this issue comes from not being able to figure out what part of the display is causing the issue – you are stuck with trial and error and that does not work well.

If this is a significant issue, I highly recommend buying yourself a leakage meter. The good ones from companies like Fluke are many 100s of dollars, but there are cheaper ones that have worked well for me. I use this one, which costs around $100:

Digital Clamp Meter ETCR‑6300: Measures 0-60A for Leakage Current Tester - Picture 1 of 12

Go to Ebay, do a search on “leakage current clamp meter” and you’ll find some options.

If you get a trip that you can reset your way out of you can then walk around and clamp the meter around the cords at different locations and figure out where most of the leakage is coming from.

Mitigations

Ground contact

Ground contact makes the current path short and therefore means more current will flow. The amount of current that actually flows depends on the amount of moisture around. Dry ground and dry weather generally means very little leakage. High humidity, wet weather, leaves or other debris, wet snow, ice, or standing water increases the amount of leakage.

Keeping your lights out of this situation is the first step to keeping trips to a minimum.

This also means that you can mostly ignore strings up in the air or mounted to the house though if they are mounted to metal, that could be an issue.

Light string insulation quality

A 50-bulb light string has as least 100 places where leakage can occur. Some light strings are better designed and have less leakage, some have a poorer design and leak more. Light string insulation deteriorates over time and this can lead to more leakage.

Therefore, using higher quality light strings or getting rid of old ones can help.

Electrical connections

If you have connections between light strands or connections to extension cords sitting in wet areas – or jammed into the grass of your lawn – you can definitely get leakage there. Keeping them elevated helps a lot.

If they are elevated a little I have not found connections to be a significant source of leakage, and I’ve measured hundreds of cases.

GFCI Count

One of the best mitigations is to split your load across more GFCIs so the leakage current isn’t enough to trip any single GFCI.

For my display, I have replaced my GFCI outlet with a normal outlet. Not that this is *not to code*.

There is a single extension cord that runs from that outlet out to a Sockit Box that is in the middle of my yard.

Inside this box there are 4 individual GFCI outlets and I can split my loads across the all of those GFCIs.

I have one of these for each side of my display, and it has reduced the number of trips considerably.


Skiing penguins build log retrospective

My skiing penguins project has been up and animating for a few weeks, and I thought I’d write down the process for others so that they can learn from what I did. And also so I can remember what I did and why. There are some other blog posts that talk about some of the specifics for the sequence controller I built.

First off, there’s a video here that shows the final result.

The my initial idea was to do something with LEDs and single frame animation; see some of the animations that were done at ZooLights at Pt. Defiance many years ago was what got me into this hobby. I had a big garage roof that was unutilized, and after some discussion with my wife we decided that skiing penguins was a good place to start.

CAD

 I started looking around for online penguin designs to use as a starting point and found a couple. Then I started up Fusion 360 and created a new project.

I design (and sell) LED ornament kits, so I’m used to doing these designs. Here’s a video that shows the technique that I use to space the LEDs out evenly along an outline; that is what I used for all of the penguins. Here’s a in-process look at one of the designs:

image

and a final one:

image

The final designs were too big to cut in my laser cutter (glowforge), so I had to break them into two pieces. The puzzle-piece line gives me two individual pieces to cut that can easily be put together again.

The animation has 15 frames, which meant 29 individual pieces to cut.

Cutting

I figured out what sizes of plexiglass I needed and bought the plexiglass from my local TAP plastics; it was about $90 worth. I didn’t want to spend a lot of time splitting pieces on my table saw, so I defeated the door interlock on my Glowforge for the larger pieces:

IMG_9644

You really shouldn’t do this if you don’t have laser safety glasses designed for your particular laser’s frequency. In this case, I wore my normal safety glasses and closed off as much of the opening as possible; I now have a nice set of dedicated laser safety glasses. Don’t do this unless you understand the risks.

Here’s all the cut pieces stacked up:

IMG_9647

This is a penguin prototype:

IMG_9651

This was actually constructed earlier; it was used to determine size, and we decided to go about 25% larger. Thankfully, Fusion made this fairly easy to do.

Here’s the first production frame:

IMG_9654

You can see the glue residue along the joining line. At the left and right sides there are short connectors that overlap the joint and provide much needed stiffening; they are on both sides. The squares with holes are spacers; the penguins will mount to wood supports and the spacers hold the wood away from the wiring that will be on the back. Zoom in to see the fine details.

Here’s the pile of penguins all glued together and ready for LEDs.

IMG_9656

First light on the first frame:

IMG_9659

Green was planned for the body outline rather than the white in the prototype but I didn’t have enough green LEDs at the time. The LEDs are brightness matched to look similar to human eyesight though the blues look too bright to the camera. Only 13 more to go!

Here’s what the penguin looks like with the leds off:

IMG_9660

Sorry about the messy and distracting background. For each section of LEDs, there are two sets of bare copper; one that is connected to 12V and one that is connected to ground. Leds are grouped based on their voltages; green and blue run in groups of 2 while reds run in groups of 4. At this point I realized that my ski poles had 9 leds which means that I had two groups of 4 and one individual LED, which was a pain. Each group has the appropriate resistor to set brightness. There are 70-odd LEDs in this frame, so figure something near to 200 solder joints.

Here’s a picture of the workbench mess:

IMG_9662

That’s not that bad except there is more mess here:

IMG_9663

and here:

IMG_9664

To waterproof all the wiring, I took the penguins outside and hit them very heavily with clear acrylic spray. I’ll know how well that worked when I take them down:

IMG_9665

Here’s a view of them drying. They have waterproof power connectors attached and have frame numbers marked on them.

And then they were each mounted on short pieces of 2×3 wood which would have been painted if I had time; maybe I’ll do that when I pull them down after they have dried out. You can see the wiring quite well in this shot, and we can see that it’s frame “J”, or the 10th frame.

IMG_9670

The next step was to build the wiring harness. I did a diagram of the expected layout in Visio:

image

From that, I went out into my driveway, took a couple of tape measures, and laid out what I needed. The controller was planned to be under the roof where “K” is, so I would run wire to that point and then leave an extra 10’. I unfortunately don’t have any pictures of this process; I was racing the weather.

Basically, I would start at “A” in the diagram, leave a couple of feet of slack cable, run it up to D, across the top, and then down to K and leave 10’ at that end. Each cable gets an adhesive label with the circuit letter at each end, and those will later be covered with clear packing tape to waterproof them. Continue the process with each cable all the way through K. The cable is 22-gauge alarm cable; I have used twinlead in the past and I have to say that this cable was a huge upgrade in terms of ease of use, and at $31 for 500’ is was pretty cheap. I did calculations on the voltage drop and decided that it wasn’t too bad (about 7% IIRC).

Once I had all the cables, they got bunded together with wire ties at every branching location and then additional wire ties to make the harness easy to handle. I got it all done just as the rain came down for real, and headed inside. Each penguin location got the other half of the waterproof connector soldered on and then covered in heatshrink tubuing, and the controller ends got stripped to be connected to the controller. Here’s the final roof harness:

 IMG_9671

The penguins got installed on the roof with various arrangements of wood to support them and were plugged into the harness. I then spent a day or two figuring out how to do the penguins in front of the house; they are supported on 1/2” metal EMT tubing. I also created a separate harness for those penguins (one in the air, one crashed in the tree, and then a small one where the one in the tree lost his poles and skis) using the same process.

I finished building the controller:

IMG_9672

Nearest to us is the ESP32 controller board that runs the animation software, and behind it are two custom 8-channel MOSFET switching boards. Attached to the back MOSFET board is a series of LEDs used for debugging.

The ESP runs custom software that drives the ESP32’s 16-channel PWM hardware. The ESP32 is ridiculously full-featured for the price. One of my goals for the project was to *not* have to pull the controllers out of their installed location to update the animation, so I created a really rudimentary web-based IDE and an animation language:

image

This is the current active view from the ESP running the penguins as I sit here and write. The left textbox shows the code and the right one shows errors if there are any. I wrote the animation outline and programmed it in, and then took my laptop to the garage and we’d watch the animation and I’d tweak it as necessary, it took us about 10 minutes to get what we wanted, and I would have spent more than that on a single iteration of “unplug the controller, take it downstairs, plug it in, modify the software, compile it, upload a new version, take it outside, plug it back in, and see if it worked”. That worked very well.

I’m calling the language “Dim”, because it’s good at dimming things and not very smart. In the code “DI” means drive a specific channel to a specific brightness over a specific cycle count (each cycle is about 10mS, so it runs at 100 Hz), and D lets you specify more than one operation to occur at once during the following “A” (animate) command. The language does have for loops but is desperately in need of functions/methods for this usage; I have those in a newer version.

Here’s a bit of code running on a second instance of the controller that flashes 5 of the ornaments I make in a random pattern:

channel=2
FOR count 1:100
   D(50, channel, 0)
   channel=R(1:6)
   DI(30, channel, 1)
ENDFOR  
      

That took about 5 minutes to write.

Finally, here’s a daytime tour of the installation which shows the penguins mounted on the roof and in front of the garage and the controller board with terminal strips.



A self-expanding ESP32 PWM board…

I’ve been working on a little ESP32 expansion board/shield for an LED project I’ve been working on. One of the nice things about the ESP32 is that it has a peripheral known as “LED control” that provides 16 independent channels of PWM for controlling LED brightness, and my project uses that capability.

One of my projects is going to require all 16 channels, so I wanted to do a board that would support 16 channels, but I also wanted a version of the board that would only support 8 channels. I started with the 8 channel board and figured out a way to build a single board that would support 8 channels and also function as an expansion board to add the other 8 channels. I thought the approach was interesting enough to share it here…

Let’s start with a picture of the board:

image

I’m using the 20-pin development board, and it turns out that of the 16 channels supported by the LED control peripheral, half of them are on each set of pins. I started doing an 8-channel version of the controller; you can see the primary pins on the right side of the board that come into the center of the board and then head down into the MOSFET region of the board. That design was fairly simple to do.

Then I needed a way to do something with the 8 channels on the other set of pins. At that point, I realized that if I could use the same board to get the other 8 channels if I flipped the board over:

image

On the primary board, the pins for channels 9-16 on the left side of the board are connected to a header. The ESP32 will be connected to headers on the top side of the primary board, and then we will add a header to the primary board expansion pins – pins 9-16 – on the underside of the primary board.

We will then take a second board and flip it upside down. That puts the header pins that are connected to the MOSFETs on the left side of layout directly under the header on the primary board connected to the expansion pins, so we can just put a complementary header on the expansion board and just stack them together.

Here’s what it looks like in the real world. This is the primary board with headers for the ESP-32 on the left and MOSFETs on the right. That is set up for 8-channel mode.IMG_9631

To enable 16-channel mode, we flip this board over and add some headers. The top header connects to pins 9-16 from the ESP32, and then there’s a single pin on the bottom which connects to ground (if I do a future version I’ll add an extra pin on the left) to provide a bit more support.
IMG_9632

We then take a second board and set it up as an expansion board by adding the complementary headers to it.

IMG_9633

We can then finally stack the expansion board on the back of the primary board and add the ESP32:

IMG_9634

That gives us 16 outputs.

Here’s a short video demo of the controller:

And a second video that show my first project using it:


Sequence Controller Part 3–Board design and MOSFET testing…

Boards are in the house!

IMG_9608

JLCPCB did a nice job, and the boards look fine. Except:

IMG_9609

Yeah. Those pins are beautifully aligned a very precise 0.1” from where they are supposed to be…

Pro tip: Print out your design and put your components on it so that you can check the design.

Meta pro tip: Follow your pro tips.

Anyway, that’s not the only problem; it turns out that the power and LED parts of the connector are right underneath the end of the board, so you can’t use a normal header on them (you could use a right-angle one if you wanted), so I did a new revision of the board with 1.0” rather than 1.1” for the ESP and extended the board so the connectors are out on the end. That’s on the slow ship from China right now.

Then I did a bit of bodging with some long-tail female headers so I could still do testing.

IMG_9611

Then I put a header for the LEDs and carefully soldered 8 resistors and LEDs to the output pins, so that I have an 8-channel version available for writing software.

IMG_9612

The MOSFETs are pretty darn small, but soldering them was mostly okay. I didn’t bother doing a stencil for this rev so I could reflow, but I will likely do that for the next version.

I have not yet tested what I think is the coolest part of the design; the board is both a main board and an expander board; you can connected a second version of the board on the back of the one with the ESP32 connected to it, and it will get you channels 9-16.

Here’s a quick video of the current state:



Sequence controller test from Eric Gunnerson on Vimeo.

It’s doing a “breathe” on all 8 LEDs with varying timespans for the delay action.

This is the 6th or 7th time that I’ve written sequencing software; there was a Motorola HC11 version, two AVR versions with AC dimming, a 4-channel chaser, and a couple of WS2812 versions.

They were all very simple; take the current state of all the output and drive the outputs to a new state over a given period of time. That works fine, but writing the animation can be annoying and it’s not very compact. This time I wanted to do something different and more elegant:

Here’s my spec:

     IMG_9614

That means ‘loop variable %A from 0 to 7’, and then execute a 100 cycle (1 second) dim of channel %A from its current state to 1.0 (full bright), and then do the same dim back down to zero.

I also wanted to write the vast majority of the code on my desktop, so I took a break and wrote three blog posts about how I do that. It’s basically compile-time dependency replacement with unit tests mostly written using TDD.

Then it was off to writing a *lot* of test code and a lot of classes; 18 difference source files, only two of which are ESP specific at this point. And 15 test classes to drive the tests. It mostly worked great, I did 95% of my coding and only had once latent bug that I had to track down on the ESP32. It was weird one that turned out to have very random behavior. I suspected it was uninitialized data, and that turned out to be mostly right; two subsequent calls to a method used the same stack and I forgot that strncpy doesn’t copy a null. But it all works now. Here’s the code the video is running:

$1$LOOP %B 100:10:-10
    $1$LOOP %A 0:7
        $%B$D%A,1.0
        $%B$D%A,0.0
    $1$ENDLOOP
$1$ENDLOOP”

Variable %B is used to change the cycle count for the operations from 100 to 10 in steps of 10, and then the inner loop cycles through the 8 different outputs. Everything works great.

The code all lives here if you want to see the actual code or a more realistic testing example.

Next steps:

  1. Wireless implementation to do the connection to the ESP
  2. Save and load of the animation
  3. Web interface to edit the animation.
  4. Change the language to move the cycle count into the “dim” command, as it’s not necessary for the loop commands.
  5. Build a second board to test channels 9-16.





Sequence Controller Part 3–Board design and MOSFET testing…

Boards are in the house!

IMG_9608

JLCPCB did a nice job, and the boards look fine. Except:

IMG_9609

Yeah. Those pins are beautifully aligned a very precise 0.1” from where they are supposed to be…

Pro tip: Print out your design and put your components on it so that you can check the design.

Meta pro tip: Follow your pro tips.

Anyway, that’s not the only problem; it turns out that the power and LED parts of the connector are right underneath the end of the board, so you can’t use a normal header on them (you could use a right-angle one if you wanted), so I did a new revision of the board with 1.0” rather than 1.1” for the ESP and extended the board so the connectors are out on the end. That’s on the slow ship from China right now.

Then I did a bit of bodging with some long-tail female headers so I could still do testing.

IMG_9611

Then I put a header for the LEDs and carefully soldered 8 resistors and LEDs to the output pins, so that I have an 8-channel version available for writing software.

IMG_9612

The MOSFETs are pretty darn small, but soldering them was mostly okay. I didn’t bother doing a stencil for this rev so I could reflow, but I will likely do that for the next version.

I have not yet tested what I think is the coolest part of the design; the board is both a main board and an expander board; you can connected a second version of the board on the back of the one with the ESP32 connected to it, and it will get you channels 9-16.

Here’s a quick video of the current state:



Sequence controller test from Eric Gunnerson on Vimeo.

It’s doing a “breathe” on all 8 LEDs with varying timespans for the delay action.

This is the 6th or 7th time that I’ve written sequencing software; there was a Motorola HC11 version, two AVR versions with AC dimming, a 4-channel chaser, and a couple of WS2812 versions.

They were all very simple; take the current state of all the output and drive the outputs to a new state over a given period of time. That works fine, but writing the animation can be annoying and it’s not very compact. This time I wanted to do something different and more elegant:

Here’s my spec:

     IMG_9614

That means ‘loop variable %A from 0 to 7’, and then execute a 100 cycle (1 second) dim of channel %A from its current state to 1.0 (full bright), and then do the same dim back down to zero.

I also wanted to write the vast majority of the code on my desktop, so I took a break and wrote three blog posts about how I do that. It’s basically compile-time dependency replacement with unit tests mostly written using TDD.

Then it was off to writing a *lot* of test code and a lot of classes; 18 difference source files, only two of which are ESP specific at this point. And 15 test classes to drive the tests. It mostly worked great, I did 95% of my coding and only had once latent bug that I had to track down on the ESP32. It was weird one that turned out to have very random behavior. I suspected it was uninitialized data, and that turned out to be mostly right; two subsequent calls to a method used the same stack and I forgot that strncpy doesn’t copy a null. But it all works now. Here’s the code the video is running:

$1$LOOP %B 100:10:-10
    $1$LOOP %A 0:7
        $%B$D%A,1.0
        $%B$D%A,0.0
    $1$ENDLOOP
$1$ENDLOOP”

Variable %B is used to change the cycle count for the operations from 100 to 10 in steps of 10, and then the inner loop cycles through the 8 different outputs. Everything works great.

The code all lives here if you want to see the actual code or a more realistic testing example.

Next steps:

  1. Wireless implementation to do the connection to the ESP
  2. Save and load of the animation
  3. Web interface to edit the animation.
  4. Change the language to move the cycle count into the “dim” command, as it’s not necessary for the loop commands.
  5. Build a second board to test channels 9-16.





Sequence Controller Part 2–Board design and MOSFET testing…

Having chosen MOSFETs, I went off to do some board design. I’m hoping this will be a very simple design; it needs to provide power to the ESP, connect ESP outputs to the driving MOSFETs, and provide connections for the loads to the MOSFETs.

Here’s the schematic:

image

On the right we have all of the LOAD outputs; we’re using N-channel MOSFETS to switch to ground, so there are 8 outputs plus a ground. Somewhat conveniently – assuming I’ve read the data sheets right – there are 8 PWM outputs on the right side and 8 on the left.

In my WS2811 extender I put both positive and negative terminals for the load on the board, but in this case I don’t have room so only the ground connections show up.

The other two 9-pin connectors – ExtOut1 and ExtIn1 – are for a feature that I’m hoping will be very cool, but it will be oh-so-easier to explain when I have boards in hand.

One question I already had was whether the ESP could put out enough current to switch the MOSFETs quickly enough. The time spent switching is time the MOSFETs spend in their linear region, and the Rds is much higher during that period. The SOT-32 package doesn’t give much opportunity for heat dissipation.

I didn’t have any protoboards to mount the MOSFET on, but I did have some WS2812 LED boards that I made. Two of the solder pads matched and I used a short wire to hook on the third one.

IMG_9584

That’s wired up to the ESP.

IMG_9582

The ESP running very simple code that ramps up to full brightness and then back down.

I then needed a test load. I don’t actually have a good 2-3 amp 5V test load, so this was my first test:

IMG_9581

That’s 5 of my ornament kits stacked on top of each other. At full brightness they are pulling just over an amp, which is my design point (more would be better). I let it ran on that for a few hours, and the MOSFET was maybe a little warmer than ambient, but barely. I threw on my 12V light bulb testing rig, and got 1.5 amps, and it was also fine with that. Two of those bulbs in parallel would unfortunately be 4 times the power which is more than the MOSFET is rated for, so I’ll need a different load to finish my testing.

I am a little concerned that the ESP may have issues driving more than 1 channel as there could easily be 8 (or 16) channels trying to change all at once. The ESP has 16 independent PWM channels and I’m thinking that if I desync the frequencies slightly (say, 500 Hz, 501 Hz, etc.), the transition points for the PWM will generally not be at the same time.

Anyway, I considered that enough of a test to do the board design. I had to do a custom component and footprint for the ESP because I couldn’t find one that matched my 30-pin DEVKIT board.

One of these times I’m going to remember to do a video of the layout process, but I usually enjoy it so much that I don’t remember.

image

The MOSFETS live at the bottom to minimize the length of the traces that carry the most current, and to put them all near the bottom. The high-current traces are 1mm wide; I could likely go to 1.5 or even 2mm but that seems like a bit of overkill for the currents I expect. The driving traces from the ESP are 0.5mm because I want to get charge into and out of the gates as quickly as possible.

There is a bit of creativity on the left side; the pins on the 9-pin connector are quite a bit offset from the ones on the ESP, so I took pin 12 and 13 and ran them up to the two top pins to make the rest easy to layout.

The board is meant to be an “undershield”; I plan on putting female headers in the 15 pin connectors of this board and those will mate with the male headers that are already on the board. The power and load connectors should probably use right-angle headers.

I spun a small order of these boards for testing.






Sequence Controller

I’m working on a new display for the upcoming holiday season – actually a couple of them – and I need some new controller hardware to drive them.

Here are the basic requirements that I jotted down:

  • 8 outputs (perhaps expandable to 16)
  • Each output can drive 1 amp at 12V
  • Designed to deal with sequential animation (do this on output 1, do something else on output 2, etc.)
  • Dimming support if practical
  • Easy setup and and configuration
  • Compact & cheap (within reason)…

With those in mind, I started thinking about components…

My go-to microcontroller has been the ESP8266 (in NodeMcu mini d1 form) for a while, because it’s so small and cheap. But it’s a bit weak on output pins; you can get 7 pretty easily, but to get more you may have to play tricks. Supposedly you can get to 11 with those tricks which would be okay for 8 but would make 16 possible without some sort of I/O expander.

Which brings me obviously to the ESP32. Which is honestly a ridiculously capable device; 160 Mhz, 520K of SRAM, dual core (if you need it), Wifi, bluetooth, and pretty much all the I/O support you could want. It’s a little more pricey, about $4 from China in single quantities.

For this project, it has loads of output pins, and 16 independent PWM channels, which fits pretty well into my requirements. And I’m hoping I can adapt my existing controller software – which is optimized to drive WS2812s – to work in this new scenario.

MOSFETs

The switching will of course be handled by n-channel MOSFETS. My WS2812 expander uses DPAK (TO-252/TO-263) packages, which work great but take up a lot of real estate. That was okay for a small number of channels, but for 8 channels I’d like something smaller and I don’t need to be driving 10 amps per channel, which was my design goal for the expander.

So, my requirements are:

  • 1 amp @ 12V
  • Switchable from 3.3V outputs (I could add a transistor to drive, but I’d rather avoid the complexity)
  • Low Rds at 3.3V
  • Small package
  • Enough power dissipation

I started doing some parametric searches in DigiKey and on Octopart, narrowed things down, and came across the BSR202N from Infineon. How does it stack up?

  • 3.8 amps @ 12V (25 degrees, 3.1 at 70 degrees)
  • Specified behavior down to 2.5V.
  • Rds of 33 milliohms at 2.5 V.
  • SOT23 compatible package
  • 500 mW power dissipation

Those specs are honestly ridiculously good, especially the Rds. If I pull 3 amps through one of the channels, that gives me 0.033 ohms * 3 = 0.1 watts. Just a tenth of a watt to switch 3 amps. If I did that with a bipolar, it would be in the range of 1.8 watts (I’d definitely need a heatsink) and I’d lose 0.6 volts in the process.

In reality, it will likely be a little better than that since the Rds is lower at 3.3V, but I don’t know how much 3 amps will be heating it up and that will make the Rds worse. It will take some testing to see.

My only big concern whether the ESP32 has enough drive to deal with the gate capacitance while doing PWM, as with PWM it’s switching all the time, and slow transitions mean slower switching, more heating, and therefore worse Rds and more heating. I’ll need to do some testing, but my guess is that with a PWM rate of 250 Hz it probably won’t be a significant problem in typical usage patterns.

If it does turn out to be an issue, I’ll add a small bipolar in front of the mosfet. That will give me lots of drive for very fast switching plus a higher Vgs for a lower Rds. It will invert the PWM so I’d have to flip things in software, but that’s simple enough. I’m hoping to avoid it because it will require two resistors per channel, so it’s a nice 8 MOSFETs by themselves or with an added 8 bipolars and 16 resistors, which makes building the boards more of a pain (the cost is of the bipolars + resistors is a few cents per channel).

Expandability

My current thought is to make the boards stackable like arduino shields, and I think I have a scheme that works.

I have the ESP32 boards in my hot hands, but I need to get my hands on some of the MOSFETS to do testing. In parallel, I’m going to start the board design.



EagleDecorations Ornament Creation Instructions

Thank you for buying one of our ornament kits. These are the generic instructions that apply to all of our ornaments; please look at specific instructions for your kits for more details.

Tools & Supplies

You will need the following supplies:

  • A small soldering iron
  • Solder
  • Needle nose pliers
  • Diagonal cutters or other tool to trim leads and wire
  • A power supply for the kit your ordered – either a 5V USB charger or a 12V power supply.

LEDs and Resistors

To keep LEDs from burning up, we will be including resistors that will limit the flow of current through the LEDs and equalize the brightness between different ornaments.

Depending on the color of the LED that we are using the the voltage we are using for the ornament – either 5 volts or 12 volts – we will be connecting chains of 1, 2, or 4 LEDs to a single resistor. The instructions for your kit will tell you how many LEDs to put in the chain for each resistor. If there are multiple colors in your ornament, each color may use a different number of LEDs in the chain.

Creating chains

Here is an example of creating chains of 2 or 4 LEDs, taken from the yellow star ornament:

IMG_7062

Note that the LEDs are placed with the longer lead towards the outside of the ornament. That is the basic pattern we use for all of the ornaments.

IMG_7063IMG_7064

In these pictures, we are making chains of 2 LEDs. In the left picture, the longer lead on the closest LED is bent towards the shorter LED of the next LED. In the second picture, the short LED on the second LED is bent back towards the long lead from the first LED. Connections between LEDs should always be done in this manner.

Here is what it looks like after creating two chains of 2 LEDs:

IMG_7065

A 4 LED chain looks like this, with 4 LEDs connected in a chain.

IMG_7066

A full set of chains

The outline of an ornament will be a series of chains; it will look like this:

IMG_7068

Adding resistors

After the chains are created, we will need to add a resistor for each chain. The resistors are always connected to the inside (shorter) lead at one end of the LED chain:

IMG_7069

When all the resistors are connected, it will look like this:

IMG_7070

Hooking the chains together

The next step is to hook all of the chains together. We will do the insides first. This is done with some of the bare copper wire included in the kit. Start by taking the wire and bending it into a rough approximation of the template, and then put that inside the wire.

We will be connected the currently unconnected end of each resistor to the bare wire.

IMG_7071

As shown in this picture, you may need to reroute the resistor wire a bit to make it easier to connect to the bare wire. Here’s a close up of that:

IMG_7072

Once all the resistor wires are soldered on, trim the resistor wires. Next up are the outer wires. The outer wires run around the perimeter of the LEDs and are soldered to the remaining unconnected LED lead. Make sure the outer wire does not touch any other wires.

It is very useful to clamp the outer wire down as you are routing it around. I use a little alligator clip:

IMG_7074

Here’s what it looks like when finished:

IMG_7076

At this point we would test by applying the appropriate voltage to the inner and outer bare wires.

Adding the power cord

Locate the power cord – either the USB one with the 5V kit or another one if you are building the 12 volt version.

At the bottom of the ornament, you will find two tiny laser-cut holes. The are for the zip-tie that will hold the power cable in place. Pass the zip-tie from back to front and then to the back again, place the power cable in approximately the location you want and lightly secure it with the zip tie. Solder the power cord wires to the two bare wires, verify that it works, and then tighten the zip tie. Cut off the extra.

Success! You have completed the ornament:

IMG_7080

Protecting the wires

The wires only carry low voltage, so there is little shock hazard.

If you want to waterproof the ornament, I have had good luck with 100% clear silicone sealant. Make sure to cover the base all the LEDs and over and under the resistors and all wires. This approach has survived multiple holiday seasons outside in wet and cold weather, but there is no warranty for outside use.


WS2811 Expander Part 6: of MOSFETS and voltage drops…

After I wrote the stress test article, I decided to put a voltmeter across the drain and source of the MOSFET and figure out what the voltage drop was. I hooked up the output to an LED ornament, watched the brightness cycle up and down, and put my probes on the MOSFET.

What I expected was pretty simple. In the sweet spot of the MOSFET I’m using, it claims a Rds – resistance between drain and source – of 10 milliohms. That means I should expect a voltage drop at 5 amperes of:

V = 0.01 * 5 = 0.05 volts

That low voltage drop is one of the reasons to use a power MOSFET; a bipolar transistor would have a voltage drop of about 0.6 volts, and therefore waste more power and get hotter.

The voltage jumped around a little, and settled down at full brightness:

0.8 volts

Okay, that is really unexpected; I played around with different voltages, and I still got 0.8 or 0.9 volts.

My first thought was that the MOSFETs that I got from Ebay might be counterfeit, so I waited for my order of real parts to show up from Arrow, built a new board, and it read:

0.85 volts

This is really confusing, so I asked a question on Reddit’s /r/AskElectronics subreddit.

The first answer I got was that it might be the base diode because I had the MOSFET backwards.

So, I pulled out the datasheet for the MOSFETS and looked at my schematic and board in Kicad. As far as I can tell, everything is wired correctly.

A deeper answer suggested that if I was doing PWM (I had been testing at brightness = 250 because I knew that would be more stressful for the MOSFET than always on), I should test with always on. It also talked about gate capacitance.

<digression>

This is one of those cases where real devices diverge from ideal devices. FET stands for “Field Effect Transistor” – current through the source and drain is controlled by the field on the gate. You establish a field by the flow of current to charge it up to an appropriate voltage.  The amount of current it takes depends on the gate capacitance (described as “Input Capacitance” on the datasheet). For the MOSFET to turn on, you need to flow enough current to establish whatever voltage you want on the gate.

Or, if you think of the gate as a capacitor, it takes a bit of time for it to charge. In my case, the time it takes to charge will be controlled by the pull-up resistance and the capacitance.

Let’s say we are running at 5V, and our MOSFET has 1nF input capacitance (pretty close), and we are charging through a 10K capacitor.

This calculator says that the time constant is 0.00001 seconds, or 10 microseconds.

</digression>

So, I went and changed the animation code to run all the way to full on – luckily my code is running on an ESP8266 and animations can be changed over WiFi – and rechecked the voltage drop.

Would it surprise you if I told you it was 0.8 volts? Probably not at this point…

Perhaps it’s my voltmeter; I have a nice Fluke but how about if I try using my oscilloscope (a Rigol DS1102D I picked up a while back)?

So, I powered it up, hooked it up, and looked at the waveform across the load. I showed the a nice PWM waveform…

But wait a second… I had updated the animation.

My debugging rule is that when things seem unexpected, back out a level and retest the assumptions. Usually one of those is wrong.

I started with my controller code. I suspected the gamma mapping code, so I added some Serial.println() statements and verified that, yes indeed, the colors were getting set to 255. So, that part was fine.

I next suspected the support library I use (the rather excellent NeoPixelBus). I read through a bunch of source but didn’t seem to be any issues. The code all looks fine…

Was the data getting to the WS2811 correctly? So, I fired up the scope again and hooked it to the data line. On full on, the data looks like this:

NewFile0

The WS2811 uses an encoding scheme where a short positive pulse means “0” and a long positive pulse means “1”.

That is a full string of ones; you can’t see all 24 of them, but trust me when I say they are there. You can see this switch back all the way to all zeros as the animation progresses.

So, the software is telling the WS2811 to go to full bright, but it is still turning off for part of the cycle. Here’s the output straight from the WS2811:

NewFile4

That little positive spike is 29.4 microseconds, which is about 5% of the 536 microsecond cycle time, so full bright is only 95% bright.

The cursors on the capture show the start of two sequential PWM cycles, and the scope nicely tells me that it’s updating at 1.87 KHz. Which is another weirdity, since every source I’ve seen suggests that WS2811s update at 400Hz.

At this point I’m beginning to wonder if I have a WS2811 clone. I thought it might be the same IC used in the SK6812 ICs, but the claim is that they have a PWM frequency of 1.1KHz which is less than I am seeing.

So, it’s off in search of some real WS2811s. It is really easy to buy cheap ICs made in China but is surprisingly hard to find an authorized source. There are lots of sources on aliexpress, some looking pretty shady. Octopart found me a 10-pack from Adafruit for $4.95. I finally found lcsc.com, which specializes in this sort of thing, and ordered some. They look to be WS2811S chips, but I can’t find any information on what the “S” means. More on that when they show up.

Back to voltage drop…

Since the WS2811 wouldn’t go into “full on” mode, I needed a test setup to do my testing. Here’s what I came up with:

image

In the right middle is the MOSFET, with clips connected to the lead and the body. In the picture, it is running only the LED Star, which pulls 145mA of current.

One of the fun things about MOSFETS is the gate holds onto the charge, so if you just touch the gate to 12v, it turns on and stays on. Touch it to ground, and it turns off, and stays off. I measured the voltage drop across the MOSFET.

I next decided to hook up my test load. I started with a single 50 watt bulb, a 4 amp load. I carefully hooked it up in parallel with the led star, and…

There was a loud “crack” and the led star went out. No magic smoke, but the MOSFET was toast. The gate was floating, and there wasn’t enough charge there to put it firmly into full conduction, so it was in the linear zone and quickly overheated, melting the plastic on one of my clamps. So… replace the MOSFET, make sure the gate is attached to positive, and try again. That worked, and the MOSFET was only mildly warm. Let’s try two bulbs for an 8 amp load. That worked, *but* there is no heatsink and it got hot pretty fast, so I unplugged it before it got too hot.

I collected some data and figured out that the Rds was about 90 milliohms, which is a lot higher than the 10 milliohms I expected. That was a mystery for about 8 hours, until I was writing this up and realized that I was measuring the voltage drop at the ends of the leads connected to the MOSFET. The thin leads.

So, I went back and measured right at the MOSFET, and got a Rds of 7 milliohms, a bit better than the 10 milliohms that was spec’d. So, yay!

Faster switching

Returning to our somewhat slow switching, here is what I saw:

NewFile2NewFile3

The negative transition is when the transistor turns on; notice how effortlessly and quickly it pulls the gate voltage down. And when the transistor turns off, note how long it takes it for the gate voltage to charge back up. It’s roughly 10% of the overall cycle time.

Which is a bit embarrassing; I chose the 10K value as a typical pullup value, not thinking about the fact that this was happening on every PWM cycle. It can only supply about 1 mA of current.

The most obvious thing to try is to replacing it with a 1K resistor. That will result in 10mA of current and should switch roughly 10 times faster. Can the transistor handle it? The datasheet says that the 2N3904 can handle up to 200 mA continuous, so that will be fine. Is the base resistor okay? Well, transistor has a DC current gain of at least 50, so that means we need a base current of 10mA / 50, or 0.2mA. The 5V from the WS2811 will push about 4 MA through the 1K base resistor, so that’s way more than enough. It would probably be fine with a 10K base resistor, actually.

I took one of the boards and replaced one of the 10K resistors with a 1K resistor and then looked at the gate drive:

NewFile5

In case it’s not obvious, the top version is with the 1K resistor and the bottom one is with the 10K resistor. More than good enough for my application.


WS2811 expander part 5: 12V stress test…

One of the points of the expander is to be able to drive bigger loads than the 18mA that the WS2811 gives you directly. Much bigger loads.

To do that, I needed something that would stress the system, and I needed to verify that the design worked with 12V.

First off, I needed to cut a new stencil uses the paste layer:

IMG_9501

That’s a bit nicer than the first one; there is adequate spacing between the pads this time.

Aligned it on the board, applied paste & components, and reflowed it. Here’s the result, still warm from the oven:

IMG_9502

All the components self-aligned nicely, no bridges, no missing wires. Perfect.

The only thing I need to do is get rid of the center pad for the MOSFETs, since they don’t actually have a center pin.

How to test it?

Well, I dug through my boxes and found a 5 meter length of 12V LED strip. It says that will be 25 watts. I hooked it up and verified that all 3 output channels are working. It’s running an animation that ramps from 0 to 255 over 2 seconds, holds for 2 seconds, and ramps down for 2 seconds. I chose that because the quick switching is the hardest for the MOSFET to deal with from a heat perspective.

But 2 amps isn’t quite enough. I dug out a 12V power supply that claims it can do 6 amps and hooked it up to one output channel:

IMG_9504

That’s the NodeMCU board in the upper right, powered by LED, the data and ground running to the board, and then some decently-hefty wires running to the board.

More load, more load, more load. I want something that soaks up the 12V. Incandescent car bulbs are nice but I don’t have any handy. But I do have an extra heated bed for my 3d printer; it’s a nice 6” x 6” pc board. Hooked that up in parallel with the lights:

IMG_9505

Ignore the breadboard…

This worked just fine. The board heated up to about 170 degrees, the lights worked fine, and the MOSFET on the driving board just *barely* heats up. My measurements show that it’s switching about 5 amps of current.

The only one that’s not happy is my cheap power supply, which is putting out a nice 10Khz (ish) whine when under load.

I switched over to run it on all the time to see how that affected things. After 10 minutes, the board is up to about 110 degrees, the printer bed is up to 240 degrees, and the 12V power supply is 125 degrees.

I think I’m going to rate it at 6 amps total; that gives a lot of margin, and frankly 70 watts is quite a lot of power for this application.


Pages:1234