An Expensive Toaster

A few years ago, I got tired of a toaster that didn’t bother popping up before the toast was charcoal, so I got on-line and ordered a commercial-grade toaster from some restaurant supply store.  Based on the presumption that restaurants couldn’t afford to have a toaster that didn’t work right, I hoped to have a reliable appliance well into the future.  Unfortunately, that hope was unfounded.  Within two years, the toaster quit working.  You could hold the handle down and the heating elements would do their thing, but it wouldn’t stay down.

Isaac, being one of the bigger fans of toast in this house, rigged up an elastic band that would hold the handle down, but it wasn’t long until this arrangement produced it’s share of carbonized bread.  Unfortunately for Isaac, I don’t eat a lot of toast anymore, so I didn’t really have much of a motivation to replace it.  However, a few weeks ago I got a bug in my ear, went out to the garage for some tools, and tore down the toaster to see if I could figure out what was wrong.

The toasters I’d taken apart in the past (yes, I’ve disassembled one of almost everything at this point in my life) all used a bi-metalic strip in a mechanical assembly to hold the toast down until it heated up enough and bent far enough to release the mechanism.  All in all, it’s a pretty simple setup, if a little unpredictable when trying to set the toaster for the perfect toast. I figured something had been bent or broken in this kind of an arrangement, and that I could probably adjust or repair it.  If not, what difference did it make?  The worst I could do was to ruin an already broken toaster.  However, when I got it apart I realized my original assumptions were wrong.

This high-falutin’ hoity-toity commercial toaster used a digital timer circuit to control how long to leave the toaster on.  This, as luck would have it, was a good thing.  I’m reasonably good with mechanical stuff, but my bread-and-butter has for years been electronics.  I pulled out my well-worn but still functioning test equipment from the days when I actually got paid for fixing things and went to work.  Within a few minutes I’d reverse-engineered the simple circuit and identified the bad part.  Easy, I thought to myself, I’ll just add this part to my next Digikey order for one of my other geek projects.

As it turned out, Digikey doesn’t carry the integrated circuit I needed.  Neither do Mouser or any of the other parts-houses I’ve used before. The defective part was made by a Chinese semiconductor company and only available from China.  In fact, the only place I could find to order it from without having to read Mandarin (or whatever language it was) was aliexpress.com, and it would take 2-10 weeks to arrive.  The good part was that it would only cost me about $5.00 for 5 of the things including shipping it over on the slow-boat.  I placed my order and sat back to anticipate the part’s arrival.  What I’ll do with 4 extra “toaster timer” IC’s I’m not sure.

The parts arrived yesterday.  Compared with Amazon, the shipping times leave a little to be desired,  but I had the part in-hand so I went out to the garage and went to work without grumbling too much.  I soldered in the new component, tested the toaster, and put it all back together pleased with a job well done.  However,  no sooner had I assembled it than I realized it wasn’t working.  While it had been working on the bench while disassembled, it seemed to have a different opinion about proper behavior when fully assembled and on the kitchen counter.

I spent the next three hours disassembling, testing, tweaking, reassembling, testing disassembling, etc…  Any time I put it all back together it wouldn’t latch the handle down.  As it turned out, somewhere along the line, someone pushed a little too hard on the handle, and it bent the assembly, almost imperceptibly, but significantly.  Any time the whole toaster was assembled, the case would interfere with the handle and prevent it from fully engaging the locking mechanism.  It took forever to get everything straightened out and working reliably.

So, this gets down to my problem… I was seriously considering tearing out the electronics and programing one of my Arduinos to control the toaster.  What kind of an idiot would do that?  The alternative wasn’t much better.  Instead of re-engineering a solution, I spent an inordinate amount of time fixing something that, in the end, is worth no more than half an hour of my time if I were to bill out at an hourly rate.  I should have stopped before I even took it apart the first time, little lone the time and energy spent actually fixing it.  The fact that I was actually cogitating re-engineering the thing to work with a custom-programmed micro-controller speaks volumes.  Normal people would have just thrown the dumb thing in the trash and gone to WalMart for a new one.

Homebrew Antenna Analyzer (part 1)

In the ham radio community, homebrewing is a term used to describe making your own radio gear.  For most hams, this doesn’t go much beyond building and tuning an antenna out of copper pipe or wire, but I’m not really your average ham.  For one, I am almost never on the air.  That said, as I’ve spent more time recently reconnecting with my roots as an Electrical Engineer, I’ve opted to use my license as an excuse to play around with ideas.

In the process of building my last project (the sunrise light http://www.diligent5.org/?p=1849) I bought an Arduino Uno to mess around with and compare with the capabilities of the Raspberry Pi I already had.  In looking at the availability of A/D inputs and various forms of serial I/O on the Uno, I had a flash of genious (or insanity) where I thought it might make a decent controller for an antenna analyzer driven by an AD9851 direct digital synthesizer (DDS).  So, what, you might ask (especially given the nature of the few people who actually read any of this blog), is an antenna analyzer?

Antennas are “resonant structures” which roughly means they are the electrical equivalent of an organ pipe or guitar string.  Based on their construction, they will resonate at specific frequencies.  The frequencies where they resonate are the frequencies where they work well.  Trying to use an antenna that isn’t tuned to the frequency you are trying to transmit on will result in most of the energy going the wrong place (back into the transmitter instead of going out over the air for someone else to listen to), and can actually destroy your equipment.  If you are going to build an antenna, you need to be able to tune it the same way you tune an organ pipe or guitar string, and in order to tune it you need a device to send tones into the antenna and measure how the antenna reacts to them.  That is what an antenna analyzer does.

Analyzers are commercially available for both ham and commercial radio bands, and range from a few hundred dollars to a whole lot more.  I’ve been eyeballing them for a long time so I can start building antennas, but I’ve never been able to talk myself into spending the money on one.  But… if it’s a project, I build it a few dollars at a time and get the benefit of feeding my inner geek.  Never mind how much it actually costs (especially if you factor in time).

Analyzers are fundamentally pretty simple.  First, you generate a signal at the frequency you want to test, then use it to drive a bridge circuit.  The rest of the analyzer is all about digitally measuring voltages across the bridge and converting those measurements into the parameters I’m interested in.   As luck would have it, I’d been scanning various products advertised for the “maker” community (people who build stuff using Arduinos and such) and had seen an ad for modules based on Analog Devices AD9851.  This chip uses a fast digital-to-analog (D/A) converter to generate a high-quality signal output that is digitally controllable from zero up through roughly 75 MHz (million cycles per second).  This chip, combined with some filtering and amplification would make a perfect source to build my analyzer on.

Rather than buy an already complete module and have to figure out how to mount it, I opted to start from scratch and build a board that integrated the AD9851, would plug directly into an Arduino Uno, and contained everything needed to take the measurements (except for the user interface).  I’d use the arduino to program the AD9851, digitize the measurements, do the calculations, manage communications via USB port to a host computer, and run a display and buttons.   I grabbed a bunch of datasheets, opened eagle cad, and laid out my schematic and board.

Like most projects, it wasn’t nearly as straight forward as it seemed.  I ran into a host of hiccups along the way, but over the next few posts, I’ll try to explain how it works and the gotchas I ran into.

Geeking out part two

A few weeks ago, I wrote about a project I’ve been working on that uses a raspberry pi to mimic a sunrise as a sort of alternative to an alarm clock (https://www.diligent5.org/?p=1849) .  It’s generated a rather long list of learning experiences including things like the timing issues I wrote about previously.  After thinking about it, I figured it wouldn’t hurt to document a few of them.

First, debouncing switches can be easy or hard…  If you’re as dumb as me and want to set the system up to discriminate between long button presses, short button presses, and spurious noise it’s hard.  I think my completed debounce and conditional sleep code (they’re tired together) are almost a third of the overall code.  If all I wanted was to handle single button presses with the code waiting until it got one, it would have been pretty easy.  If I wasn’t interested in keeping the processor duty cycle and power consumption down, it would have been easy.  If I didn’t want to be able to have multiple functions depending on how the button was pressed, it would have been pretty easy.  If I had a better understanding of python’s order of operations and language syntax, it would have been much easier.  Unfortunately, I wanted to do all these things.  When I first got the prototype up and running, I thought I had a reasonable approach they seemed to mostly work.

When I sat down to write the code to run the new board design that included the hardware PWM controller, however, I made the mistake (or not) of scrubbing all the code.  I had seen some anomalous behavior trying to use the menu, and decided to look closer.  What I found led me on a rather long detour.  I ended up spending probably twenty hours working through the debouncing routines — roughly what I thought it would take to update it for the new controller.  Fortunately, it was pretty simple to swap out the old controller logic, so my overall time at the keyboard wasn’t all that different than I expected.  I just spent it doing different things than I had planned.

It all came together, but the most disheartening thing of all came when I turned the light on at the lowest brightness level.  It still flickers.  I can’t explain why.  The PWM controller is on a hardware clock that isn’t subject to processor load issues or interrupts.  In fact, the only time it should flicker or change brightness at all is when it’s begin commanded to change brightness.  However, it’s only noticeable at very low intensities, so I’ve decided to stop there in my quest.  It’ll have to be enough the way it is.  At this point, I’ve been using it regularly for a few months, and it’s been stable and run as expected with one exception:  the real-time-clock module I purchased off of ebay doesn’t seem to be working.  Without an internet connection, the time doesn’t update after losing power.   I’ll have to look into that later, but for now I’m just enjoying a little taste of success.

Quiet compassion

This fourth of July we were invited for a second year in a row to go with friends to their family reunion at the family’s farm/ranch outside Grants, New Mexico.  I have to say that this family represents the kind of accepting and down right Christian people I think the world needs more of.  Let me explain.

Many years ago, when the patriarch and matriarch were young veterinarians just out of school, they landed in this small town west of Albuquerque and set up shop – the husband dealing with large animals, and the wife handling the small ones.  As life progressed, kids joined the scene as they often tend to do.  If life weren’t already interesting enough for this small-town family, two of the brothers destined to join this family decided they couldn’t handle being separated, so they arrived together as twins.  Unfortunately, when he was very young, one of the brothers contracted a severe case of influenza that crossed the blood-brain barrier and caused severe encephalitis.  It was by no means certain that the twins would grow up together in this life, and the sick son’s future was precarious for quite some time.  After a long time in a coma, he recovered; but the sickness had destroyed the area in his brain that processes signals from the ears.  He was deaf.  Profoundly deaf.

For the next several years, the matriarch would pack the kids in the car every day and drive over an hour away to take her son to the deaf school in Albuquerque while the other kids played at parks or learned sign language along with their brother.  Our friend still remembers these almost daily trips and heroic efforts her Mom made.  It was a great sacrifice for all involved, but it was one they all made.

Over the course of the next several years, the son began attending in-residence school and only came home on the weekends.  It was a necessary evil as far as the family were concerned, but one that had to be endured none the less.  One side effect of this transition was that while he was at school, the deaf son made friends with several other students who’s families had effectively, if not explicitly, abandoned them.  Rather than leave them alone at the school, they were invited to join the family, and several began coming out to Grands on weekends rather than sit lonely at school.

I met several of these fine people last year when we first attended one of these family reunions.  They were all described to me as being “my son” by a rather proud adoptive father.  The family had opened their hearts and home to entire families who were otherwise marginalized or excluded from their rightful place in society.  What a neat bunch of people, and what a great experience at a time when I was struggling to see the good in the world.

As I talked with the family over this last trip, I was shocked to learn that many hearing families of deaf children refuse to learn sign language.  Even worse, they often completely abandon their deaf family members to social workers and deaf schools.  This family was a shining exception to this awful reality.  Everyone learned sign, and everyone (hearing and deaf) were made to feel important and a part of whatever was going on.  In fact, I was among the few outsiders there who needed an interpreter (they were happy to interpret for me when needed).  All around me there were animated silent conversations between friends and family.

I am impressed by the kindness and genuine love this family has for those who the rest of society have basically written off.  At a time when the world seems very self centered, unkind, and intolerant; I find hope in the quiet goodness of people like my friends and their family.  I hope they see in me a portion of what I see in them.