Your leaking thatched hut during the restoration of a pre-Enlightenment state.


Hello, my name is Judas Gutenberg and this is my blaag (pronounced as you would the vomit noise "hyroop-bleuach").


decay & ruin
Biosphere II
dead malls
Irving housing

got that wrong

appropriate tech
Arduino μcontrollers
Backwoods Home
Fractal antenna

fun social media stuff

(nobody does!)

Like my brownhouse:
   electronic ordeals
Thursday, November 2 2006
Starting in the wee hours of last night, today I found myself suffering at the hands of electronics. It all began when I tried to correct an annoying thing that my Arduino-based solar sufficiency controller still does. Often when it makes a decision that causes a relay to change state it automatically resets. This doesn't affect its ability to heat water, since it always recovers from the reset and is then able to look at the sensor data and make an appropriate decision about what to do. But it makes the monitoring of its data via serial port unreliable. Sometimes when it resets the computer doing the monitoring can no longer follow the serial stream without somehow resetting its serial port, which often involves unplugging and then replugging the USB cable carrying the communications. This is not something I want to have to figure out how to do in software.
I did a little research on the issue and found that mine was a common problem when controlling relays with microcontrollers (though it wasn't a problem when using simpler controllers like the one I'd made out of a pair of John Kerry's 74LS74 flip-flops).
I tried putting large value capacitors across the energizing coils of the relays, but it was late and instead of connecting them on one side to the ground, I accidentally connected them on one side to a line carry 35 volts AC. Ooops! This quietly but obviously destroyed both a ULN2003 and a Atmega168. I was able to replace them fairly quickly, although the cycles of soldering and desoldering have started to make my circuit board look like an ærial photo of the Dresden documented by Kurt Vonnegut in Slaughterhouse Five.
Today, after a night's sleep and a gut full of coffee, I attacked the problem again. But after awhile is seemed that my ULN2003 Darlington Array chip (which interfaces between Arduino's five volt logic and the 35 volt logic of the relays) was dead. By now I'd added a socket and replacing it was easy, but every time I replaced the old one, the new one seemed to behave as though it was dead also. What was strange was that the replacement UL2003s didn't act dead initially; they'd work fine until the relays fired and then then they'd never act normal again. So I decided to replace them with a SN754410 motor interface controller, which works using positive logic, switching on or off a connection to 35 volts as opposed to ground. Rewiring the replays took me no time at all and the new circuitry worked perfectly.
So then I turned my attention to another vexing problem: how to read the state of 35 volt relays using the Arduino board. I had been doing this with the ULN2003 working in reverse, wiring the possibly-35 volt relay signals to ULN2003 inputs and then using the outputs to either ground or not ground an Arduino digital line set to act as an input. The SN754410 couldn't be used to do this, so I had to come up with an alternative solution. My first stab at the problem was to use a 7508 three pin five volt regulator to bring the possibly-35 volts don to TTL levels, but for some reason that wasn't working (and should have been, though the programming logic would have to work in reverse, looking for a high where it used to look for a low).
I ended up using a simple resistor-based voltage divider to bring the possibly-35 volt signal to TTL levels and then I buffered that with a 74LS04. I actually used several variants of the 74LS04, and always its output would consistently swing between 0 and 2.0 volts. The problem that had been plaguing me possibly all the way back to my decision to replace the ULN2003 with a SN754410 had been a bad digital pin on one of my Atmega168s - no doubt a victim of one of my merciless experiments. The rest of the Atmega168 was working fine, so I simply abandoned the bad pin and moved its functionality (in both software and hardware) to the one beside it.
It's unpleasant for me to guess how many times all these jobs required me to either kneel for painful sessions on the cold concrete of the basement floor or to charge up two flights of stairs to gather resistors, integrated circuits, or old circuit boards from which to scavenge components. The kneeling was especially agonizing, since it is the only position I could assume while doing the delicate work of desoldering old integrated circuits and soldering in new components. This is the curse of working on a live system, one that is actually being used to control existing equipment. Another curse was the fact that every time one of my tests made the pump start running, cold water would be moved from the solar panel down into the house. And since it was well past dark on a cold November night, that water was about 34 degrees Fahrenheit.


One thing I didn't even mention in this entry is that I also tried reading the possibly-35 volt signal using a 1489 Quad Line Receiver (the ICs that used to be used with interfacing RS-232 cables to TTL logic). But this didn't work because the 1489 cannot distinguish between +35 volts and +0 volts; it can only distinguish between positive and negative voltages.

For linking purposes this article's URL is:

previous | next