Sunday, February 22, 2015

@MAKE Electronics Experiment 20: Keypad Security System (Part II)

I soldered the header onto the keypad, and used F/M jumper wires to connect it to the circuit on the breadboard.

I got the circuit to work, with one exception:  The 555 timer is not putting out enough power to trip the relay,  I can trip the relay manually by touching the row in the breadboard connected to the relay (I verified this with the continuity function of my meter).

The LED connected to the timer stays on for about 1 second after the correct code is entered, as described in the book.  The # key resets the relay.

I see from the interwebs that others have had problems with this. One solution is to use a transistor between the output pin of the 55e and the relay (2N2222 transistor, output pin to base, collector to 150 ohm resistor and Vcc, emitter to LED and relay).  This did not work for me.  There is at least one video with it working without a transistor (but a different relay).  Here's another with the transistor.

I'm not sure where to go with this now.  More thinking.

This blog has a discussion, including the solutions I tried. Nothing seems to work for me.  It may have to do with the relay. Mine works, just not in this circuit. All the videos of ones that work use a different relay.

Wednesday, February 18, 2015

@MAKE Electronics Experiment 20: Keypad Security System (Part I)

Experiment 20 builds on the logic chip exercise in #19 to build a keypad security system. The full experiment ends with hacking into a computer's power button and cutting a hole in the case to attach the keypad.  I have several carcasses around that I can use for that, but I think rather than dedicating the system to a computer I don't use I will do the experiment with the case open.  I will go as far as cutting the power lines and fixing them to the relay.

That's getting a little ahead of where I am. Here's the project:

Use a 12-button keypad (like a telephone) with 14 contacts (1 for power, 1 for each of the 12 buttons, and 1 dummy) to enter a 3-digit security code in order to be able to power on a computer. The circuit is connected to the power-on button in the computer, which therefore won't work unless the code has been entered.

The contacts for the 3 digits used for the code are connected to 3 of the 4 AND gates in a 74HC08:
  • Gate1 input1 is connected to digit 1 of the code, a 10K pull-down resistor, and GND. Input2 is connected to the input of Gate1 of the 74HC04 inverter, a 10K pull-down resistor, and GND.
    The output is connected to input2 of AND Gate2, and also through a diode back to Gate1 input1.
    So, Gate 1 input 2 is always HIGH, since the inverter input is always LOW.  When the digit is pressed, input1 goes HIGH and stays there due to the diode for latching (see experiment 19). H/H ANDS to H, so input 2 of Gate 2 is H only when digit1 has been pressed.
  • Gate2 input1 is connected in the exact same configuration as Gate1:  10K resistor and GND, also a diode and gate2 output.  Thus, if digit1 has been pushed, input2 is H and if digit 2 is then pushed input1 is H, making output H and latching there.
    Output2 goes to Gate3 input 2 as well as back through the latch.
  • Gate 3 input 1 is connected to a pull-down resistor and GND and to digit3 (no latch). So only if the first two digits have been entered successfully, input 2 is H, and when digit3 is pressed the output3 is H.
    Output3 (Gate3 output) goes to Inverter Gate2 input.
    Inverter Gate2 output goes to pin2 (trigger) of a 555 timer.  H output of AND Gate3 is inverted to L, triggering the timer.
The circuit then functions after the 3 digits are connected in sequence:
  • 555 pin3 (output) is connected to an LED==>10K resistor==>GND and also to the upper coil of the latching relay
  • So, when the 555 is triggered, the positive pulse flashes the LED and activates the relay, completing the power circuit inside the computer and allowing the computer to be powered on.
Two other keys of the keypad (* and #) are also in use:
  • The * key powers on the circuit, while it is held down.  I connects to an LED/resistor/GND to show that power is on, and to the power pins of the ICs (pin 14 of the logic chips, pint 8 of the 555). It also connects through a 100K resistor to pin 7 (discharge pin) of the 555. 
  • The # key connects to the lower coil on the relay, as well as to an LED/Resistor/GND.  So when the button is pushed, the LED lights, and the relay unlatches, disabling the power on the computer
  • So, to start the process, press the * key and hold it while entering the 3 digit code, in sequence.  LED1 is on while the key is held.  LED 2 flashes when the relay is activated.  The * key can then be released, and the computer can be powered on.  After  the computer is powered down, the # key deactivates the relay and it can not be turrned back on again until the code is reentered.
The 555 serves to send a pulse to activate the relay.  In addition to the connections already discussed, pin 8 connects to pin 4 (reset), to keep it H while the * button is held.  Pin 7  also connects to pin 6 (threshold), Pin 6 also connects to a 10uf capacitor and GND. Pin 5 (control, connects to a .1uf capactor and GND). Pin 3 (output) connects to an LED/resistor/GND in addition to the upper coil on the latch, so it flashes the LED when the 555 is triggered.

Here's the schematic from figure 4-84 on p. 201 of the book:


Here's what I've done on the breadboard so far (a little messy):


I'll post another when I' closer, but it represents the schematic less the keypad.

For the keypad, I'm considering soldering a set of header pins, so I can either stick it directly in the breadboard or use F/M jumper wires as depicted below.  The top wire is power, The others are randomly connected for now, but they will go to the pads assigned to numbers as discussed above. Other options are to solder wires directly to the pads or to use female headers. 


More when I get to soldering.



Saturday, February 14, 2015

Friday, February 13, 2015

Happy Valentine's Day

I've been fascinated by electroluminescent wire (EL wire) for a while. I just needed a project in which to include it.   I got the idea for heart-shaped glasses for Valentine's Day and that seemed like the perfect fit.

I bought the Adafruit EL Wire starter pack in red and I was off and running.

I convinced myself that I needed 2 sections of EL Wire, 1 for each heart, but I wised up and did it with just one. The challenge was the crafty part (cutting hearts, sewing, the hearts to the cardboard, etc.

My original plan was to hot glue the hearts to some old glasses, but I found out that they work fine as an overlay to my regular glasses.


This was fun to do. I'll use EL wire again.  Here's the video.

Friday, February 6, 2015

@MAKE Electronics Experiment 19 - logic chips (Part V)-Finally got my AND chips--more latching

My first post on this experiment said that there isn't much too it.  I was wrong.  Because, to paraphrase Donald Rumsfield, I had to experiment with the ICs I had not the ICs I wanted, I wound up learning a whole lot.  Of course, that is Charles' intent and this book is great. My 74HC08 AND chips arrived, so in this post I will recap what the chapter showed and add a little more about latching,

There is a lot more detail in the chapter on various logic chips and their associated truth tables, and that's very useful.

First step was to do some schematics. I did one for the last exercise in the chapter--latching with an single AND:

My Eagle Cad Rendition of Charles Figure 4-79, p. 196

The right side is the power supply, as described in Part I (Vcc is regulated 5V). The left side is a self-latching AND gate:

  • Input 1 is connected to Vcc, so it is always H
  • Input 2 is connected to S1.  When we press S1, Pin 2 is H. H/H ANDs to H, so the LED lights.
  • Without the other connections, the LED would only stay lit as long as the button is pushed. When we let go the pin goes back to L, L/H ANDs to L, and the LED turns off.
  • By connecting the output on pin 3 back to the input on pin 2, we keep pin 2 H. The diode blocks any current from S1 from going to the output.
Once we push the button the light stays on, forever--or at least until we disconnect the power. We might want to include another button to turn it off. We could do that by putting a toggle, or perhaps a normally closed pusbutton between Vcc and pin 1. That way, when the toggle is off or the button is pushed, pin 1 would go L, making the output L, and the latch would keep it there (or that's my theory). The toggle is not a great option, because when it's open essentially  pin 1 would be floating. Charles says that's not a good idea. I've seen examples where pins are left floating, but I trust Charles. It's kind of like coding an IF construct in any programming language: if you don't deal with all options you may get intermittent strange results. I cover a couple of options to accomplish this in the accompanying video.

Given what I just learned about latching, how about if we add a NAND gate and make one of it's inputs the output on pin3?  If we connect the other NAND input to S2, than that input would be L unless the button id pushed.  Since only H/H NANDs to L, the NAND output would be H until both the LED is lit (AND output on pin 3 H) and the S2 is pushed. So, we could make the output of the NAND gate input 1 to the AND gate.
  • The AND part of the circuit works as before. The only difference is that pin 1 is connected to NAND output instead of to Vcc. Pin 1 is H unless we make it L.
  • NAND output is H on power up (S2 open), so AND pin 1 is H.
  • We push S1, pin 2 goes H, the output is H, the LED lights and stays lit. 
  • When we push S2, NAND input 2 is H, making NAND output L (H/H-->L), making AND pin 1 L, making AND output L, turning  LED1 off and keeping it that way, but LED2 stays off only momentarily.
Here's the schematic (I omitted the 7805, etc., to reduce clutter):



I never would have thought to try any of this if my eBay supplier had delivered the AND chips sooner. I am a lucky man.

See the video.





Sunday, February 1, 2015

@MAKE Electronics Experiment 19 - logic chips (Part IV)-Latching with a NAND

Moving on with logic chips, I figured out that I could also latch my gates with the NAND chip, using the "Active-low circuit: Both inputs are normally HIGH, and the latch is triggered by a momentary LOW signal on either input" (same Electronics for Dummies reference as yesterday).

Since I wanted to use set and reset buttons, I needed to provide normally high inputs to the latching circuit.  I did that with the other two gates on the 74HC00 chip. Since NAND output is L only when both inputs are H, I was able to provide one H input from each Gates C & D by connecting one input to Vcc and the other to a momentary pushbutton. Each pushbuton is connected to Vcc on one side and the input to C or D as well as a 10K resistor and GND on the other side.Therefore, the outputs of C & D are H unless the corresponding button is pushed, in which case that input is H, paired with other H input, so the output is L.

On the other side of the chip, I moved the LED circuit to gate B.  The output of gate B goes to the LED and on to a 1K resistor and GND.  That output also goes to input 1 of gate A. Input 1 of gate B is output of  C and input B2 is the output of A. Input A1  is the output of B as just described and input A2 is the output of Gate D. Here's the schematic:
Make:Electronics Experiment 19 Part IV - Latching with NAND

On power up, this LED is lit,  I did not expect that, but here's what I think is happening:

  • Pin 8 is H (see above), so Pin 4 is H.  There is not enough current in the circuit to make pin 5 H, so pint 6 NANDs to H, lighting the LED and making pin 2 H, Pins 2 and 3 (H for the same reason as pin 4), NAND to L, so pin 5 is L and the LED stays lit.  
  • Press S2 and pins 11 and 1 go L. Pin 2 is still H, so 1&2 NAND to H, making 5 H, which NANDs with pin 4 (H), to make pin 6 L, turning the LED off and latching pin 2 to L to keep it off.  
  • Press S1, Pins 8&4 go L, and since 5 is H they NAND to H on pin 6, turning the LED on and latching pin 2 to H to keep it on.


And so on. Here's the video.