Auffie’s Random Thoughts

Wednesday, July 01, 2009

Watchdog for asterisk: implementation (Part V)

Part V: Putting everything together

Like most projects, this one was both late and over budget. Having not soldered any electronics for a long, long time, I messed up quite badly on my first attempt. Here is the incomplete and abandoned board. I won't even show the other side of the circuit board.


Not only did I mess up the board, I also did some damage to the tip of the soldering iron. The tip was badly oxidized and eaten away. Later I found out that the combination of a high-wattage (60W) iron with a "no-clean", lead-free solder was not particularly good. This document has some informative notes on caring for the tips, and I should've read it before venturing into my own way of doing things.

Though the first attempt was abandoned, I realized that the circuit needed some modification (see Part IV). And since I am still not very skilled at soldering, perhaps it's better that I minimize the amount of soldering that I have to do. The single-pad-per-hole boards are just too troublesome to deal with. As I looked for a board that would be easier to use, I found this at Radio Shack:

This board is 1.875" by 2.875", just the right size for the number of components of my circuit (now with a regulator and a couple more capacitors). It also fits quite nicely into an electrical box, which will be covered with a two-jack faceplate (see below). I also laid out the components in such a way that the LEDs can be seen, and the connectors for the relay and pads on the telephone be fastened, by drilling holes on the box. In addition, a set of PC board standoffs proved to be useful for mounting the board inside the box.

Here is the final circuit board. The two blue connectors on the lower right corner are for the relay and for two wires that form a switch that is closed when the handset of the phone is on-hook and open when it's off-hook. This is so that the phone can be used once it's off-hook even if the watchdog timer is still active. I failed to fit the two connectors together as designed, so they were mounted on the board somewhat crookedly. Next to the connectors are the two LEDs: the green one is on the output of the 555 timer; when everything is in order, it should be on all the time. The orange LED is on the output of the 567 tone detector (also serving as its pull-up). It will be flashing at an interval programmed into the asterisk watchdog process on the Linux machine. On the left hand side is an LM7805 5V linear regulator, providing the Vcc for the two ICs.


Here is what the board looks like when it's mounted in the box:


Note that the relay is mounted on the other side of the box, with wires for the coil connected to the terminal connectors on the right. The other two wires, soldered to the normally closed terminal and the common terminal of the relay output, will be connected to the two-jack faceplate, so that when the relay switches on/off, the two jacks of the faceplate will be connected or disconnected. I needed to make sure that the polarity of the connection between the two jacks is reversed: i.e., red to green and green to red. This is because telephone line cords switch the polarity (kind of silly), and when one uses two telephone cords together in this fashion, there should be an additional polarity switch so that the total number of reversals is odd. On the top side of the box, there is a row of holes that I drilled for displaying the LEDs and for tighting the connectors' screws. I made a mistake by drilling the holes in the wrong orientation, so I ended up with extra holes. It's OK, however, as the extra holes can serve as vents.

Finally, here is the watchdog circuit in service:


To see the green LED light up, I took this picture in the dark:


I will discuss the shell script, asterisk_watchdog, in the next part.

UPDATE (2009-07-17): Getting the right polarity on phone lines can be tricky. The phone cords that come with telephones typically are of the crossover type, i.e., the polarity of the pins are reversed from one end to the other. However, there are also some cords that look and feel exactly line regular phone cords, but they are not crossover.

I didn't realize this until I used a phone line tester and tested the various jacks that I now have: the watchdog output and the two wall jacks that are driven by the asterisk FXO interface. (The phone line tester was surprisingly hard to find, not even at the local Radio Shack. I stumbled upon one at Ace Hardware; it was overpriced at $10.49, but I bought it anyway since I was in the mood of getting all my wiring right.) Much to my chagrin, the tester showed red (polarity reversed) on the watchdog output jack and one of the two wall jacks. It showed green on the other wall jack. The primary input, i.e., the jack that's directly connected to the network interface, also showed green -- that was a relief.

Interestingly, the FXO interface on the asterisk card also gave a red reading. After examining the cords carefully, I realized that I was using a patch cord for the watchdog input, a crossover cord for the wall jack that showed red, and a patch cord for the wall jack that showed green. So the solution was simple: swap the cords for the watchdog input and the first wall jack. Voila, now all jacks for the terminal devices are green!

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home