Download Shocking

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Ohm's law wikipedia , lookup

Spark-gap transmitter wikipedia , lookup

Power over Ethernet wikipedia , lookup

Audio power wikipedia , lookup

Electric power system wikipedia , lookup

Pulse-width modulation wikipedia , lookup

Electrical ballast wikipedia , lookup

Ground (electricity) wikipedia , lookup

Transformer wikipedia , lookup

Variable-frequency drive wikipedia , lookup

Current source wikipedia , lookup

Power engineering wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Three-phase electric power wikipedia , lookup

Islanding wikipedia , lookup

Power inverter wikipedia , lookup

Triode wikipedia , lookup

Amtrak's 25 Hz traction power system wikipedia , lookup

Regenerative circuit wikipedia , lookup

Power MOSFET wikipedia , lookup

Distribution management system wikipedia , lookup

Earthing system wikipedia , lookup

History of electric power transmission wikipedia , lookup

Transformer types wikipedia , lookup

Stray voltage wikipedia , lookup

Surge protector wikipedia , lookup

Power electronics wikipedia , lookup

Electrical substation wikipedia , lookup

Voltage regulator wikipedia , lookup

Schmitt trigger wikipedia , lookup

Rectifier wikipedia , lookup

Opto-isolator wikipedia , lookup

Alternating current wikipedia , lookup

AC adapter wikipedia , lookup

Buck converter wikipedia , lookup

Voltage optimisation wikipedia , lookup

Mains electricity wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Transcript
Shocking Security System
By
Cato Yang
Neal Craig
ECE 345, SENIOR DESIGN PROJECT
Spring 2003
TA: Chirantan Mukhopadhyay
May 5, 2003
Project No. 6
i
ABSTRACT
The purpose of our Shocking Security System is to provide a deterrent for those attempting unauthorized
entry to a secure door. A non-lethal electric shock will be delivered through the door handle to anyone
attempting to open the door while it is in the locked and armed state. A keypad will serve as the user
interface to the system, allowing the user to lock/unlock, arm/disarm, and change the password to the
door. We sought to design our own variable voltage shocking circuit, and use the HC12 microcontroller
to control the entire project. This paper will outline our efforts in design, implementation, and testing
throughout the engineering process.
ii
TABLE OF CONTENTS
1. INTRODUCTION ..................................................................................... 1
1.1 Design Goals and Features.....................................................................1
1.2 Block Diagram .......................................................................................1
1.2.1 Line Input 120VAC ......................................................................2
1.2.2 Power Supply 5VDC.....................................................................2
1.2.3 High Voltage Power Supply .........................................................2
1.2.4 Solenoid ........................................................................................2
1.2.5 DC Amplifier Circuit ....................................................................2
1.2.6 Triacs.............................................................................................2
1.2.7 Door Latch Switch ........................................................................2
1.2.8 Door Handle ..................................................................................2
1.2.9 HC12 Microcontroller ...................................................................2
1.2.10 Keypad ........................................................................................2
1.3 Performance Specifications ...................................................................3
2. DESIGN PROCEDURE ..............................................................................4
2.1 Amplifier Circuit ....................................................................................4
2.2 High Voltage Power Supply ..................................................................4
2.3 Locking Mechanism...............................................................................4
2.4 Switching ...............................................................................................4
2.5 Keypad ...................................................................................................5
2.6 HC12 Microcontroller ............................................................................5
3. DESIGN DETAILS ................................................................................... 6
3.1 Amplifying Circuit .................................................................................6
3.2 High Voltage Power Supply ..................................................................7
3.3 Switching ...............................................................................................7
3.4 Keypad ...................................................................................................8
3.5 HC12 Microcontroller ............................................................................9
4. DESIGN VERIFICATION ...................................................................... 10
4.1 Testing Hardware .................................................................................10
4.2 Testing Software ..................................................................................10
5. COST ....................................................................................................... 11
5.1 Labor ....................................................................................................11
5.2 Parts......................................................................................................11
6. CONCLUSIONS........................................................................................12
References ..................................................................................................13
iii
1. INTRODUCTION
1.1 Design Goals and Features
This device will act as an alternative to a security alarm by delivering a shock. It will act like an electric
fence and a non-lethal dose of electricity will be sent through a doorknob or other point of entry to deter
any intruder. Our project will focus on protecting standard doors. The shocking device can be activated
or deactivated using a keypad. Once armed, the door will deliver a shock if the door handle is turned. A
shocking circuit and power supply will be developed that will vary the voltage up to 1000VDC for easy
measurement in the lab. The locking mechanism for the door will be accomplished through the use of a
pull type solenoid. The HC12 microcontroller will be used to control the project by taking the keypad
inputs, and outputting the correct control signals. Proper amounts of electricity will be researched as to
not cause serious harm to an intruder.

Programmable password for increased security

Deter unauthorized entry into building or room

Warning LED’s for door states: Armed/Disarmed, Locked/Unlocked, and Shocking

Variable shock voltage

Will not shock intruder until doorknob is turned
1.2 Block Diagram
1
1.2.1 120VAC Line Input
The 120VAC line input is a 60Hz standard input from the wall outlet to supply power to the entire
circuit.
1.2.2 5VDC Power Supply
This power supply powers the HC12 and the keypad circuit.
1.2.3 High Voltage Power Supply
The high voltage power supply offered 12VDC for the DC amplifying circuit as well as a variable
voltage. The variable voltage ranged from 0V to 19V.
1.2.4 Solenoid
The solenoid acted as the electrical to mechanical coupling to convert the signal to lock the door into a
deadbolt device.
1.2.5 DC Amplifier Circuit
The DC amplifier consisted of a flyback transformer with some circuitry. It was powered by the
constant 12VDC supply and then amplified the input voltage that ranged from 0V to 19V, outputting
between 0VDC and 1000VDC.
1.2.6 Triacs
The triac is essentially an electronic controlled switch. An AC version was used to operate the solenoid
while a DC triac was used to turn on the DC amplifier circuit.
1.2.7 Door Latch Switch
A mechanical pushbutton switch was mounted inside the door frame. When the door was closed the
door latch depressed the switch and the DC amplifier circuit was open. If the door knob was turned the
switch would cause the circuit to be closed and functional, if the triac were armed.
1.2.8 Door Handle
Ultimately the door handle was electrified with the amplified voltage if the triac was switched on and
the door handle was turned, closing the circuit. This is equivalent to grabbing onto the wire of an
electric fence.
1.2.9 HC12 Microcontroller
Takes inputs from the keypad, and sends shock and lock signals to the rest of the circuit and the
indicator LED’s. It controls the states of the project.
1.2.10 Keypad
16-Key keypad serves as the user interface to the system. Takes the pass code, and allows the user to
lock/unlock, arm/disarm, and change the password.
2
1.3 Performance Specifications
For our design, the key performance specification was the shocking circuit. We required a variable DC
voltage source to power the shocking circuit. Our power supply, converted the 120VAC wall source to
DC voltages that were amplified. We desired a DC voltage of around 1000VDC to provide an adequate
deterrent shock, and also be easily measurable in the lab. Also, it was necessary for the microcontroller
to behave as designed, and send out the proper control signals to the rest of the system. The
microcontroller must read the correct keypad press, take the correct pass code, and reject incorrect pass
code entries. Once the correct code was entered, the microcontroller must update the states, or change
the password as instructed by the user via the keypad.
3
2. DESIGN PROCEDURE
2.1 Amplifier Circuit
The backbone of the DC amplifier was the flyback transformer. Flyback transformers are used in
computer monitors and televisions, so instead of buying a new one I parted an old monitor. There were
three inputs among 8 that had to be determined before the transformer could be used; the output was
obvious, it had a large suction cup attached to it. The flyback transformer would not amplify DC
voltage directly, so I had to create an alternating current from my set 12VDC. This was accomplished
with a timer and other suggested circuitry for flyback transformer set-ups.
2.2 High Voltage Power Supply
It was necessary per the requirements of the flyback transformer to design a power supply with multiple
outputs. We started the power supply with a 25.2V CT 3A step down transformer. This transformer
accepted the 120VAC 60Hz from the wall. After being rectified with a full-wave rectifier we separated
the design into two sections. The circuitry that powered one end of the transformer needed 12VDC.
This was easy to construct because these power supplies were actually constructed in ECE 343, a
previous course at the university. Additionally, I needed a variable voltage power source. For this I
simply used a resistor to get the maximum voltage I needed, 19VDC, and then added a potentiometer in
series to drop the voltage down to achieve 0VDC.
We felt ambitious at one juncture and tried to combine all three power supplies into one. Namely, both
for the shocking circuit and also the 5V supply for the microcontroller and its circuit. Unfortunately, the
second to last day showed us that one power supply could support the load of both the amplifying circuit
and the control circuit, so we were forced to abandon this extra goal.
2.3 Locking Mechanism
The physical locking of the door is necessary for any security system. We decided that a solenoid
mounted on the stud inside the wall would be a good way to electronically control the locking of the
door. We were given the task of converting a pull-type solenoid into a deadbolt. We accomplished this
task by developing a steel L- bracket that attached to the solenoid. The solenoid was then mounted
backwards facing away from the door with the long end of the L- bracket pointing towards the door.
Thus, when the solenoid (accepting 120VAC straight from the wall) was turned on, the L-bracket, now
the deadbolt, would go through the door frame and into the door, locking it.
2.4 Switching
An interface between the electronic microcontroller and shocking circuit and the mechanical solenoid
and door knob movement had to be developed. Firstly, we mounted a switch inside the door frame. The
pushbutton of this switch was depressed when the door was closed by the door latch. The switch, in this
state, caused and open circuit and the Amplifying Circuit was off. When the door knob was turned the
latch would be moved and the switch would close the circuit. Now, the state of the amplifying circuit
rested on the microcontrollers command. If the user had armed the security system, the microcontroller
would send a voltage of 5V to the triac that was in series with the mechanical switch previously
mentioned. As a result, the triac, an electrical switch, would cause a closed circuit. Hence, if the circuit
is armed and the knob is turned, the amplifying circuit is on and the doorknob is supplied with the set
voltage.
4
The user could also only lock the door. When the lock command was entered into the microcontroller, a
5V signal would be sent to the triac of the locking circuit. This triac, however, allowed AC current to
flow through it, so we simply had to cut the power cord for the solenoid and add it in directly.
2.5 Keypad
We used a 16-key keypad for our design along with the 16-key encoder. This was adequate for our
design to enter a four digit pass code, and give the user 3 options: lock/unlock, arm/disarm, and change
the password.
2.6 HC12 Microcontroller
We decided to use the HC12 microcontroller because of its versatility, portability, and abundance of
support material that was easily found on the course webpage. We did not have much experience
programming the HC12 or coding in Assembly language, but were confident that the microcontroller
would suit our needs, and given time, we would be able to have a reliable program to control our project.
The program for our project seemed fairly simple at first glance, basically, the microcontroller was to
take the keypad inputs, compare them to the pass code stored in memory, and then perform the
appropriate task. When the correct pass code was inputted, the program would wait for the user to press
a button corresponding to either lock/unlock, arm/disarm, or pass code change.
5
3. DESIGN DETAILS
3.1 Amplifying Circuit
The pin layout on the transformer we recovered from the computer monitor had to be found. Since there
was no part number on the case of the transformer, we had to do some tests. The ground terminal was
easily found by attaching a 24 V DC power supply and a digital voltmeter set in 20 V range. We
connected the positive input of our voltmeter to the output wire and the ground to the 0V of our power
supply. Then, with the +24V output from our power supply, we tested each input pin of the flyback
transformer. When we measured a voltage of 8V, we knew we had found the ground pin of the flyback.
To find the inputs to the coils we simply had to test the resistance of all combinations between two of
the remaining input pins. The ohmmeter read infinite resistance for all combinations except that of the
coil inputs, which read approximately .8 ohms.
Layout to find ground terminal
Layout to find coil inputs
The flyback transformer needed a pulsed current into one of its coil inputs. We found information
describing the behavior of flyback transformers and suggested circuit layouts. Combining these
suggestions with out own knowledge of circuit we found an optimal circuit for our project.
6
3.2 High Voltage Power Supply
The power supply incorporated the design of three into one. The 12V supply used the zener diode
design that we learned in previous classes. This had a very low ripple that was necessary for the control
circuit of the flyback transformer. The 5V supply attempt used a voltage regulator with capacitors. This
circuit was not completely tested and was only a bonus at the end had it worked out as planned. Lastly,
the variable voltage section was quite basic and only used a resistor to control the voltage level. This
voltage was not required to have a low voltage ripple because it was only powering the flyback
transformer, which accepted a varying voltage just as openly as a steady voltage. Thus spending time on
the ripple was not a concern. Although in the end we did not use the 5V supply, it was already
hardwired together with the 12V and variable voltage supplies.
3.3 Switching
The triacs we used were both of AC and DC type. The triac to control the arm/disarm command was of
DC type. Its input was the variable voltage and it outputted to the switch that was mounted in the door
frame. After the switch, the voltage was allowed to continue into the DC amplifying circuit. The
lock/unlock function was controlled by an AC type triac. This triac had an input directly from the wall
outlet and an output that went to the solenoid. Both triacs took 5V for on and 0V for off inputs from the
microcontroller for control.
Arming Circuit
7
Locking Mechanism
3.4 Keypad
The keypad circuit is as follows, and was found in the data sheet for the asynchronous data entry onto
bus mode. A is the low bit and D is the high bit, and they correspondingly input into PORTA of the
microcontroller. Starting in the top left corner, a 1 key-press corresponds to a 0000 output value, a 2
key-press outputs as 0001. The remaining truth table is simple to determine. The data available bit is
important to tell the microcontroller when a key has been pressed, and is bit four of PORTA
8
3.5 HC12
The actual code used in our project can be referenced through Appendix A.
The microcontroller program was needed to check the keypad inputs against the pass code stored in
memory. To do so, the keypad data was read from PORTA, and the data available bit was checked to
make sure a button was pressed. To avoid reading the value repeatedly while the key was being held
down, the program waits for the key to be released before continuing with the rest of the code. The
input is stored and compared to the values stored in memory. When the correct pass code is entered the
program allows the user to change the state. There are three options for the user at this point:
Arm/Disarm, Lock/Unlock, or change pass code. Pressing either the A or B button on the keypad will
Arm/Disarm, or Lock/Unlock the system respectively. To do so, the code simply inverts the signals by
XORing the signal and sending it to the output at PORTB. Pressing the C button will allow the user to
change the pass code to any 4 key value. Changing the pass code is simple and accomplished by
repeatedly getting an input, and storing the pass code key.
9
4. DESIGN VERIFICATION
4.1 Testing Hardware
The High Voltage Power Supply was tested using the Voltmeters and Ammeters in the lab. The design
for the 12V supply was originally made using PSPICE in the past, so the specifications were already
known. Additionally, with specific meters with 1000VDC peak we were able to measure the voltage
output of the Amplifying Circuit. The 5V supply was made with little testing involved, but we found
that its current was too low to power to the entire microcontroller circuit while the amplifying circuit
was active. The correct operation of the shocking triac was observed using LED’s to check if either, or
both, the input or the output were high. The operation of the solenoid was easily checked by whether or
not the door locked.
4.2 Testing Software
The testing for the microcontroller and keypad was mostly trial and error; however, a few well placed
LED’s allowed us to recognize some of the problems more easily. LED’s attached to the output allowed
us to track the controller states, and whether the controller was behaving properly when we inputted the
initial code and tried to change the states. LED’s attached to the 16-key encoder allowed us to notice
that we needed to follow the asynchronous data entry circuit to get the correct inputs. Near the end of
the project we used LED’s and PORTP to track the key press that the microcontroller was storing as the
input. This was particularly helpful, because if the key press was not firm, the microcontroller
sometimes did not take the correct input. This allowed us to focus on the program itself, and not input
error at the keypad.
10
5. COST
5.1 Labor Cost:
hourly salary  actual hours spent  2.5
($32 / hr )  100  2.5  $8,000
$8,000  2 Engineers  $16,000
5.2 Parts:
Flyback Transformer
$18.00
Keypad
$1.00
HC12 Microcontroller and board
$125.00
HV Power Supply Components
$5.15
Triac Driver (x2)
$4.34
Solenoid
$7.79
Lumber for Door frame/Door knob
$45.00
Miscellaneous components (wires, LED’s,
logic chips)
$5.50
Surge Protector (x2)
$8.55
TOTAL PARTS
$ 220.33
Table 1 - Price List
Total Parts and Labor = $16,000 + $220.33 = $16,220.33
11
(6)
6. Conclusion
The High Voltage Power Supply and Amplifying Circuit worked as we originally planned. The voltage
was easily adjustable from 0VDC to 1000VDC. When the user entered the correct password and
pressed the necessary enter key- lock/unlock, arm/disarm, or change code- the microcontroller acted
correctly. The triac and switch that controlled the shocking circuit as well as the triac for the locking
device correctly accepted the control of the microcontroller and allowed the voltage to flow only when
expected.
12
References
16-Key Encoder Datasheet
www.fairchildsemi.com/ds/MM/MM74C922.pdf
EE 308, Microcontrollers, New Mexico Institute of Mining and Technology, “Lecture Notes,”
www.ee.nmt.edu/~rison/ee308_spr03/homepage.html
Amplifying Circuit/Flyback Diagrams
www.jlnlabs.org
13
14