Introducing a new category: Airplane building!

This post opens a new category: airplane building. I’ve been wanting to get a pilot’s license for a long time, and I got halfway back in 2001 before losing momentum and realizing the financial futility of the endeavor. This past spring I thought I would get back into it, actually flew twice back in Massachusetts before it became clear that we were moving to CA which kind of made that pointless.

But what really got me fired up was the realization that you can build your own airplane! From a cost perspective it’s a big win, because when you are your own manufacturer you can do all maintenance yourself, not to mention that building a plane is generally a lot cheaper than buying one (for what you get). And how cool is that?!? It totally seemed like a project for someone like me.

I looked around for what suitable airplane models were around. Generally you can either buy a kit, where you do the assembly, or you can build from scratch. There are some cool kits out there. Check out this video featuring the Lancair Legacy:

How awesome is that? They’re fast! However, they’re also a bit on the pricey side, at $75k for the kit plus something like $50k for the engine…

After looking around some more, I pretty much settled on the Rutan Long-EZ. This was a quite popular aircraft to build back in the early 80’s, when the Rutan Aircraft Factory sold plans to them. It’s small, economical and relatively fast “canard” airplane (meaning the big wing is in the back) built from scratch out of fiberglass. This is a pretty good video showing it off even if it can’t match the Vince Walker video in awesomeness:

The catch is that they stopped selling plans to them back around ’84. There are still people building them, though, and you can still find unused plans around. Before moving to CA, I picked up a set of plans with serial #1122 off a guy nearby who’d never gotten around to building. Now I just needed to find space and learn the technique!

Long-EZ plans

My Long-EZ plans, S/N 1122.

Moving to LA, starting at SpaceX, and buying the motorcycles put this on the back burner for a while, but when I saw that the Experimental Aircraft Association was having their SportAir workshops in Riverside I signed up for the composite one. That’s the next post.

NC23 Exhaust crack

On my way home from work today, I noticed the exhaust note being a bit more growly than normal. Sure enough, upon inspection when I got home, the exhaust pipe is cracked. Teh suk.

Exhaust crack

The crack in the exhaust pipe, just before the bottom bracket.

Shortly after getting the bike, I noticed that the exhaust can had been rubbing on the rear brake caliper, to the point that both have sort of been ground away. See the picture below. It doesn’t look good, but since the damage was already done, I’ve left it for more pressing things. You may also notice that there’s no bracket for the exhaust can. I asked the seller about it and he said he’d never had one.

Caliper damage

The body of the caliper as well as one of the caliper sliders are pretty badly ground away.

After removing the canister, you can see the damage better. The head of the front slider bolt is totally gone and the canister itself has a serious dent in it along with the ground-off parts.

Caliper damage

A better view of the caliper damage with the exhaust can removed.

Exhaust can damage

The inside of the exhaust canister is also dented and ground away.

There are indications that the bike went down pretty hard on the right side at some point (e.g., the dent in the exhaust can, the state of the fairings on the right side, the clutch cover damage), so I’m wondering if the exhaust pipe is bent inwards or if whoever replaced the brake (I’m pretty sure it’s
not stock) didn’t check the fit and mounted one that’s higher profile. (I think the guy I bought it from said both front and rear brakes were from an CBR600F3.) There is very little clearance, about 5mm, between the exhaust canister and the swingarm, so the caliper basically could not extend beyond the swingarm outer edge without rubbing on the exhaust.

Caliper top view

This is the caliper from above. As you can see, it protrudes outside of the swingarm outer edge. Is the stock caliper the same size or is it lower profile?

Can anyone tell me if the stock caliper is lower profile?

Anyway, after getting the exhaust off and banging on the cracked area a bit it’s clear that the material is pretty rotted on the bottom. It almost seems like the rear pipe is double-walled with some fibrous material in between, but it’s possible it’s just rust. I’ll take it to a muffler shop and see if they can fix it, but if it’s actually bent inward I’d like to also ask them if they can bend it back outward a bit to fix the clearance problem. And I guess I should find a bracket for the exhaust canister…

Exhaust crack

After removing the pipe and banging on it in different places, it’s clear the bottom of the rear pipe is pretty rotted.

NC23 Makeover #1

In general the paint on the NC23 is in pretty good shape. I don’t know how old it is, but the blue and white is not an original scheme.

CBR400RR NC23

This post-purchase picture shows the NC23 putting it’s best face forward. The right-hand fairings are OK apart from minor paint chips and a grind mark under the clutch cover, barely visible in this picture. The left side was not so good.

However, it’s pretty clear that the bike went through a “severe event” at some point. The left-hand middle fairing is not an original piece, it’s thicker and heavier than the other pieces, and it had a significantly lighter shade of blue without clear coat. The lower piece was half-covered in the same paint, and there were chunks cracked off at the bottom and by the alternator cover. The left side of the top fairing also had the tab in the lower, rear end missing. (On the right side that tab was cracked off, but still there thanks to a chunk of JB Weld applied by some earlier owner. I set out fixing up these blemishes.

The missing and cracked off tabs on the top fairing with Plastifix. This is a plastic powder that you can use to rebuild ABS plastic with, and it’s awesome. You basically dissolve the powder in a solvent drop by drop and build up the missing piece. Repairing cracks is a piece of cake, just dremel out the crack halfway through and then rebuild with Plastifix. Fabricating missing pieces is a bit more work since you need to support the plastic until it hardens, but the result is infinitely better than epoxy or JB Weld which doesn’t really bond well to the plastic. If you need to repair your fairings, I can’t recommend it higher. Check it out at Urethane Supply Company.

With the tabs on the top fairings fixed, went to work on the paint. The shade of blue is really close to the color on the Passat, so I used my touch-up bottle to fix the numerous small paint chips and after sanding and buffing it’s virtually impossible to see unless you know to look for them.

The sky-blue pieces wouldn’t be so easy though. To see if the Passat paint would work on a larger piece, I sanded down the middle fairing and airbrushed a chunk with the “Indigo Blue Metallic” paint and clear coat. The result is shown below. While the shade is close, it’s got a more purple tone and the metallic flecks are too prominent. I guess there’s no alternative but to visit an auto paint store and get some matched paint.

Test of Passat paint

Here’s a test spray of the Passat “Indigo Blue Metallic” on the right-hand fairing compared to the left-hand side with the correct paint. It’s pretty close and clearly a lot better than the old paint on the rest of the piece, but it’s not quite right.

Until I get matched paint, I proceeded with stripping the paint off the middle piece. Not only is it a different material, it’s also clearly inferior to the original pieces. To begin with, there were numerous tiny cracks in the face of the plastic that didn’t seem to go all the way through. I Dremeled them out and repaired with Plastifix.

Stripped and repaired piece

Here’s the right-hand middle fairing after stripping the incorrect blue paint and primer and repairing some minor cracks with Plastifix.

The plastic is also warped and has depressions in it, so I proceeded to apply some flexible epoxy filler and try to get it flatter. In the process, I sanded through the top layer of the plastic and exposed a yellow material that almost looks like fiberglass, except there’s no fiber. I don’t know what this piece is made of, but it’s clearly not ABS like the original fairings.

With filler applied

Here’s the middle piece with filler applied. You can tell the wavy shape from where the filler is.

Mystery material

Here’s the yellowish material exposed where I’ve sanded through the top layer.

Does anyone have any idea what this material may be?

NC23 Headlight Retrofit #2

This is the second and final installment about the NC23 headlight retrofit project. In the first post, we compared the beams of the old headlight and the new projectors. Now we’ll see how it turned out.

The final mounting of the projectors in the headlights involved making a mount to screw it in using JB Weld, then attaching the shroud with some high-temp silicone RTV, and finally replacing the front glass.

Mounted headlights

The new headlights mounted. The right one is done, the left one is temporarily mounted to check rotational alignment.

Projector backside

The rear of the projector, showing the bulb attachment and the RTV used to seal the space between the projector and the headlight housing.

Sealed headlight

The new headlight after re-sealing the front lens.

Now it was time to wire them up. Rather than try to squeeze in the ballasts in the nose, I decided to put them in the tail. TheRetrofitSource.com obligingly provided me with 50″ extension cords for the bulbs, and to switch the ballasts I soldered together a small circuit with a power MOSFET as the switching element in favor of a relay. The switching needed a bit of thought as the hi/low beam headlight switch switches both bulbs off for an instant when changing state — a big no-no for HIDs. So I wired up a time delay circuit with an opamp connected as a Schmitt Trigger driving the MOSFET and an RC circuit on the input connected to both high and low beams with diodes. The net result is that if either high or low beams are on, the ballasts are on, and the RC circuit provides about 2s time delay before switching them off. This is easily enough to bypass the gaps in the high/low beam switch at the price of having the lights be on for 2s when turning them off — which is fine.

Ballasts

The ballasts are mounted in the tail where there’s plenty of space for them. The little circuit board with the MOSFET switch is barely visible between them.

Since the high-beam circuit now only needs to provide power to the bi-xenon solenoid in the projectors, I got rid of the high-beam relay which also provided convenient access to the ignition and high-beam circuit for wiring up the inputs. The high beam relay switch output was also connected directly to the input  so that the high beam indicator light would come on. All in all the wiring was pretty neat and I did not need to cut into any stock wires.

Cable routing

The wiring from the the ballasts to the front, consisting of the two bulb wires plus two thin wires for ignition and bulb on, goes in a plastic loom routed along with the main loom. The MOSFET switch is wired directly to the battery with two dedicated wires.

Everything back together

All mounted and back together, this is how it turned out. I think the headlights look even more like two eyes now when they have the projectors as “pupils”. (The mid/lower fairings are off for cosmetic rework.)

So how well did the final result work? Sadly, not as well as I had hoped. The fluted front glass really does a number on the beam output, projecting more light above the cutoff. They also seem to detract a lot from the final intensity. Below are some pictures of the final result.

Final output from one projector

This is the beam from one projector including the fluted glass. The exposure settings are identical to the ones for the beam pictures in #1, but I’m not positive the light is at the same distance from the garage door. It’s so much fainter that it seems remarkable a clear piece of glass could take away so much light. Also note the severe glare now present above the cutoff. It comes from the top center part of the projector and must be some refraction in the glass.

Final output from both projectors

This is with both projectors turned on.

Final output -- high beam

This is the high beam. Only one solenoid is wired up, so while both lights are on, only one is in high beam here.

As you can see, the result is quite disappointing compared to what it looked like with the bare projectors in part 1. I thought I had put the lights a certain distance from the wall in those photos, but judging from the width of the beam here compared to in part 1, I think they were closer. That would certainly explain the pretty dramatically fainter pictures here. Even if the front glass clearly does waste a fair amount of light, I have a hard time thinking it would make that much of a difference.

And for a final comparison, here’s two Morimoto Matchbox vs the two Valeo A4 projectors in the Passat:

Matchbox vs Valeo

Here’s the two Morimoto Matchbox projectors on the left compared to the two Valeo A4 D2S projectors that I retrofitted onto the Passat. The Matchboxes clearly are inferior, but they are still not bad. I’d say the tiny Matchboxes are doing a pretty good job, especially given their small size. (And yeah, the Passat headlights need to be re-leveled, the left one is way too low.)

So was this really as much of an improvement as I had hoped? Well, it’s definitely way better than the stock headlights, no question about that. But that fluted front glass really does a number on the beam, I really don’t like the glare introduced above the cutoff. I don’t have a good idea now how much that will bother oncoming drivers, but given how much I hate people with glaring headlights I really don’t want to be one of them myself. If worst comes to worst, people are apparently having reasonable success shaping their own clear front lenses by molding plexiglas, if it turns out to be really bad I’ll give that a try.

NC23 Headlight Retrofit #1

After moving back to CA, I decided to get a motorcycle again. (I actually got two!) They are both 1990-era 400cc “grey bikes” that were never officially imported into the US, so quite hard to find. One is a 1988 Honda CBR400RR NC23 and the other a 1992 Honda VFR400R NC30. Owning a 20+ year-old motorcycle means there’s a fair amount of restoration work needed, which I’ll describe separately. This post focuses on the first upgrade I decided to do to the NC23: a HID headlight retrofit.

If you’ve seen my the description of my Passat headlight retrofit, you know that I care about having good lights when driving. The standard headlights on the NC23 are, as typical for that era, two small, round lamps, as can be seen in this picture below, taken just after buying the bike. The lamps uses a “H4-like” japanese special bulb that has a 35W low beam and a 60W high beam. So not only are the bulbs 20W less than a normal “H4” bulb, they are mounted in these tiny reflectors that are not very efficient. The result is pretty anemic lights, particularly the low beams.

CBR400RR NC23

The standard headlights on the bike are two small, round 35W halogens.

This certainly doesn’t seem good enough to ride around at dark, not in rural areas and neither in LA traffic. Something had to be done.

The headlights are extremely small. They are 10cm in diameter and only about 6cm deep, so there’s no way a HID projector will fit inside them. But if you’re willing to do some work and accept that the projector will poke out the back quite a bit (this is fine, there’s sufficient space behind the lamps) it might work. I found the tiny Morimoto Matchbox bi-xenon projectors at TheRetrofitSource.com. They don’t recommend them for main headlight retrofits, being so small they don’t have the same amount of light as a full-sized projector, but surely they couldn’t be worse than the standard headlights!  I ordered a set of projectors, 4300K HID bulbs, ballasts, and an extra long bulb extension cable so the ballasts could go in the tail, where there’s plenty of space.

I took apart one headlight, and after liberal use of Dremel and JB Weld, I could fit the projector in it. The picture below shows a bare projector and one mounted in the headlight. Just so you can appreciate how small these projectors are, I included the standard headlight bulb in the picture as well.

Morimoto Matchbox projectors

These are the Morimoto Matchbox projectors, one of them mounted in the disassembled headlight. The standard halogen bulb is included for scale.

So how does the beam from the Matchbox projectors compare to the remaining standard headlight? The pictures below were taken with identical exposure settings, set to avoid saturating any of the pictures. Judge for yourself:

Standard low beam

The standard low beam. The exposure was set to not overexpose any of the shots, which were taken with identical exposures. It really is this dim, in comparison.

Standard high beam

The standard 60W high beam. A lot brighter than the low beam, at least.

Matchbox low beam

The low beam from the Matchbox projectors. Not only is it dramatically brighter than the standard low beam, it also is much wider. The beam pattern is not bad, but there’s some kind of reflection above the cutoff.

Matchbox high beam

The high beams from the Matchbox projectors. If you compare the garage door pattern on the low and high beam shots you can see how much higher the beam is.

Clearly this will be a dramatic improvement. Remaining to do is to paint the inside of the old reflector housing black, secure the projector in the housing, mount the shroud, and then wire it up. Shouldn’t be a big deal.

High Performance Wine Storage System #8: Adding Open-Loop Control

This is post #8 describing the wine storage unit upgrade. See the introduction post for the background.

When I put the temperature probe into the bottle, I set it up as a nested control loop system where the bottle temperature would regulate the desired air temperature in the cabinet and then the cooler would be regulated based on the actual air temperature. This did not work well. The air temperature measurement is seriously hampered by the fact that the probes are in the walls, so what resulted was just a very unstable regulation. Not acceptable.

So I reverted to one control loop where the bottle temperature would directly control the cooler. Because of the slow response of the water-filled bottle probe, I lowered the gains on the loop and left it for a while to test. This worked better than before, but due to the nature of the setup, the loop obviously couldn’t respond to a change in temperature until the bottle temp changed by .07C (the resolution of the DS18B20). By the time the temperature had changed this much, the system was well out of equilibrium (perhaps due to changing ambient temperature, like the heater turning on in the morning), and it would then take a long time to find the new equilibrium. The result was that the temperature was always swinging from +0.2 to -0.3C around the set point, and the cooler would ramp up and down on timescales of about an hour. Better, but not very good.

I figured that part of the problem was that the controller is only reactive. If the ambient temperature (which we measure) goes up, we know that the cooler will have to ramp up, so if it could do this immediately, without waiting for the bottle to have changed temperature, that would improve the regulation. The solution was to use the feed-forward input on the PID loop to add an open-loop control to the system. After taking some datapoints on about how much cooling was needed to maintain a certain delta-T between the bottle and ambient, I came up with a roughly linear relationship (which is what one would expect from a simple thermal conduction model) where each degree C of delta-T required 9% of cooling power.

So, setting the cooler according to

cooler output in % = (ambient temp – setpoint)*9

should be  a pretty good approximation of the steady state of the system, and this has the advantage that it does not depend on any tuning constants. By letting the control loop work on top of this value, we only rely on the PID loop to take out any error in this model, not on primary control.  (Incidentally, the same feature is found in high-end building thermostats under the name “outdoor reset”. It’s a similar idea, a building has a large thermal inertia and if you wait to turn the heat up when it gets cold until it’s cold inside, you’re already behind.)

This works great! The bottle temperature is now rock solid at 13.0C, with occasional short excursions to 13.1C or 12.9C. The cooler output is also much more stable. Now I could actually imagine trusting it to keep a bottle of Ridge Monte Bello… 😉

High Performance Wine Storage System #7: Final tuning

This is post #7 describing the wine storage unit upgrade. See the introduction post for the background.

If you’ve followed the story so far, you know that it’s kind of been a bumpy road, especially once the ICs started burning out… But at this point we have a basically functioning unit. Now the question is how well it works.

The inside temperature is measured in 3 places: two temperature probes that enter through the back of the cabinet and were supposed to be mounted in the back wall and one on the circuit board for the lamp under a cover in the cabinet ceiling. Once the cooler was functioning reliably and I started testing how well the control loop worked, a few things were apparent. First, the temperature indicated by the probes when they were flush against the back wall was several C higher than if they extended into the inside. Perhaps this should have been expected, but I figured that the inside of the cabinet would be in thermal equilibrium with the air inside. It turns out that’s not the case, the walls are a lot warmer. The wine bottles, however, lie on wire racks and are basically insulated from the walls. The end result was that when the box had reached an equilibrium and the temperature probes showed 13C, the actual bottles inside were much colder, more like 9C. So much for exact temperature control… I glued little aluminum plates to the top of the probes in the hope that this would give them better heat transfer to the inside air, but it didn’t really help. A better solution was called for.

The best way to measure the temperature is, of course, to measure the temperature of the liquid inside the bottles. That’s a bit of a problem for the wine, but to make as unbiased a measurement as possible, I sealed up a DS18B20 temperature probe in silicone sealant, put it in an empty wine bottle, filled it with distilled water, and sealed the cork! This does of course give the probe a huge thermal inertia, but at least it should be an accurate temperature reading. I just hope the seal works so it doesn’t stop working after a while…

Bottle probe

The connector to the temperature probe that was sealed into a wine bottle full of (distilled) water to give as accurate a temperature for the actual wine as possible.

I figured it would be hard to control the cooler directly from this probe since the response time is so slow, so I set up 2 nested control loops. The outer loop reads the bottle probe and steers the desired cabinet air temperature to keep the bottle at the desired temperature, while the cooler is controlled by an inner loop which maintains the air temperature as requested by the outer loop.

Another problem is that because the cold air exits in the bottom of the cabinet, there is an overall temperature gradient inside. I’ve tried to minimize this by basically always running the interior fan at full speed, but I’ll have to run the system with the bottle probe in different locations inside the cabinet to see how severe this is once the temperatures equilibrate. It’s possible that this is just a problem when the cooler runs on full power trying to cool things down and not when it’s just maintaining temperature.

The front panel display now shows the current wine temperature (from the bottle probe), the cabinet air temperature, the outside temperature, the humidity, and the current cooler output. For some reason, everything works fine except the humidity display. Whenever it gets to the humidity, I get 1-wire errors to the DS2408 and the display gets corrupted. Every other screen works fine. It’s really weird.

Here’s a short video clip showing how the display works:

http://www.youtube.com/watch?v=3yKfAtbmECI

At this point, the cooler is pretty much operational. I have to say this turned out to be quite a bit more work than I anticipated, but it’s also been very educational.  I’ll probably keep tweaking the display and control loops, but now it can at least be used. We’ll probably wait to buy any expensive wines until after we move to LA though, there’s not much point in doing that now.

I’ll upload the Eagle files for the circuit boards in case anyone wants to retrofit their coolers, but somehow I doubt it…

High Performance Wine Storage System #6: Troubleshooting

This is post #6 describing the wine storage unit upgrade. See the introduction post for the background.

Time to start testing things. I had managed to burn the Arduino bootloader onto the Atmega 328, and I had previously written some test code to exercise the front panel LED display. The big thing to test now was the H-bridge to the cooler. This turned out to be more of a problem than I’d anticipated. Suffice to say that I’m not very experienced with switching circuits, and the amount of  noise generated when the bridge turned on was a way bigger problem than I’d anticipated. It screwed up the communication to the temperature probes, and initially it would even reset the Atmega when it first turned on. Highly suboptimal…

Troubleshooting

This is me trying to figure out what the problem was with the H-bridge. I'm really happy I got that oscilloscope, without it I would have been totally stumped!

The key realization was to put an inductor in series with the thermoelectric element. This prevented the current rush and made everything much more well behaved. Below is a screenshot of the oscilloscope showing the inductor and thermoelectric element voltages during the switching cycle. There are still substantial spikes at the switches, but it’s at least low enough to not reset the Atmega  microcontroller.

Oscilloscope image

The switched output to the cooler using a 5uH inductor. The yellow line is the H-bridge output voltage, the red line the voltage across the inductor, and the green line (which is yellow minus red) the voltage across the thermoelectric element.

The communication with the temperature probes now worked fine, but the front panel was still a problem. Since there’s much more data going that way, it was running in 1-wire “overdrive” mode, so the speed was higher. Even after adding a number of bypass capacitors by the connectors to the 1-wire probes, it would still refuse to communicate. (I found this good article on “Power Supply Noise Reduction” that I wish I’d read before designing the circuit board. There were some rules of thumb, obvious in highsight, that I wasn’t aware of.) Since there was no way I could put an inductor on the board, I ended up making a little “extension cord” to the connector to the thermoelectric element. It looks a bit hoaky, but this is prototyping at its finest…

Inductor

The connection to the thermoelectric cooler, with the 5uH inductor retrofitted as a short "extension cord" before connecting the cooler.

To “solve” the communication problem, I resorted to just turning off the cooler while sending things to the front panel. This lowers the maximum cooling power a bit, but it only takes a few milliseconds a couple of times per second, so it’s not a big deal.

Back boards

The circuit boards on the back. To the right is the power supply board that was originally there, on the left (with the oscilloscope probes attached) the board I made.

The biggest remaining problem was that I kept burning out the ADP3120A driver chips for the H-bridge. It was always the same one, the one that should just keep the low-side MOSFET on continuously during cooling operation. After replacing 4 of them (at about a buck fifty each) I said “screw it” and just hardwired that MOSFET to be on all the time. I can live without  heating ability for now, especially since we’re moving to LA and are unlikely to need to heat the wine in the foreseeable future. I really don’t know what was going on, I double checked the wiring several times and the to 3120’s were connected exactly identically.

I also ended up with an even bigger “event”: After adding the inductor, there was an uncomfortably large voltage spike when the bridge turned off, -35V or so. This is apparently expected according to the H-bridge articles I had read and is because it takes a while for the internal source-drain diodes in the MOSFET to start conducting. Since the inductor current has to flow, the inductor voltage builds up quickly. The solution recommended in those articles were to put a capacitor across the H-bridge output, so the current would go into charging the capacitor until the source-drain diodes start conducting. Not having any indication of how big such capacitor should be, I took one of the plentiful 1uF SMD capacitors I had. After soldering this on, the power supply would refuse to start when I plugged it in. (It has a LED that indicates whether the output is at 12V.) This seemed very strange, but after a few tries it started. However, when I attached the oscilloscope probes, I saw to my horror that both the 5V and 12V rails were swinging to +-10-20V. I have no idea what caused this, but the Atmega did not survive! When I changed the capacitor to 470pF, everything seemed fine and I haven’t had any problem since.

If anyone has any idea what might have caused this, please let me know. The weird thing is that the H-bridge shouldn’t even be on when the power comes on, the disable input to the ADP3120A is pulled down and I’m pretty sure the Atmega outputs start up as high-impedance inputs…

After desoldering the Atmega (lucky I got that heat gun) and attaching my spare one (another $4.50 in the trash can) it finally seems like things are behaving. Time for the final tuning of the software and testing how well the temperature regulation works.

 

High Performance Wine Storage System #5: Hardware

This is post #5 describing the wine storage unit upgrade. See the introduction post for the background.

By now, most of the electronics are done, but some hardware work remains: The cabinet needs to be drilled up to fit the temperature probes, and 4 conductors need to be put through to the lamp area for the 1-wire probe and humidity sensor. Since the cabinet is insulated with foam, it was pretty easy to drill 2 holes through to the back for the temperature probes. The lamp connection was a bit more tricky, but using a long metal wrench extension I managed to jam a hole into the insulation above where the lamp board is mounted, so that I could then poke a hole in from the lamp side and get through. These holes will be refilled with polyurethane spray foam later, so it’s not really a big deal.

I also took the thermoelectric assembly apart to add a temperature probe to the cold sink. The pictures show the disassembled parts, the mounting of the temperature probe, and the reassembled heat sinks.

Thermoelectric assembly

Here's the disassembled thermoelectric assembly. The element itself is the little square in the center, the large heat sink on top is the external heat sink, and the small heatsink on the right is the internal cold sink. The whole assembly is mounted into a styrofoam block that mounts into a large hole in the back of the cabinet.

Cold sink

Closeup of the cold sink with the hole that used to contain an NTC thermistor. I drilled out the hole a little so I could also fit a DS18B20 temperature probe in there.

Heat sinks

The assembled heat sinks for the thermolectric element.

Cabinet back

The back of the cabinet, with the thermoelectric assembly removed. It goes into the square hole in the middle. Under the hole are the dual 12cm computer fans that blow air across the external heat sink. The black-white-red wires with the tiny connectors coming out of the back are the temperature probes

The temperature probe in the cold sink is useful since you can deduce if the fans have failed: if it starts getting really cold, the interior fan probably isn’t working, and if it’s hot, the exterior fan is the one not working. Since we’re feeding 70W into the thermoelectric element, I bet it would be bad if a fan failure went unnoticed…

I also installed a temperature probe on the intake side of the exterior fans for monitoring ambient temperature. It might be useful to know what kind of delta-T to the outside we’re trying to maintain.

By the way: one lesson learned was to pay attention to the size when shopping for connectors. Since I needed a bunch of connectors for the 1-wire probes, I looked through the Molex website and found a model called “Picoblade” that looked good. What I didn’t realize was that 1.25mm spacing receptacles are tiny (one could say pico-sized…). The crimp connectors for the wires were so small I needed a magnifying glass just to see what’s going on. Since I didn’t buy the $250 crimp tool, I had to solder the connectors, and it was all too easy to fill the entire connector with solder… Finally I worked out a method of tinning and fluxing the wires and then just heating the connector to attach it that worked, but they were so small it was a serious pain in the ass.  (For the high-current connectors from the power supply board and to the thermoelectric element, I picked a connector type called “Mini-fit Jr” which turned out to be the same as the CPU power connector on ATX motherboards, which was nice.)

Finally, the front panel cover was cut out to make space for the 6-digit display and reattached. It used to have a sticker on it but that obviously doesn’t fit now, so you can see the cutouts in the plastic for the “buttons”. It doesn’t look great, but it’s not a high priority.

Front panel in action

The new front panel mounted in the door. A larger hole was cut out to accommodate the 6-digit display and the right button was moved which required dremeling out a new "button" out of the front plastic. It was originally covered with a silver sticker, which would be nice.

Now we’re ready to start testing the functionality. There were some bumps on the road to getting everything working. Read about it in the next post about troubleshooting.

High Performance Wine Storage System #4: The Main Board

This is post #4 describing the wine storage unit upgrade. See the introduction post for the background.

If you’re read the previous posts, you have an idea of what functionality I have in mind. What remains to be made is the main circuit board that will house the microcontroller and the driver circuits for the thermoelectric element and the two fans, and then the hardware modifications to the unit.

The fans are controlled with switching regulators as described in the article “Voltage Regulators Rev Up PWM-Based Fan Control”. The common MC33063 switching regulator converts the PWM output from the microcontroller to a nice, smooth output for the fan. (I used to drive the fans in my computer with PWM directly, but the switching of the voltage creates audible noise in most fans, so this is much preferable.)

Because we want to be able to run the thermoelectric element in both a cooling and heating mode, it is connected to an H-bridge which is driven by another PWM output on the microcontroller. (When figuring out how to do this, I came across this excellent series of writeups about H-bridges. If you are interested in how they work, I encourage you to check it out. Since we aren’t controlling an inductive load like a motor, we shouldn’t have to worry about the bypass diodes etc that are described in those articles, though.) The H-bridge has 4 MOSFETs controlled by two ADP3120A driver chips that deal with boosting the voltage to the high-side transistors and preventing shoot-through conduction which would quickly overheat the transistors. The two sides of the H-bridge are controlled by the two PWM outputs connected to Timer1 on the Atmega (which means they switch in sync) as well as a common disable line that will pull the gates of all 4 transistors low.

With the two switching regulators, the H-bridge, the Atmega328 microcontroller, and the connectors to the front panel, lamp panel, and the 1-wire temperature probes, it ended up being a fairly large circuit board. Here’s what it looked like after soldering all the surface mount components and enough other stuff to be able to test that the Atmega could be programmed through the ICSP interface.

Main board

The main board, with surface mount components soldered and the Atmega connected to the AVR programmer. On the lower left are the two switching controllers (marked FAN1/2) , and the right half of the board is the H-bridge (with space for heat sinks for the power transistors).

I did run into some trouble making this board. The first iteration had too narrow spacing between all the fills and the conducting parts, so there was loads of short circuits. I redesigned it and tried to etch a new board, but for some reason the toner transfer failed repeatedly. In the end I said “screw it” and went back to the first board — it ended up being easier to cut the shorts than to make a new board. (The reason for the large isolated fills is that the toner transfer seems to work better if there are large filled areas. Single thin connectors by themselves almost always end up not transfering correctly.)

In the end, this is how all the boards look fully populated, except the heat sinks for the H-bridge MOSFETs (which may not end up being necessary).

Circuit boards

Here are the three circuit boards, fully populated (except the heat sinks for the power transistors for the thermoelectric element.)

It all worked pretty well, but what trouble there was came with the H-bridge. The thermoleectric element pulls about 6A at 12V, i.e. about 70W, a fair amount of power compared to most digital electronics stuff. This means there’s enough power to burn stuff out if you accidentally short something, so some care needs to be maintained when poking around with the oscilloscope probes. Since it runs with PWM, it switches on and off, and this puts all kinds of switching noise onto the power lines which screwed up a lot of things. But first a few hardware changes were necessary.