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.






DORMA

Preparation

A few years ago, I got the idea of doing a solo ride along the RAMROD (my 2013 writeup here) route but in the reverse direction, which would obviously be named “DORMAR” (RAMROD backwards). It looked like it was doable from a water perspective, and would have the advantage of putting all of the climbing in the first 75 miles of the ride, rather than putting a huge climb in at 90 miles into the ride. That would be better because it would be cooler. And you could do *all* the climbing, including the last 600’ up to the Paradise visitor’s center which the Park Service no longer lets RAMROD do.

I was excited enough to create a Facebook group and write a Rider’s Guide. Even scheduled a day for it.

And, for two years, I found excellent reasons not to do the ride. Which means that I’m thinking that I really can’t finish the thing comfortably.

This year, my lovely wife offered to drive SAG for me, which means I could ride it solo – which is really my preference – but without having to be wholly self-sufficient for the whole ride. My tentative plan was to meet her in Eatonville (115 miles in, after the majority of the climbing) to have a lunch, and then I would ride the last 40 miles.

That was the working plan, and this time I actually came up with a date – the Monday after RAMROD, July 29th this year.

Further planning commenced. And I realized that while I was really looking forward to the climbing part of the day – and the descents, I love the descents – I was unexcited about 40 miles of mostly flat riding in the heat of the afternoon after all the climbing. 3+ hours in the heat of the day after already doing all the hard work? I knew that I didn’t like the last 30 miles of RAMROD, and that at least was downhill (though with a headwind).

Hmm. What would you call such a ride? It’s a little bit shorter than the DORMAR, so let’s chop a letter off of the name and we’ll call it “DORMA”. It will be 116 miles and over 8000’ of climbing.

So, I spent a few hours creating the following in Inkscape:

image

I am *exceedingly* happy with how that turned out. It’s supposed to look something like this. For those of you who would prefer English, from left to right, Greenwater, Crystal Mountain Blvd, Cayuse Pass, Grove of the Patriarchs, Backbone Ridge, Inspiration Point, and Paradise (yes, it’s not really a Mont, but from the way climbs are named I think that makes the most sense).

So, there’s a 32 mile climb from Enumclaw to the park entrance at Crystal Mountain, then a climb up Cayuse (1700’ over 6.1 miles), a climb up Backbone ridge (1330’ over 5.6 miles), and a climb up to Paradise (2621’ over 12.5 miles). None of the climbs are particularly steep – last weekend I did 4000’ of climbing at 9% – but there’s certainly a lot of it.

For Kim to be SAG, she needs to have some idea of when I’m going to be at various points along the route. That is a bit of a challenge. For the main climbs, I actually have some data from last summer of the first climb, and it showed that I did that section in 50 minutes, which meant I was climbing at 34 feet per minute (at 195 watts, if you care). For the descents and easier climb at the beginning, I based it off other numbers I had or just a decent guess. That gave me the following timeline:

image

That’s 9:20 minutes total, 8:50 riding and :30 resting. That’s a little over 13 MPH average, and while my last run of RAMROD came in at an even 15 MPH, that included 50-60 paceline miles which bumps the average up a bit.

I put this all together in a guide for my wife, along with a map of the Eatonville end location (the Visitor’s center that RAMROD uses as the first stop).

T-1

A list of tasks done in preparation for the ride, in random order:

  • Charging of electronics
    • Headlight to deal with the early start
    • Rear blinkie (these are technically required when riding in the park but are spottily enforced)
    • Di2 shifters (very happy to remember this)
    • MP3 player
  • Downloading of podcasts
  • Inflation of tires (80 PSI for my 700×28 Conti GP4s.)
  • Lubing of chain
  • Replacement of backup rear blinkie
  • Testing of backup backup rear blinkie
  • Clothing Selection
    • My best Castelli bibs
    • A Nike Dryfit underlayer (it’s not going to be very hot)
    • My Rails to Trials Jersey (a bit too big, but bright yellow, so good for visibility and not too hot. And really big pockets)
  • Pack bike bag (I have a cloth shopping bag that holds all of my basic riding stuff; arm/leg warmers (hope to skip these), light vests and coats, shoes, helmet, gloves, etc. This is a “grab and go” bag, so all I really needed to do was make sure I had my gloves and headband, which get hung up to dry after rides.
  • Tightened the BOA retention wheel on my left shoe
  • Food and drink prep (I don’t need much food these days, so it’s a lot more than I need)
  • Three servings of hydration mix (Bio Steel), one in a bottle and two in a pack.
  • A bag each of:
    • Mixed nuts
    • Trail mix
    • Cheez-its (my traditional long-ride fuel)
  • A bag of homemade jerky thawing in the fridge that I hope not to forget
  • A serving of SuperStarch to drink before I start.
  • Put sunscreen, chamois butt’r, and MP3 player/headphones in my small bag.
  • There are only 5 or so turns on the entire route and I have them in my head, so there’s no need to bring any maps or use my GPS to navigate. If I was doing the whole ride back to Enumclaw, I’d probably have done nav for the last section.

    I got a decent but not great night of sleep two nights before, and that is the one that really matters; the night before I typically never sleep well and since I’m getting up at 4AM I’m going to be messing with my REM sleep anyway.

    We headed down to Enumclaw, checked in at the Rodeway Inn, and went out for dinner at the Rainier Bar & Grill. I had a decent burger.

    From wakefullness to ridefullness

    After a malfunctioning AC and a hot crappy night of sleep, I woke up at 4AM for my 5AM departure. I don’t need that much time to get ready, but my eyes are much happier with contacts if I’m up for a bit.

    As part of getting ready, I took a look at the current weather. I had planned my gear based on mid-50s and then warming up as the morning went on – which for me would mean a vest and maybe arm warmers. Even though I’m wearing my “Rails to Trails” jersey which has giant pockets, I have a lot of stuff and clothes take up a lot of space, so I don’t want to take too much.

    51 degrees.

    Yikes. The logical thing to do would be to add my leg warmers, but leg warmers are really bulky and not easy to carry when you take them off (you can stuff them inside your bibs but they will keep you warmer than you like. So, it’s vest & arm warmers and hope that it warms up quickly.

    I drink 3 servings of SuperStarch mixed in water. SuperStarch is modified cornstarch, so go to your kitchen, take about 1/3 of a cup of cornstarch and add it to a glass of water, and drink it down. I’ll wait.

    Nasty, wasn’t it? But I’ve had good luck with it as a time-release glucose source.

    I glance at my watch as I ride out of the hotel parking lot, and it says 5:01. Perfect

    Enumclaw => Park Entrance

    32 miles, 2146’ of up

    As I head out on highway 410 – with front and back lights as it’s still *dark* – it’s a nice and still night and 51 degrees doesn’t feel as cold as I expected. I’m cold, but not that bad. Bodes well.

    The moon is out as a waning crescent; just the smallest slice bright and the rest slightly illuminated from earthshine. Pretty.

    The first 3 miles climbs about 500’, and I warm up pretty well during this section. There’s pretty much nobody at all out on the road; a few trucks heading to the gravel plant for the first mile and then it’s almost empty. I’m listening to Radiolab podcasts on this ride to keep me occupied (yes, I can still hear cars & trucks approaching), and after the first hill section I’m spinning along at about 170 watts. I want to keep a decent pace but I don’t want to use too much energy or legginess (legity), so I’m trying to stay in the sweet spot in between.

    After about an hour, I zip my vest back up because my hands are getting a bit cold. I flip over to another screen on my GPS to see the temperature…

    41.7

    Damn. I can tolerate the cold pretty well and my core temp is okay so far, but my knees do not like being this cold. Nothing to do but press on.

    The rest of this section passes slowly and it does warm up *slightly* as I keep going; the base of Crystal Mountain Blvd – where the National Park starts – is all the way up to 44 degrees.

    Cayuse Pass

    6.1 miles, 1700’ of up

    This section is a big misleading; the first two miles after you enter the park are the same gradient so you think it’s going to be easy, and then the pass begins.

    I haven’t been able to find out who designed Cayuse Pass, but he was pretty bull-headed. Starting at the top point, the route wraps around the hill contours but barely wavers from a constant 6%. That means it’s easy to find a groove and stick to it, but there’s pretty much no variety to be had. I’ve been eating a bit to keep my reserves up; a bit of trail mix and some Cheez-Its. And drinking, despite me not sweating much, as they last thing you want in the mountains is to get behind on hydration. There’s a nice view of the southeast side of the mountain at one point, but I keep climbing. The sun is up but I’m on the west side of the hills and therefore still in shadow.

    Eventually, I finally top out at the top into the sun and 47 degrees. My timeline estimate was that this would take me 3:20 and it actually took me 3:40, which I’ll note is pretty much exactly 10% slow. I was a little lower on wattage than I had expected, but it’s a long day and this is not the part of the ride to try to push.

    Cayuse Pass Descent

    11 miles, 2584’ of down

    The Cayuse descent is a bit like the climb I just finished; 8 miles of 6% and then a flatter 3 mile section. I really like mountain descents, the road is good, and the constant 6% gradient means that I can cruise along at around 31-32 MPH at about 150 watts. I rarely coast on downhills as spinning keeps my legs warm. There are two sections at the top that head eastish and are therefore in the sun, and I warm up a bit, but most of the route is once again on the west-facing side and are pretty cool. My next climbs are going to be on hills facing east, so I’ll have plenty of chance to warm up soon. A glorious 14 minutes of fast descending takes me to the runout section, and I get to the park entrance at 4:04 into the ride, or 24 minutes behind my estimate.

    A young park ranger takes my $15 – she does not offer the “Just go ahead” discount that I got when I climbed Sunrise last year – and I head to the Grove of the Patriarchs stop.

    If you are in the area, this is a great stop; the trees are truly massive and the short loop hike is worth the effort. I’m only here to use the bathroom and to refill my water bottles. My hydration state seems okay so I mix a bottle of BioSteel to replace the one I had just finished and fill my second bottle as much as possible – which is only about 50% given the water fountain stream. I drink a bit extra, refill it as much as possible, and head out after a quick 10 minute stop. 5 minutes of time made up on the stop.

    Backbone Ridge

    5.6 miles, 1330’

    This is the baby climb of the ride, but at 1330’ of up, it’s still quite a bit of vertical. I’m still trying to climb at a reasonable pace, and it seems that my pace today is a bit slow; it takes me 50 minutes to do this climb and I’m only climbing at 441 meters per hour; my usual rate is closer to 600 so this doesn’t bode particularly well. The climb isn’t very steep – only about 4% – and the temp is in the 50s and there are sections of sun. I feel decent, I’m just not riding very fast. Sometimes it happens.

    And my butt is hurting. I’ve had a saddle sore for a while, and it’s flaring up. That means I need to stand up every few minutes, which I do fairly often anyway to stretch my legs but not this much. Both of those are having an effect on my speed.

    On the way up there is a cycling group with matching jerseys that pass me going down. There are few cars.

    The descent is a fun one, and there’s a bit of flat. A miscalculation means that I’m done with RadioLab, so I switch over to music.

    My data says that I’m 22 minutes behind my timeline at this point, but other than a general sense of where I was at the top of Cayuse, I don’t know it at the time. It’s only relevant for Kim driving SAG, and there’s little I could do about it even if I knew.

    Paradise

    12.5 miles, 2621’

    This climb is 300’ shorter than the climb up to Sunrise that I’ve done a few times, and it’s dwarfed by the 5000’ Hurricane Ridge climb on the Olympic peninsula, but that’s still quite a bit of climbing.

    Nothing to do but HTFU and climb it. I feel decent but not strong, so I settle into a constant pace, which later data shows is a disappointing 170 watts.

    I climb, climb, and then I climb some more as I work my way up the ridge. After 46 minutes I take a quick stop to eat some jerky (on this climb I think trying to eat it on the bike will end up using it to decorate the roadway, providing an unexpected protein windfall to the local fauna). This is *not* my jerky – which I did manage to leave in the fridge at home – but a decidedly inferior substitute purchased at a gas station.

    Then it’s back on the bike to ride the rest of the way to the top. During the climb I stand up 19 times to rest my butt.

    Eventually I hit the switchbacks and reach a point where I can actually see the mountain, and then a bit more climbing and I reach Reflection Lakes where it flattens out, and then after a bit of downhill it’s just the short 600’ climb to the Paradise Visitor’s Center. Lots more traffic on that section and I’m pretty toasted, but after what feels like another 10 hours on the bike, at 11:45 I hit the top, where I get off my bike to fill my bottles, take a rest, and look at The Mountain. Despite it being a weekday, the place is packed.

    List of things on Eric that hurt:

    • Back
    • Butt
    • Feet
    • Toes
    • Knees
    • Pride

    My feet are really tender, likely from all the standing, and my knees – which pretty much never bother me even on really hilly courses – are hurting a lot. If I was smart, I’d take a couple of ibuprofen, but apparently I’m not.

    My target time for the climb is 80 minutes, and it ends up taking me 100 minutes, so about 20 minutes slow, or about 45 minutes behind in total. A little of that can be attributed to altitude; the average altitude of the climb was about 3750’, and – looking at some references on Alveolar O2 and altitude – I can calculate that I’m down about 13% on oxygen, and that goes up to 18% at the top.

    Math Pop Quiz:

    Q: It is currently 9:45. You are going to perform an activity that you expect to take 80 minutes. What will the time be when you finish? Please show your work.

    A: Well, 80 minutes is 1:20, so at means 10:65, but that’s not a real time, so normalize it to 11:05.

    Did you pass? I didn’t, as a look at my timeline will show that I ended up with 12:05 as my expected endpoint for this climb. So, rather than being 40 minutes late, I’m suddenly 20 minutes early.

    I obviously didn’t realize this at the time;I just knew that I had beat Kim to the top. I expect this will work out well, as she’s going to come up here and hang out a bit before following me down.

    I know you are wondering what my music was, so here’s the playlist I used from a number of years ago (it’s generated by my Personal DJ program):

    • My World – Avril Lavigne
    • Any Way You Want It – Journey
    • Be My Girl – The Police
    • Holiday – Scorpions
    • Silicon World – Eiffel 65
    • Roll the Bones – Rush
    • Time  – Pink Floyd
    • Sister – Creed
    • When I Come Around – Green Day
    • You Give Me All I Need – Scorpions
    • Analog Kid – Rush
    • Bastille Day – Rush
    • Crystal Baller – Third Eye Blind
    • A Praise Chorus – Jimmy Eat World
    • Tie Your Mother Down – Queen
    • I’ll Be Over You – Toto
    • Doug’s First Job – Uncle Bonsai
    • Out of the Vein – Third Eye Blind
    • Stranger in Town – Toto
    • God of Whine – Third Eye Blind
    • Questioned Apocalypse – One Fell Swoop
    • Always Somewhere – Scorpions
    • Wake Me Up When This Climb Ends – Green Day
    • Warning – Green Day
    • Summer Song – Joe Satriani
    • Cult of Personality – Living Colour
    • Sing Child – Heart
    • Suite Madame Blue – Styx
    • Trees – Tripod
    • It’s Easy (taking it pitch by pitch) – Boston
    • Going To California – Led Zeppelin

      After a bit of sitting and resting, I pick all the cashews out of the mixed nuts I brought, eat three brazil nuts, and head out for the rest of the ride.

      Descent and runout…

      43.8 miles, 5331’ down, 725’ up.

      It starts with about 11 miles of 4% grade and then gets flatter as the section goes on.

      As previously noted, several body parts are painful, but the first part of the descent is what I expect it to be; fast parts with some tight technical turns where I show that I am not the fastest descender in the peleton. As I turn off the top part, Kim passes me going up.

      The descent is just what I thought it would be, and would be fun to ride.

      Except. For. The. Headwind.

      One of the truisms of RAMROD is that the ride back to Enumclaw is always windy. I don’t know if that’s a truism here, but it’s certainly true today. It ranges from a few MPH when I’m in the forest to gusty sections that remind me of the time I rode part of the Kona Ironman course on the Big Island. On an average, it’s cutting off 5-10 MPH from my speed, which is just pissing me off. All the effort to climb up and then I get ripped off going down. When I finally get back outside the park, I text Kim so she has a time check for when I hit a certain part of the course.

      I have Elbe on my mind. On the north side of the road at the west end of town, there’s a gas station with attached store, and there’s an ice cold Coke Zero in one of their coolers, calling my name.

      The wind is doing nothing to improve my mood or reduce the pain in my body, but I can still ride and my power levels aren’t horrible. As a ride leader, I spend a lot of time out in the wind, but this one is nasty and relentless. I pass Ashland and it gets better for a couple minutes, but then comes back with a vengeance. 104 miles is my target, and I slowly watch the miles count up. At 100 miles my GPS loses the decimal point and time slows down.

      I finally get to Elbe, where I get the aforementioned Coke Zero and read the advertisements on the community bulletin board. Good price for tree grinding. I text Kim again, and then head inside to get an ice cream bar. I want something simple, but I end up with a Heath bar crunch. I haven’t eating an ice cream bar in a *long* time. It is sickeningly sweet and not very appealing, but I was raised to eat the food I took, so I finish it and feel a bit queasy.

      I’m getting ready to head out for the the last 12 miles, but I receive word that the organizers have decided to neutralize the remainder of the route, so I instead wait for my team car to show up, and we head to Eatonville to have a nice lunch at the Cottage Bakery and Cafe.

      Thoughts and other stuff

      That was a really hard ride, though if my knees/butt/feet were better, the section to Eatonville would have been simple as it was only another 12 miles.

      I tend to do my long rides solo, but at this distance companionship would have been welcome, though my climbing pace might have been problematic. Omitting the ride from Eatonville back to Enumclaw was a good decision, given my current fitness level. It was fun, for “long ride in the mountains” levels of “fun”.

      Stats:

      Distance: 103.36 miles
      Riding Time: 8:02:11
      Elapsed Time: 8:30:50
      Speed 12.9 MPH
      Power 146W
      Calories 4217
      Whines 3845

      My food for that day was three servings of SuperStarch before the ride, a handful of trail mix, half a package of jerky, 15 cashews, and about 50 cheez-its.

      Stava here, RideWithGPS route here.





        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.



        Fixing Bally/Williams Opto troughs

        I had a problem with my WCS serving multiple balls, and I thought I’d share the approach I used to fix it.

        I had looked at the switch tests, but the problem was somewhat intermittent so that didn’t really help.

        I pulled the whole trough unit out; that took:

        • Two screws from the bottom
        • Removing the bottom playfield cover below the flippers
        • Removing 5 (?) screws from the top

        That loosens the trough. I then took out the 4 screws that hold the solenoid to the trough, unplugged the connectors, and it was out.

        Test the LEDs

        I started by testing the LEDs. Through trial and error, I found that a 1K ohm resistor and a 5V supply resulted in a current of about 4mA, and since that’s within the spec for most LEDs, I stuck with that. Hook one end of the supply to the common and the other to the individual LED pins, and verify that they all light up.

        They’re infrared LEDs, so you can’t see them, but pretty much any digital sensor can; a camera, your phone, etc. It’s simpler to remove the board from the trough before you do this.

        All the LEDs on my board checked out.

        Test the phototransistors

        Keep your setup to turn on the LEDs as we’ll need it for this step.

        Using a ohmmeter, connect one end to the common and then connect the other end to the pin for the LED that you currently have on. You should see about 4K ohm when the LED is on and something around 1M ohm when your hand is blocking the light. If you don’t see any difference, swap the leads from the ohmmeter around. You may have to turn the lights out to get 1M on some of the phototransistors as you can get room light reflecting into them.

        Work your way down through each LED and phototransistor and verify that you are getting the right settings. If you find one that isn’t reading correctly, or consistently, it is *most likely* a connection issue.

        I would start by verifying the connections; with one lead connected to the common pin, verify that you have continuity to all of the phototransistors; one of the pins on every one should be zero ohms (or close to it) and connected to the common.

        Then repeat that from each of the LED pins on the connector to the non-common phototransistor pin. You should see zero ohms on each of those as well.

        My issue turned out to be a rework issue; the #6 phototransistor was replaced by somebody and they either messed up the through-hole or didn’t resolder it correctly, so it was only making contact on the LED side of the board sporadically. Rather than pull the board off and try to resolder the phototransistor, I added a small jumper wire from the pin to the phototransistor.

        Everything tested fine, and no more double balls.


        Pogo pins + laser cutter = test fixture

        I sell a small WS2811 expander board on Tindie:

        WS2811 / WS2812 Extender 1

        It’s not a particularly complex board, but it still needs to be tested, and at minimum that test requires 9 connections to the board. For the prototypes I just soldered wires on, but for the ones I sell that would not be a good idea, and it would also be a fair bit of extra work.

        I decided to build a pogo-pin test jig, and since the approach I came up with was different than the other approaches I’ve seen I thought it would be worth sharing. I’m going to be targeting my laser cutter for fabrication, though I could have chosen to use my 3D printer instead.

        Pin design and layout

        I’m going to be using Kicad for my examples here; if you use something different, you’ll need to figure out how to do some operations ourselves.

        Here’s the starting design:

        image

        For testing, I need to provide connections to a subset of the all of the headers. I’m going to do the design for all of the headers and then just populate the ones that I need. For many boards, you would have test pads that are unpopulated as the targets for your testing.

        I need a way to get this into a format I can use with my laser cutter, and SVG is the one I’d like. Kicad can export to SVG just fine; you use the Gerber export and choose “SVG” as the format (no, it doesn’t really make a lot of sense). I’ll be using the pins to connect to the copper, so I’m going after the copper layer.

        Once it’s exported, I can open it up in Inkscape for editing:

        image

        I’m going to clean this up to get rid of all the parts that I don’t need. In some cases, the components are grouped and I need to ungroup them.

        image

        What I want to do is put a pogo pin at the middle of each of these. These are the pogo pins that I’m using:

        image

        They are spec’d to have 1mm shafts and they’re quite close to that, so we’ll plan our design using that.

        At this point, we need to account for one of the things that Inkscape does. The UI allows you to set the size of a circle, but the size that you set is the outer side of the circle, and that includes the stroke width. If your stroke width is 0.25mm and you set the circle to 1mm, the actual circle will only be 0.5mm.

        This confused me for a while when I did my first prototype. And then it confused me again when I did this version. The fix is to set the stroke width to 0 – or something very close to 0 – and use a filled circle instead.

        Here’s a picture of a pad and a 1mm red circle I want to center inside of it:

        image

        I need to get that red circle centered inside the pad. Because of the way Inkscape works, you need to start with the small circle on the lower left. I don’t know why. Then do the following operations:

        • Drag select both objects.
        • Choose “align top”
        • Choose “align right”
        • That should move only the red circle.
        • Align center on the horizontal axis
        • Align center on the vertical axis.

        To select the circles I need to drag a region; it doesn’t work trying to select the object. I don’t know why.

        That gives us the following:

        image

        Eventually, I will want one of those for every pin. But I need to do some test sizing first.

        The beam on a laser cutter is pretty thin, but it still has some width. That means if I cut out a 1.0mm circle, I’ll get one that is just a bit bigger than that, and the pins will be loose.

        I’m going to use the row of 6 pads at the top for test sizing.

        image

        You can’t tell from the picture, but these are sized 1.0 mm, 0.975 mm, 0.950 mm, 0.925 mm, 0.900 mm, and 0.875 mm.

        Off to the laser cutter!

        IMG_9553

        The test fixture cut out of 0.1” (2.6mm) maple plywood.

        The 0.875mm hole is the only one that is close; it’s a tiny bit snug in the middle (the laser beam is shaped like a very tall “X”, so the hole is thinnest at the focus point in the middle and a little bigger at the top and bottom).

        Based on the step in sizing between holes, I’m going to size them all to 0.85 mm.

        image

        That’s the completed design. In my laser cutter (a GlowForge), it groups the elements by color, so it’s easy for me to tell it to cut the red circles and not the black pads. If you want to simplify the cutting part, you might want to delete the pads.

        Back to the cutter.

        IMG_9554

        I cut 3 identical plates plus a spacer. The stack will have two plates with holes, then the spacer level where the wires will be soldered to the pins and finally a plate at back. The wires will all come out through the spacer holes on the left. It’s hard to tell from the picture, but the pins are inserted so that they stick out the back enough for the bottom of the pin to be flush when the spacer and bottom plate are added.

        Oh, and that lower-left piece is upside down…

        Next is hooking up the test wires. There are 22 pin holes, but two of them need only to be bridged and seven connected with wires for testing.

        IMG_9560

        That’s a rather poor picture of the wires attached to the pogo pins. After they are all soldered on, the back piece goes on and then I taped it together with blue tape so the pieces are apart.

        That would normally be the last step, but the high-current pins on this board are set up using 3.96mm headers instead of the 2.54mm that my pogo pins are designed for, so those pins just go right through the bulbs. With a little bit of play using a soldering iron, you can get a blob of solder on each of those pins and then it will work fine.

        Here’s the completed tester with a board just sitting on it.

        IMG_9562

        The yellow and green wires come from an ESP8266 that I use to drive it, the red and black are 12V power from a repurposed XBox 360 power supply, and then the white wires are the grounds for the loads (the board provides both positive and ground for each LED, but I only need the grounds to do the testing).

        I made a quick video showing the tester in action.


        MVI_0093 from Eric Gunnerson on Vimeo.


        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.


        Observational Studies and causation

        There’s a problem with observational studies.

        Let’s say you tell people to do something – eat less red meat, for example – you are hoping to change their behavior. You end up with some people who totally avoid red meat, some people who reduce the amount of red meat they eat, and some people who just ignore you.

        Then you come back 10 or 20 years later and do an observational study and look at how much red meat people eat and how healthy they are, and – lo and behold – you find out that those people who eat less red meat are healthier.

        So, you publish your study and a bunch of other people publish their studies.

        Unfortunately, there’s a problem; the act of telling people what to do is messing with your results. The people who listened to your advice to give up red meat are fundamentally more interested in their health than those that didn’t listen in a myriad of ways. Those differences are known as “confounders”, and studies use statistical techniques to reduce the impact of confounders on the results, but they can never get rid of all the confounders. Which leaves us with a problem: we don’t know big the residual confounders are in comparison with any real effect we might be seeing.

        Residual confounding is why those studies can never show causality; if you look at the studies themselves, they will say there is an association with red meat consumption and increased mortality.

        But in the press releases from the research groups or universities, causality is often assumed.



        7 Hills of Kirkland Metric Century 2019

        Normally, I start a ride report with a description of the ride, how much I like it, etcetera, etcetera, etcetera.

        In this case, I’ve done 7 hills so often that it hardly seems worth the effort. If you want that information, there are plenty of examples here

        I *will* note that this is the 12th time that I’ve done 7 hills, if you ignore the fact that I skipped a year or two when it was wet.

        My typical approach for a ride like 7 hills is what I can the “make sure I finish” approach; start slowly and ride conservatively, and you can be confident that you are going to make it back for your serving of finish line strawberry shortcake, delta any mechanical issues with the bike or the rider.

        This year I said, “the hell with that!”

        I’ve been playing around with my training this year; I’ve been riding more hills earlier in the season than I have in the past and I’ve been feeling pretty good both aerobically and on climbs. So, the plan is to push a lot harder than I have in the past and see what happens.

        That should provide more opportunity for humor and perhaps some pathos as well.

        My big preparation for the ride was doing a one-hour recovery ride two days earlier that turned into a 25 minute recovery ride when it started 5% chance of precipationing on me and I headed for home.

        Woke up at 5:30 due to my old dude internal clock, got my stuff together, and had a couple servings of SuperStarch. I’m put BioSteel hydration mix in my water bottle (no need for 2 on this ride), and headed for Kirkland about 6:50.

        You may ask yourself why I drive to this ride when the route passes within about 3 miles of my house. I’ve ridden to the route and done the ride that way, riding the last few miles at the start of my day and skipping it later. I found it messed with my aesthetic appreciation of the route, so now I drive.

        Parked on the waterfront, got out the bike, stuffed my pockets with stuff, and headed to the start. Joyously absent was any thought at all about what I would wear; it was already about 60 degrees and was forecast to get into the low 70s, so no arm warmers, no leg warmers, no jacket, no hat; just the usual minimal stuff.

        Market street is the first hill; I climbed it in a little over 4 minutes at 211 watts. It’s just a warmup, as is hill 2, Juanita drive. Hit the light, turned down Holmes point, headed towards Seminary hill.

        Seminary is one of the two hardest hills; Winery is steeper but gives you chances to rest, while Seminary is more of a constant annoyance. I rode easy on the first little blip, and then rode hard. The top came 8:42 later, more than a minute faster than last year’s effort and 16 seconds slower than my PR from 2016. But… averaging a fairly significant 270 watts for that time, which is pretty decent for me.

        The usual descent and trip over to Norway hill, a nice 426’ hill that I’ve ridden up a lot and I backed off a little at climbed at 234 watts, which was pretty much my target.

        Which brings us to Winery. I like to have some rabbits to chase up winery so I was okay when I got passed on the flat part before the climb, I was less okay when the blocked the whole lane on the little bump over the railroad track. I got around them and took off up the steepest first pitch, riding at about 420 watts. It’s a short pitch and I kept that power over it, and then slowed down to recover for the upcoming pitches. 5:26 later I was turning off at the top of the climb and listening to bagpipe music, a heartbreaking 4 seconds from my PR. I’m going to call this one a “virtual PR” because I lost more than that getting by the group at the bottom. 287 watts average was a great effort, but when I went back and looked at last year’s data, I did it in 5:22 but only averaged 250 watts. Not sure what is going on there, though I am in need of some drivetrain maintenance, and it would be good to do that on the bike as well. 

        We then headed east and climbed a few more hills, then we came to Novelty Hill.

        It would be fair to say that it’s not my favorite part of the ride; too much traffic and not really a very fun hill. This is compounded by the use of the lower part of the climb as an “out and back” route; as you are climbing up the hill there are riders who are ahead of you descending back down at a high rate of speed, not really the most motivating thing to see. Strava somewhat strangely didn’t match the whole climb for me, but I got PRs on various sections so I’m going to call a PR on that section.

        After some flat roads, you end up coming back back over to Novelty for the descent, completing the circle of life. We learned about the circle of life from Disney’s “The Lion King” during the scene where Simba and Nala protected themselves from roving hyenas by building a impregnable perimeter from family-sized boxes of cereal.

        Anyway, a couple climbs after that I hit the last rest stop and after a thoroughly pedestrian sandwich (turkey/cheese/green pepper slices on pita bread), headed out for the last climb. My intention was to spin up old redmond road at take it easy, but there was a guy right in front of me so I ended up pushing a bit and coming within my PR by about 10%. Then a couple of fun descents and a mostly-flat trip back to the starting line in which I missed every single traffic light.

        Overall, a pretty good effort; I felt strong the whole day which has been an issue for me this spring; I’m not sure if it was the BioSteel or the SuperStarch or my smoked almonds or maybe that small oatmeal gluten free cookie I ate at the first food stop (it was *not* the cookie; that was a mistake).

        I was about 15 minutes faster than 2018, averaging 14.7 mph rather than last year’s 14.1, finishing in 4:04:28 and burning 2538 calories for the effort.




        Minicamp May 2019

        My wife and I have done a few cycling vacations. The ones we’ve done don’t feature particularly long days – maybe 50 miles over the whole day – but they do involve riding for a bunch of days in a row. I’ve noticed that doing something like that helps my fitness; I just feel better overall.

        And therefore I decided to conduct an experiment; I would ride 5 days in a row and see what happened. I wanted every ride to be at least 3 hours, but I wasn’t going for century lengths. And I would ride however I felt like that day.

        I expected that I’d start out feeling okay and gradually get more tired as the days went by.

        Day 1 was a big hills day; I rode a few of the Issaquah Alps. My speed on the first 3 (Squak, Talus, Zoo) was a conservative speed, but after Zoo I took a trip up Pinnacles and decided that I wasn’t up for Belvedeere, much less the trip up The Widowmaker. I crawled up the back side of Summit and headed for home.

        Day 2 was supposed to be a ride all the way around Lake Washington, but after doing the south end I opted to take the 520 bridge back across for home. Felt okay but not great.

        Day 3 was an evening ride that I lead. I chose the route to be a little hilly but not too hilly. On the ride down to the starting point, that seemed like a really good decision as my legs were hurting, but despite the hurting, they seemed to perform okay when I needed them. I have a 275’ hill on the way home from the ride with a couple of short 13-15% kickers, and those were not fun *at all*.

        Day 4 was a ride in the country, specifically a ride out to Fall City. The intent was for it to be moderately hilly. My legs were tired from the night and I wanted to let the day warm up a bit, so I delayed my start until 11 AM. Legs were pretty sore but warmed up quickly. I had planned to ride up Sahalee (0.9 miles, 404’ of up) but that can be a long slog of a climb, so instead, I decided to head up “The Gate” (0.2 miles, 158’). That’s an average of 15%, with a top gradient of perhaps 21%. I didn’t have a lot of pop on it, but I rode up it okay with just a wee bit of paperboying. Worked my way east, the south, rode down Duthie, and then out to Fall City. Where I stopped at the grocer for a Coke Zero. My plan was to take Fall City –> Issaquah back, and take it I did, via the back way. Despite being on the 4th day and 25 miles into the ride, I was able to climb at about 250 watts pretty easy. Hit the top, finished my Coke Zero, did the bonus, and then worked my way to Issaquah and then back home.

        Day 5 was the second evening ride for the week. I played with intensity as I spun through Marymoor, and my legs seemed fatigued but okay. The first climb was short but not a lot of fun. And then we hit Sahalee… I started slow, hit the steep spot, and found that my legs felt pretty good, so I rode the rest of ride at a bit more than 300 watts, averaging 280 for the whole climb. That put me close to my PR on the climb, which was a surprise. I did a sprint up a little steep hill on the route and managed somewhere in the mid 900 watts, though my legs *really really really* hurt at the top. I did notice that my aerobic recovery was pretty quick. After playing down the plateau we descended to East Lake Sam and pacelined back and I managed to “win” the fake sprint at the end by pulling out about 30 seconds from the end. My legs felt good, and the climb up to my house was considerably easier than on Tuesday.

        Day 6 was designed just to warm up my legs and help them to recover a bit, so a 3.8 mile ride that took less than 20 minutes.



















































        Day Distance Elevation Speed KJ
        1 33.9 4177 10.9 1682
        2 39.6 1575 14.3 1486
        3 35.4 1788 14.5 1345
        4 41.0 2470 13.6 1587
        5 35.1 1903 14.3 1372
        6 3.8 180 12.7 119
        Total 188.8 12093 7591


        The true test is going to be what my form is like after recovering for a few days, but early indications are that the minicamp did what I was hoping; I felt stronger in places where I hoped to feel stronger and my recovery seemed pretty good. I was mostly able to sleep quite well, and – somewhat surprisingly – my hunger didn’t seem to increase that much.


        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.


        Pages:1234567...31