Thursday, February 4, 2010

Chapter 3 - Exercise 15

Exercise 15 starts out with a small circuit that uses a break in the circuit to trigger an LED to light up. The 2N2222 transistor is used in this circuit, and it's fairly easy to see how it works. I wired in one of my magnetic switches and, after powering up the circuit, pulling away the magnetic end of the switch causes the LED to light... moving the magnetic end back to the reed switch causes the LED to turn off. One of the videos at the end of this post shows this circuit in action.

Next, I removed the LED and 680 ohm resistor as instructed and replaced them with my 12V relay. The idea here is the same... when the magnetic switch is broken, current is allowed to flow through the transistor and triggers the relay... you can't miss it - it's a definite audible click. Pushing the magnet back to the reed switch causes the current to stop flowing and the relay turns off - another click. I've included another video at the end of this post that shows this happening.

Now, the section on Self-Locking Relays makes sense... I read through it twice and followed the circuits and I completely understand how it works... in theory. But building the circuit is another issue. There's no wiring/breadboard diagram here to reference, so I did my best and one of the photos here shows my completed circuit. The problem is that the circuit isn't working the way it's supposed to... when I pull the magnet away, I hear the relay switch on... but it's supposed to lock - if you look close, you can see that I've applied 12V to the middle set of 3 upper terminals on my relay... corresponding to the small arm that moves inside. Moving the magnet back to the reed switch isn't supposed to turn the relay off... but it does. I've got a final video where you can here the relay opening and closing as I move the magnet back and forth.

So, I'm stumped. For now. I'm sure it's something simple that I've missed, and I have a feeling it's related to the fact that there are matching sets of terminals on the relay and I'm likely not wiring one or more of them up properly. From the schematic on page 132 (Figure 3-91) you can tell that the lower two posts of the relay are supposed to be connected - the one on the left connects to the Emitter of transistor... the one on the right connects to the negative voltage. But shouldn't the middle set of terminals (for the moving arm) have it's right-side terminal also connected to the negative voltage? Look at Figure 3-95 on page 135 and you can see that there's a wire added from the middle set's right terminal to the negative voltage side.

Any ideas? My circuit is upstairs, waiting to be fixed...

UPDATE: I went back to Figure 3-91 and thought I'd found my mistake... there's a connection between the Emitter of the transistor and the ON post of the relay. I cut a small piece of wire and connected the Emitter to that post (on the left side of the relay inserted into the breadboard). Turned on the power and the relay went CRAZY. High pitched whining sound that probably isn't a "good" noise. Removing the magnet made it stop, but putting the magnet towards the reed switch caused it to go noisy again... so I'm still missing something...

UPDATE 2: Okay, I happened to glance over at Figure 3-93 and noticed that diode sitting there in the circuit. Of course, I've only read over the Blocking Bad Voltage section once - need to read it again - but I did seem to recall something in there about feedback... so I went up and added in that diode and the noise stopped! Okay, problem is partially solved. It STILL isn't working quite right - when I pull the magnet away (simulating a door opening) the relay is supposed to lock and not disengage when I put the magnet back (closing the door). But it does... argh.

UPDATE 3: Just a warning - these updates could run into the hundreds. Kidding. I went back and took a look at the relay that I tore open in an earlier chapter. It turns out that my relay is off when the arm is in the "down" position, pointing towards the coil. Easy enough - I rewired it so the top post is connected to the diode's anode side. But the relay still isn't locking as it should... something is missing from this circuit... just can't figure out what.


  1. I don't have the book, so I can't look at any of these schematics you're talking about. One way you have a relay latch on is that you have the NO (normally open) contact connect power to the coil. This means the arm of the relay is connected to power, and the contact is connected to the top of the coil (which is where it seems you have the emitter of the transistor, assuming I follow your wires correctly), so that the relay is initially powered by the transistor, but then starts to power itself. I can't tell if that's what you're trying to do, but that's how I would do it.

  2. This is an old post so I'm sure you seen this by now-
    I was having the exact same issue.