I recently had to replace the phone dialer on my home alarm system (you can read about its failure and the implications at “My phone dialer dilemma”). Since the connection between the alarm-control unit and the dialer is a simple wire without any sort of “data” or embedded format or protocol, I assumed that the previous dialer and this new one would be electrically consistent and compatible.
Not so. The previous dialer required a transition from high-to-low to trigger it, while the new one was seeking a transition from ground to “open circuit” as its trigger. Unfortunately, “open circuit” is one of those sometimes ambiguous terms: does that mean “floating” (truly open) or will disconnecting the line via an open-collector output be sufficient?
Adding to the challenge, the alarm-control unit's documentation about its output pin was amazingly unclear as to its electrical nature: it might be an open-collector structure, or maybe not. Thus, I could not even say for sure if the control unit's output was at least potentially electrically compatible with the dialer's input needs.
I would have tried it; after all, what the heck, how bad could it be? And, what was the potential for harm, anyway? Unfortunately, although everything in the control unit is programmable, including the transition direction of the output pin, programming anything on the unit is so arduous, so laden with opportunities for messing things up, and so generally painful that I was afraid to try. It's one thing to not achieve the results you want, but it's another to ruin what you have working in a known, if not fully desired, state and yet be unable to go back. (If you think I am exaggerating, see “My revised KISS design principle” for details.)
What to do? I thought about it for a while, and summarized the problem: what I had was an output that went from high to low with unclear structure, and what I wanted instead was for it to look like a dc-signal going from ground to open.
Then, the solution became obvious: use a basic electromechanical relay. I found a DPDT unit in my collection, with a 12 volt, 10 mA coil. I connected the coil between the supply rail and active output of the control unit, and used the unenergized relay contacts to connect the input of the dialer to true ground. When the control unit's output went low (pulled down), it energized the coil, which opened the normally-closed relay contacts, and thus provided a true open circuit to the dialer input.
Problem solved! The relay functioned as both a level shifter and signal inverter, and gave me absolute electrical (galvanic) isolation as well. I know that in some situations isolation reduces or even solves potential problems such as ground loops, while in other cases it aggravates or may cause problems, but here, it seemed like isolation would do no harm and would probably do good.
Interestingly, the basic electromechanical relay is among the oldest electrical components in the electrical engineer's bag. It's ironic that sometimes you have to use an old-fashioned, well-understood, no-nonsense component–such as a relay–to overcome the idiosyncrasies and confusion of the latest, greatest, fully programmable, software-based products. But I works, it works well, and it won't give me any trouble (I hope!). ☤