Hills of the Eastside – Education Hill

by ericgu 1. April 2014 07:15

Five or seven years ago, I started riding with the Eastside tours group. We ride Tuesday and Thursday nights all over the east side, and we climb a lot of hills. A couple of years ago, I was lucky enough to inherit the leadership of the group from Per Sunde.

I’ve learned a lot about the hills on the east side during this time. In my spare time, I run a website – BicycleClimbs.com – that show the different ways up those hills.

I’ve decided to share that information through a series of posts that talk about a hill and the different ways that you can climb it. If you want to know the easiest way up, I’ll show you that, and I’ll also show you the harder ways. I’ve ridden up pretty much all of the routes I’ll show; if I haven’t I’ll let you know.

Since I’m hoping it will be educational, I’m starting with Education Hill north of Redmond.

Education Hill

Education hill is the hill directly north of Redmond. It is named because of the number of schools that it contains.

Easier ways up

  • The easy traditional way up the hill is from the west [A], starting near 60 acres. This climb starts with a very steep (15% or so) section right at the beginning (okay, so it’s not that easy), and then is a mostly easy climb except for the last little pitch near the top. This climb is featured on the 7 hills metric century ride.
  • There’s a nicer option [B] that starts at 124th and avoids the steep climb at the beginning. It tends to have a bit less traffic, but the road has a few deep grooves in it, so pay attention.
  • From the east, NE 116th St [D] is the easiest way up, and is also featured on the 7 hills metric century. It has a couple of steep sections but isn’t too bad.

That’s it for the easy ways up. The other options are harder.

  • If you head east on 124th, you can turn tight and climb up 162nd Pl SE [C]. This is a steep climb, peaking at around 15%, but is pretty good from a traffic standpoint.
  • From the east, there are two harder ways up. The first is 104th [E], which is really steep – a sustained pitch in the 15% range, and it has a lot of traffic. It does feature a bike lane, but I don’t think you are going to enjoy it, and I don’t recommend it. Just to the south off of Avondale, there is the Hidden Ridge Trail [F]that cuts into the neighborhoods to a nicer climb. Still quite steep, but with less traffic and a bit more rolling; this is a much nicer way to the top.
  • From the south there are a few options. The westernmost one  is 166th Ave NE [G]. This is a two lane road without any shoulder, so I wouldn’t recommend it unless it’s a really quiet time from a traffic sense. A bit two the east, there are three options. 171st [I] and 172nd [J] Aves NE both start with a steep pitch on NE 80th, and then both turn north and run parallel to each other. I think 172nd is a bit easier, though ask me tomorrow and my answer may change. 171st has a bike lane, while 172nd doesn’t, but 172nd has less traffic. Both peak at perhaps 11%.

    A climb through a new development just to the west of these, 169th [H] offers a route that gets steep and flattens repeatedly. The maximum gradient is around 14%.

Descending

The easy ways down work fine when descending east or west. I do not recommend descending 104th to the east; it’s super-steep, it ends at a stoplight, and there is sometimes a bit of grit on the road. Either take the hidden ridge trail, or head down 116th. Heading to the south, 166th is a nice way down; just beware the stoplight right at the bottom of the hill.

Tags:

Bicycle | Hills of the Eastside

A better way to treat that cough…

by ericgu 27. March 2014 07:07

About a week ago, I had a problem. My wife and I were getting ready to leave on a week-long ski trip to Colorado, and I had a cough. Not one of those light coughs, the kind of cough that becomes that is more of a career than a distraction, the one where you cough for 15 minutes straight.

It was, not surprisingly, making it hard for me to sleep. One night, while sitting up on the couch in the basement, waiting for it to stop, I decided to do a little bit of research. Just like anybody would do, I pulled out my laptop, fired up Chrome, and did a search for methods of cough treatment.

Okay, that’s not true; first I searched for cough and came up with an impressive list of deadly diseases that I had a minute chance of having. Then I did a search for cough treatments, and, after a bit of digging, ran across the following paper.

Diagnosis and Management of Cough
Executive Summary
ACCP Evidence-Based Clinical Practice Guidelines

The ACCP is, of course, the American College of Chest Physicians. Amazingly, the paper is free (most journal articles are not), so I pulled it up and started reading. It’s heavy going if you are a medical amateur, but basically, they did a huge study of the available evidence relating to cough and came up with expert recommendations. After a bit of reading, I came to the section on the common cold (section 11 if you want the details). It has two interesting findings:

  1. Patients with acute cough (as well and PND and throat clearing) associated with the common cold can be treated with a first-generation A/D preparation (brompheniramine and sustained-release pseudoephedrine). Naproxen can also be administered to help decrease cough in this setting. Level of evidence, fair; benefit, substantial; grade of recommendation, A
  2. In patients with the common cold, newer generation antihistamines are ineffective for reducing cough and should not be used. Level of evidence, fair; benefit, none; grade of recommendation, D

Pseudoephedrine was most commonly available as Sudafed, which was great stuff until it started getting used for meth production and got moved behind the counter (at least in Washington; in some states it’s by prescription only). Naproxen is available over the counter as Aleve. Note that dextromethorphan, the most common cough-suppressant in OTC cough medicines, is not recommended in this situation (it does show up elsewhere, as does codeine).

So, on the way to the airport, we hit a pharmacy, and I picked up some 12-hour Sudafed and Aleve, and, when we got to our first night, took both.

It made a huge difference; I had no big cough attacks that night. I did note, however, that the aleve made me feel spacey and I didn’t sleep well, so I dropped that in later nights.

Note that Sudafed makes an OTC series called “Sudafed PE”, where the PE stands for “Phenylephrine”, not “Pseudoephedrine”. You want the real stuff.

Tags:

Ski instructor secrets

by ericgu 17. March 2014 02:22

It’s the question that nobody asks.

They find out that you are a ski instructor, and they ask you where you teach, how long you’ve been teaching, but you can can see it in their eyes, that one question that they want to ask…

They’ve heard the stories – surely they must be exaggerated, but just as surely, there must be something behind them – and they want to know more, but they don’t ask. Maybe they think that you would consider it too personal to talk about. Maybe they think that a secret agreement prohibits sharing the detail with them. Maybe – and this would be the worst – maybe they are afraid that you would tell them that none of the stories are true, and that would shatter the picture they had built up in their mind.

The time has come to share the details – or, to be more precise – to do what is in my power to provide some confirmation of the rumors. I regret that, under PSIA policy, I cannot discuss certain matter, but I can provide an answer to one question:

As a ski instructor, do you get to teach a lot of cute single babes?

The answer is yes. I can confirm that, as a ski instructor, you do get to work with a lot of single babes. I can also confirm that the majority of them think you are great, and that the phrase, “babes dripping off of him”, is, at least sometimes, true.  And they are cute, some of them heart-meltingly so. It should come as no surprise if I were to tell you that working with them is one of the best part of the jobs.

Unfortunately – or perhaps fortunately, given my relationship status – the vast majority of them are 6 years old.

Tags:

Tricks you can play on yourself #23 - ski edition

by ericgu 19. February 2014 08:10

The school that I teach for has a Freeride team – they ski all over the mountain (including cliffs for some of them). The last lesson day of the season they have an informal competition, and, for the second year, I volunteered to take pictures of them. This lets me keep my sports photography skills up, and lets me work with a great group of kids. Oh, and it excuses me from helping out from helping out with the other “last day” activities, though I still found time to reprise my role of “Mr. Catsup” in the hot dog line.

The chosen location for the competition was 7th heaven, a double-black diamond section at the top of Stevens pass.

I am a decent off-piste (“ungroomed” for the non-skiers and/or less pretentious among you) skier. By “decent”, I mean that I can get down most slopes that don’t involve the words “drop” or “cliff”, and that I ski them with occasional flashes of competence. It’s a little harder to ski with a 5lb camera (Canon 7D + 70-200mm F2.8L 2.8 IS II lens) on my chest, but it’s not too bad.

After a warm up with the team on Big Chief (where there was some surprisingly nice powder (and no, I just can’t call it “Kehr’s Chair”…)), we headed over to Skyline, and then up the 7th Heaven Lift (yes, it is as steep as it looks), which is 4 years older than I am but luckily, far less cranky. The original plan was to head over to the side of Rock Garden (a bumped but not super-steep run), but there was a fair amount of skier traffic, so we headed down Cloud 9 and hooked back towards Meadows above the Skyline run, to a steeper and less bumpy run.

There was some very nice snow; the kids skied down to get the feel of the run, and I skied down to set up above a small clump of trees.

Shooting on a steep slope – this one looked to be around 45 degrees – takes a bit of preparation. Actually, just taking off your skis takes a bit of preparation, lest you sink in and slide down the hill, and I spend 5 minutes carefully down the snow to try to get a 12” wide platform I can stand on. Then, I take my skis of – carefully - and stuff one at each end of the ledge so people can see me, and then enlarge my ledge with my boots. I get the camera out, get it set up, get my shooting gloves on…

And then I wait. and wait some more. The kids need to ski down to the bottom, and then cycle up two lifts, then work their way back around to this slope. The time that it takes is directly proportional to how cold it is, and since it’s pretty darn cold, foggy, and lightly snowing, it takes a long time. Eventually they come back, and the shoot goes well; I shoot for 20 seconds, wait for the kid to ski the bottom half and be scored, and then shoot the next kid. I think I’m doing pretty well but I can’t really tell; the eyepiece has some snow in it and there is a lot of frozen snow on the camera and lens. My hands are pretty frozen even with gloves on them.  (editors note – they came out quite nice. See gallery here).

I finish shooting, check signals with the two coaches, and get ready to leave. The camera goes back on the chest carrier, coat closed, and gloves on. I pull my goggles down and find that they are totally ice-covered, but a minute of scraping with my fingernails fixes them up. Skis on, and I’m almost ready to ski out – after I demolish the ledge that I built, so that nobody gets tripped up by it. I climb up until I’m on top of it, scrape snow down into the ledge, and then compact it a bit.

To ski out requires a small traverse, then a short tight-ish section until the slope open ups. I start to slide forward to get into position, sideslip a bit, and am surprised to find that I have fallen over backwards. Falling down is not a great idea on this sort of slope, and it’s especially bad to fall over backwards.  I get up, slide forward again, make one turn, and at the bottom of the turn I lose balance and fall over backwards again. This freaks me out a tiny bit, which always inspires me to ski better. Ha ha – of course it doesn’t – it actually makes me much more tentative.

I think I know what is going on, but to fix it I will have to pull my skis off, and since I’m in the middle of a tight section without great visibility from above, it’s really not a great idea to stop. I muddle my way through one turn, do a huge (and unstable) traverse, and then stop and pull of my skis.

I find what I expected. The bases of my skis were facing uphill, and they got the same coat of ice on them that my goggles did – but the ice was only on the front of the skis because the back half was stuck in the snow. The meant that whenever I went to push them sideways, the front would stick and the back would slide downhill.  I scrape them off with a plastic piece on my gloves, and finish the slope.

So – Important Safety Tip – it’s not a great idea to leave your ski bases exposed when you stick them into the snow.

Tags:

ski | photography

Eric’s Cycling Summary 2013

by ericgu 2. January 2014 05:40

As many of you know, it is difficult – some would say impossible – for me to say briefly what can be said at length. This will not be an exception.

After a casual year of cycling with no real goals in 2012, I decided to shake things up a bit for 2013. I started by looking at my constraints:

  • I ski most weekends from December through March, and therefore have little weekend time to train on my bike.
  • During the winter, the Tuesday/Thursday rides I lead (“Eastside Tours”) are often constrained by weather, so we only go on about half of the rides.
  • Cycling is not the only thing I want to spend time on; the evening rides plus a ride of reasonable length (less than 4 hours unless it’s an event) on one day of the weekend is the amount of time I’m willing to devote.

I then looked at my goals:

  • Have more fun
  • Do some different events
  • Finish RAMROD without hating it

It was clear that to reach my goals, I needed to be more efficient in my training, so I bought a copy of Carmichael’s “Time-Crunched Cyclist”, and dug in. I started with the “Experienced Century Rider” program, and then adapted it to my schedule. Fitting into the constraints of a group ride was a bit challenging at times; I needed to pick routes that worked for the group and then fit the assigned workout into it, so sometimes I would do 3 intervals on one hill, 3 intervals on the next, and then the final 2 on a third hill. I put all-out intervals on the weekends because they didn’t really fit in. All of the workouts were based on power, and the specific power levels were based on a field test I did. This was my first experience training using power, and being able to quantify the expected effort level makes things so much easier and more effective.

The training was quite successful; I ended up being leg constrained (ie my legs hurt from the lactic acid) on my climbs rather than being aerobically constrained, and that was a very nice outcome.

RAMROD was pretty good; I was much faster up Paradise than previously, but Cayuse turned into the usual suffer-fest, with me stopping multiple times. I think that the problems I had on Cayuse are related to me not eating enough; my later performances where I ate more were much better. So, chow down seems to be the order of the day.

Our California trip was very nice; I had great energy pretty much the whole time, and managed to do two mountain climbs (Figueroa and Diablo) at a high consistent power output and feeling reasonably good while doing it (I lucked out and had great weather on Diablo, but Figueroa was hot hot and that reduced my speed and increased my pain a bit).

And finally, I felt strong all the way through the Passport 2 Pain, staying ahead of the usually-faster riders from my group. I’m a little worried about attempting it a second time, as a look comparing my RAMROD performance to my P2P performance would make you think it was two different riders, and P2P may have just been one of those days when you have great legs.

In summary, a pretty good year.

Statistics

2013 2012
Rides 106 90
Distance (Miles) 3000 miles 2356 miles
Total time 210:39:10 162:54:52
Average speed 14.2 MPH 14.46 MPH
Total Elevation 215,052 feet 150,804
Longest ride 149 miles 107
Feet/mile 72 64

A 40% increase in elevation this year; some of that comes from about 25% more miles, but the remainder comes from a 12% increase in the number of feet climbed per mile, which is a pretty significant increase. The decrease in average pace is because of that; I have actually be faster on the flats this year than in the past but have been trying to stay within our 17 MPH goal pace for the Eastside Tours rides.

Tags:

Bicycle

Microcontroller RGB LED Animation Software

by ericgu 30. December 2013 02:43

I’m building a project using non-addressable RGB strip, where all of the LEDs in the strip are connected in parallel and are therefore the same color. I thought it might be a bit useful to talk about the techniques that I’m using in the software, and some of the options & tradeoffs that exist.

The hardware and code are from the Arduino world, but they apply equally well in other ecosystems.

Hardware choices

The LED strip is composed of RGB LEDs, which are in turn made up of separate Red, Green, and Blue LEDs. Simplistically, I can get 8 colors out of the combinations of these colors:

  1. Red
  2. Green
  3. Blue
  4. Yellow (Red + Green)
  5. Purple (Red + Blue)
  6. Cyan (Blue + Green)
  7. White (Red + Green + Blue)
  8. Black

To get more colors, I need to be able to do something more than just turn a color on or off – I need to control the intensity of each color independently. While it is possible to control LED brightness directly by controlling the current through it, that is fairly complicated, so in most cases we take a shortcut. If we want half the light output, we flash the LED so that it is only on for 50% of the time. This would seem to produce a flashing LED, but because of the way our vision works, if the flashing is quick enough, we see not a flashing LED but a dim one. This technique is known as “Pulse Width Modulation”, or PWM. Doing it 60 times per second (ie 60 Hertz, or Hz) is a minimum bar, but I like to shoot for 100Hz. A lot of cheap holiday LED lights flicker at 60 Hz and if you move you head you can see it.

The number of colors we can get depends on how many levels of intensity we support. 64 levels gives us 64 * 64 * 64 = 262144 different colors, while 256 levels gives us about 16 million. We want enough to give us smooth fades between colors, and I think 64 levels is probably significant.

PWM is also used for controlling the speed of some motors and for driving servos.

PWM Implementation

PWM is such a useful technique that it is implemented in hardware on many microcontrollers. Using the hardware PWM has a lot of advantages:

  1. You don’t have to write/debug/maintain the PWM implementation.
  2. You don’t have to deal with interrupt-driven code, which is more complex and a bit mind-bending at first.
  3. The hardware PWM does not consume any execution resources, so your software has 100% of the microcontroller to use.
  4. It’s very simple

So, hardware PWM is great. However, it has some disadvantages, the biggest being a limited number of PWM channels per microcontroller. The Atmel ATMega386 in the Arduino supports 6 individual channels. I’m using a Trinket, which is built around the ATTiny85 microcontroller, and therefore supports only 3 channels. Hardware PWM is also limited to a specific number of discrete levels. If you need a lot of outputs and/or more discrete levels, there are boards that you can connect to your microcontroller that can do more channels at with more levels, such as this 16-channel one.

If the hardware PWM support is not enough, PWM can be implemented in software. We configure the microcontroller to call a bit of code at a specified interval, and in that code, we decide whether the output should be on or off.

This gives us a bunch of flexibility; we can, at least in theory, do PWM on every single output on a microcontroller. However, the code that is running is taking up system resources, and at some point we won’t have any resources to do any other work.

Animation storage

There are two ways of storing animation; we can express them in procedural code such as:

DoFade(redTarget, blueTarget, greenTarget, fadeTime)

and then create a program that has one DoFade() for each animation. Or, we can do a table-driven approach, where we express what we want in a table:

Red Target Blue Target Green Target Fade Time
255 0 0 15
255 255 255 45
etc.      

And then write a very simple program to loop through the entries in the table sequentially.

The table-driven approach has simplicity going for it, and works well in most cases. It doesn’t work well in cases where there are repeated patterns; if we wanted to fade from red to green and back to red 50 times quickly, that would take 100 entries in the table, but would only require a short loop to write procedurally. There are ways to get around this by making the table more complex.

Architectural options

There are a few different architectural options. In rough order of complexity:

  1. Use hardware PWM and code in the main thread (ie “loop()” in the arduino world) to drive the animation.
  2. Use hardware PWM and a separate timer interrupt to handle the animation. The timer interrupt code is called a fixed number of times a second, and that code drives the animation.
  3. A timer interrupt to implement the PWM (software PWM) and to handle the animation.

There is also a fourth option – using a timer interrupt for PWM and splitting the animation between the timer interrupt and the main thread. I built one system that does that, but I think it ends up being more clever than necessary.

Tags:

Electronics

RGB Strips Construction

by ericgu 23. November 2013 05:45

With the electronics done on my RGB project, I moved on to the physical construction.

As a veteran of a number of these projects, I’ve learned that the electronics part is always the easy part; it’s all of the physical construction (wiring/cabling/support) that takes the time. I’ve also learned the new projects need to be quick to put up; it already takes too long for me to put up the current displays.

The LED strips that I’m using are quite flexible, so they need some support. I chose 1/2” EMT electrical conduit as my mounting method. I have 67’ to cover, so I bought 7 lengths of the tubing for about $3.50 each. The strip has an adhesive backing on it (it claims to be a 3M adhesive, but counterfeiting is rampant in China, so I’d be surprised if it is…), so it’s a simple matter of attaching the strip.

The first step is to mark a straight line along the conduit.

To do this, you need a way to hold the tubing so it won’t spin. I used a 8’ cutting guide that I have, and a sharpie to mark the edge. If you don’t have that, a baseboard in a room that has hard flooring would work just as well.

Next, slowly peel of the adhesive of the strip as you move along the tubing, and stick it down. The strip is made to be attached to a flat surface, so it won’t adhere perfectly. I used zip ties to give some extra security.

I needed a nice way to joining the pieces of conduit together. I originally just wanted to use conduit connectors, but they don’t really hold the joint very straight and they make the tubing wider, so I did some searching in my hardware store, and found some connectors for flexible pipe that worked just fine. One end is a tight fit, and I ground down the connector so the others just slide on. I'll note in passing that inside diameter of 1/2” EMT is 0.6 inches, and the outer diameter is around 0.7 inches. Here’s a picture of them.

This shows a tactical error I made; the strips can only be cut on the segments between them, so I let them run long, and made sure they overlapped correctly. It was a bit of a pain. On the second set, I got smart and trimmed the conduit to the length that I needed. Here’s what the completed sections look like:

There are connectors at both ends because I need to feed power from both ends to keep the voltage constant; they are Molex connectors that took a long time to put on; each one gets crimped and soldered.

I bought a 250’ spool of 12-gauge landscape wire, and then soldered on some more connectors. I used hot glue to insulate the connections and hold everything together.

After a lot of work, I got it done, and then surveyed the carnage:

 

and here are a couple of shots of the final result:

That intense red line is the RGB strip. Note that it’s really hard to take crisp pictures of lights, as they tend to bloom.

 

Here’s a closer picture; you can sort-of see the individual leds. At this distance – 20 feet or so – you can see the individual light sources pretty easily.

Tags:

Electronics

Trinket debugging…

by ericgu 23. November 2013 02:08

One of the nice things about debugging code on the Arduino is that you can send debugging information back out the serial port. The arduino can do this because it has a separate microcontroller to handle the USB communication duties.

The Trinket, however, does not have a separate microcontroller – the USB communication is handled by the same microcontroller your code runs on.

I needed to do some debugging, and decided to do something very old school. I wrote some code like this:

temp = valueIWantToView

digitalWrite(0, HIGH);
digitalWrite(0, LOW);

for (int I = 0; I < 8; i++)
{
    if (temp & 080)
    {
        digitalWrite(0, HIGH);
    }
    else
    {
        digitalWrite(0, LOW);
    }
    temp <<= 1;
}

I ran this on a timer interrupt, hooked up my scope to pin 0, and I could then read the bits directly off the scope.

Tags:

Electronics

Trinket RGB shield lives

by ericgu 6. November 2013 07:14

Yesterday, the PC boards for my trinket RGB shield showed up from OSH Park. Also, the solder paste stencil that I ordered from OSH Stencils showed up as well. The stencil cost $5, so I’m out $8.70 for the stencil and three boards. Here’s the stencil:

My original intention was to try different techniques of soldering. I had some decent luck with solder paste on a soldering iron with my last board, but when I started pulling out the components, I found that there was a problem.

The diode that I had chosen was in a SOD523 package, which measures 0.8mm x 1.2mm. That’s really, really tiny. Like, small. I could pick it up with the tweezers, but I didn’t see how I could solder it without moving it around, so I decided to go straight to “plan b”, which is to reflow the board. I got out the stencil that I bought, figured out how to hold it in position over the board with one hand. Here’s what it looks like:

I squeeze out some solder paste onto a piece of paper, pick it up with the “solder paste applicator” from Osh Stencil (really just a credit card blank), and carefully scrape it over the holes in the stencil to evenly fill the holes in the stencil. The results are pretty good:

One of the cool things about pc boards is the solder mask that is printed over all the parts that aren’t meant to be exposed copper. The solder paste does not stick to the solder mask, so even if the paste isn’t perfect, it will clean things up. That looks just fine.

Now, onto component placement. I started with the diode because it’s going to be the hardest. I pull one out of the strip and drop it on the paper.

That tiny little black spec at the top of the picture is the diode. To place it, I need to figure out which end is the cathode, which is typically denoted by a band across that end. I look closely, but I can’t identify the band with my reading glasses. Nor can I identify it with my reading glasses plus my flip-down magnifier. A bit of thought, and I dig out the 8X Loupe that I use to proof slides on a light table, and then I can finally identify the end of it, and place it on the board. The resistors are next; in M0805 packages that are about 1.25mm x 2mm, they are a lot easier to place than the diode. They also aren’t polarized, so the direction doesn’t matter. The three 10K resistors go on well. Finally, there are three MOSFETs to go on in either SOT23 or SO8 packages (I had to do a custom part for this one). They are a bit more finicky, but I find that if I hold the tweezers steady and rotate the board underneath, I can get them mostly aligned correctly.

The next step is to reflow the board – to heat up the solder paste so that it melts and solders the components to the board. In production situations, this is done with an expensive reflow ovens. In the hacker world, some people use toaster ovens, some people use electric skillets, and some use their hot-air reflow station. I own none of these (well, I *do* own a toaster oven, but contaminating it with lead vapor is a bad idea), but I do have a wagner heat gun out in the garage, so I pulled it out and went searching for a decent platform on which to place the board. A recently replaced license plate from my truck was a great choice; metal, nice and thin, and the embossed letters raise it off of the surface.

I clean a space on my bench, put the board on the license plate, and turn the heat gun on low. There are very specific reflow heat profiles that are used in production ovens, but the simple goal is to get the board evenly warm, and then concentrate on specific areas until the solder melts, and then cool it off quickly so you don’t fry the components. I get the board kindof warm (it might have been a good idea to grab the IR thermometer before I started), and then concentrate on one of the MOSFET & resistor sections of the board, getting the heat gun close. It reflows fairly quickly, and I move on to all the other components. They reflow quickly as well. Here are the results:

 

It’s a bit hard to see in the picture, but a bit of examination with the loupe shows that I got good reflow on all of the components, and there are no solder bridges. The next step is to test the board; I hook it up to 12V, verify that the diode is in correctly, and then apply 12V to the pads where the trinket pins will connect. Success! Everything works the way that I expected.

I cut down an arduino header set with an abrasive wheel in my dremel to get two 1x5 headers, and solder them into the holes. Here’s a picture of the shield with the Trinket:

I made the shield stackable because I need two shields to drive the two separate circuits; the diode in the power line functions both as a polarity protection device and to keep the two power supplies from fighting with each other. The header on the left end of the shield is temporary; I’m using it to plug the shield into a breadboard so that I can easily connect to the shield for testing. It is *just* possible to plug the shield into the edge of the breadboard and stack the trinket underneath it.

I hook up a 5 meter strand of LEDs, plug in the power, and it starts animating through the colors.

Tags:

Electronics

A trinket for me

by ericgu 24. October 2013 06:19

I’m redoing my holiday roof outline lights that I’ve had for a long time. The current lights are made with four commercial strands of lights – red, green, blue, and white – wrapped into a single cable. They are driven by a custom (of course) 68HC11-based controller. Most of the effects are simply slowly changing from one color of light to another, though it does do a bit of chaser as well. They have held up quite well, but are showing their age. I’ve considered replacing them with addressable LEDs, but the cost of 25 meters of addressable LEDs is prohibitive (the Adafruit ones I like are $25/meter in quantity, which means $625 in strips). I also thought about it a bit; there are already a bunch of flashing lights going on in my display, so the addressable ones would be wasted.  I therefore decided to go with some non-addressable RGB strips, which means the whole strip will be the same color. By default, you get only the three primary colors + combinations of them, but it is possible to dim them with PWM and get a lot more colors. Through the magic of Ebay, I found these strips, which aren’t even close to the nice ones Adafruit carries, but they only cost $2.80/meter, so I get 25 meters of them for $70.

I’ve been playing with them a bit. They seem to be constructed okay, and come with connectors (though one of my reels has two male connectors, and another has two female connectors). One of the reasons they are so cheap is that they have economized on the amount of copper in the power lines; if I drive all three lines, the only way I can get the amount of current I expect is by driving the power lines from both end of the strip. If I do that, I can get 2 amps of current into each, and pretty good brightness. If, however, I plug a second strip into the first, the second strip pulls much less current (on the order of 1 amp), which means that I’ll have to feed every strip from both ends.

This happens because of how LEDs work. LEDs always drop a specific amount of voltage, depending on their particular chemistry. Lets say, for example, that we are driving LEDs that have a 2V forward voltage, and we want to push 25 mA through each of them. We are using 12V, so that means we need a resistor that will give us 25mA through 12V – 3 x 2V = 6V. That means 240 ohms. I cheated and used this website.  Which is great, if your supply voltage is really 12V, but if we lose a volt to losses, the current drops down to 20mA, which is a pretty noticeably difference in brightness.

Which comes to construction. I have two sections of house to light; one which is about 42’, and another which is about 25’. The strips are pretty flexible, so my plan is to use their self-adhesive strips to attach them to some lengths of 1/2” conduit. I’ll do jumper wires at the end of each piece of conduit, so that I can take them apart and bundle them for storage. This should also make them fairly easy to put up and take down, and for these projects, you always have to think about how much hassle you’re willing to put up with during decorating. I’ll split them into two strips; a 30’ section on the right, and then two sections that add up to 37’ on the left.

To drive it, I don’t need a whole lot of sophistication; I need to be able to drive 3 channels PWM and enough oomph to run some animation code. Even if I have to do the PWM in code, this is a really low bar. I want to try something different, so I settle on the Adafruit Trinket:

It has the mighty ATTiny85, and can be programmed with the arduino IDE. I could have done an 8-pin DIP in my STK500 programmer, but I’ve grown used to the Arduino IDE. The Trinket is very cheap at $7.95.

To drive the RGB strip, I decided to use three MOSFETS. Looking at the trinket, I had a thought – the holes are on 0.1” centers and there’s a bit of space around them, so why not add some headers, and build a shield for it? Seems like a plan.

The circuit is drop-dead simple; a MOSFET with the gate connected to the Trinket output pin, a resistor between the gate and the grounded source, and then the drain connected to the outlet. Assuming I’ve done it right, whenever I switch the MOSFET on it will ground the LED strip and light it up.

On a recent project, I did a breadboard arduino shield, which worked, but was a whole lot of trouble, so I decided that to do a PC board for the shield, especially since I have two 5V 5Amp power supplies, I need two shields.  Since I’m doing shields, the components can’t be too thick, so the TO220 MOSFETS that I was planning on are out. It’s time to head off to Digikey, and after a couple of tries, I settle on a MOSFET that comes in a SOIC package. It’s pretty tiny. I can’t find anything in Eagle that’s the right size, so I build the package for it, and start playing around. I reduce the size of the resistors (0805), and try a few different arrangements.

After playing around with the layout for a while, I find one that works well, and then find that I’ve reversed the source and drain, so I do another iteration. I upload it to OSHPark, and get back a preview of the front and back:

  

Because it’s such a small board, it only costs $3.70 for three copies of the board. It’s going to be a bit of a bear to solder (look at that really tiny diode on the left side), and I’m hoping that the traces are big enough to carry the current, but at that price I can afford a couple of iterations.

Tags: