Monday, January 17, 2011

Snowboarding Hip Replacement

Access Controller

In our previous paper, we have discussed the theoretical aspects of magnetic cards. Here, we propose a practical implementation: a drive to self-learning only activated if the user has authorized a magnetic card. This achievement can be used as a safety lock but, as locks for activation system and facilities of all types.


In the last issue we have analyzed the theoretical viewpoint, the operation of magnetic cards.
In the pages that follow, we will extend some aspects of this technique and most importantly, we present an interesting project and easily achievable, even by a novice.

Our achievement
It is a compact card reader, able to learn and memorize the burned data on magnetic tape, and a second time to activate a relay where - in Reading - card code coincides with one of the stored codes.
The circuit has been specially created for controlling the activation of an electric lock or, in general, any electrical appliance with a properly coded magnetic card. Our menu has as input a signal from a badge reader and as a relay output. All the logic of control is entrusted to a single, integrated package to the precision of a microcontroller ST6260 SGS-Thomson. We chose this microcontroller for two main reasons: the availability of an internal EEPROM memory and the small size of the chip (2 x 10-pin), allowing the realization of a compact map.
Among the main characteristics of the circuit, we cite the high safety of the coding used (1000000 combinations), and the ability to store in EEPROM microcontroller, the codes for multiple cards to a maximum of ten.
To better understand how it works, we can divide our system into four "elements" fundamental that we will analyze individually.
The first element of the circuit is, of course, the magnetic card.
This represents the true activation unit since it contains permanently stored on magnetic tape, the activation code.
The second element consists of the player to scroll strip, that is to say by a commercial (not to construire) et qui transforme le code, disponible sous forme de signal analogique sur la carte, en un code digital.
Le troisième élément est constitué du circuit de contrôle, dont les schémas électrique et pratique sont donnés dans cet article. Le circuit électronique réalise une double fonction : en phase de programmation, il apprend et mémorise le code provenant de la carte, tandis qu’en fonctionnement normal, il compare le code de la carte avec ceux stockés en mémoire et, éventuellement, agit sur le relais.
Le quatrième élément (immatériel) est représenté par le logiciel présent à l’intérieur du microcontrôleur.

Figure 1: Flowchart of the microcontroller.

The microcontroller, after initializing its input and output lines between the "main program" and it runs continuously two tests: the reading of the CLS signal and that of the state of the DIP 2. If this switch is ON, the microcontroller cancels the EEPROM. If the CLS line up at logic 0, the microcontroller leaves the main program and executes the routine of reading the map. As we begin to scroll through the badge on the read head, the reader is a series of synchronization bits. When the Start Sentinel character is detected, the five characters are read and stored in RAM. The operation is repeated nine times. The play ends when the End Sentinel character is detected and when the Card Load Signal returns to "1". This phase also completed, the microcontroller must check the accuracy of the code installed and, if the test proves positive, monitor the status of switch 1. If it is set to ON, the microcontroller stores the card code in the EEPROM, while if the switch 1 is OFF, it compares the code read with those already present in EEPROM. The software allows you to store in EEPROM a maximum of 10 different codes. So if the code read coincides with one of the available codes in EEPROM, the microcontroller closes the relay during the time imposed by the trimmer.

The magnetic card
proceed in order and let us immediately of the magnetic card, remembering that we are already largely occupied her in the previous issue of the journal.
In summary, the card has a magnetic strip for storing data permanently.
These are engraved on three different "Tracks" completely independent of each other and are characterized by a protocol different use. The dimensions of the map, the position of the tape, the trails and protocol writing - and thus reading data for each track - are defined by the ISO 7811 standard which comply with all major card manufacturers and to which we referred, we, too, for this project. Our application uses
however one of the three available tracks, the second to be exact.

Runway ISO 2
This track, called also ABA (American Bankers Association), is characterized by a density of 29.5 bits / cm and can contain a maximum of 40 characters. On the ISO track 2, each character is represented by all five binary characters: the first four distinguished by the symbols "b1" to "b4", express the character itself, while the latter is defined by the symbol "p" represents the parity test of character as indicated in Table 1. Note that 01011 is the Start Sentinel, that is to say the character that precedes the area containing the data, while 11,111 coincides with the End Sentinel character that is used to indicate the end of this same area.
The ISO track 2 does store the decimal numbers (0 through 9) since the remaining characters (A through F in hexadecimal) are used as control characters. The fifth character indicates whether the parity is odd or even taking the logic level 1 if the sum of the most significant character is an even number, or logic level 0 if the result of the sum is an odd number. In our application, we use only eleven of forty characters can be stored on the ISO track 2, so as to memorize within the EEPROM of the circuit at least a dozen codes.
As we shall see better later, with the type of coding used we reach 1000000 combinations, more than enough to guarantee a high level of security to the system!
Once understood the mode of magnetic cards, we turn now to the second element of the device, ie the magnetic reader.

Player to strip running
For our application, we used a player trade produced by KDE: the single-runway model type KDR 1121. This model has a magnetic head and a special circuit for amplifying and decoding capable of reading data from the ISO track 2 of the badges and turn them into digital pulses.
The drive in question is connected to the outside world to son through five different colors.
- The red and black wire are for food for which we must apply a stabilized voltage of 5 volts polarity: positive and negative to red (ground) to black.
- The brown wire is called the output (CLS Card Loading Signal) on this thread is present a voltage of 5 volts during normal operation, potential which drops to 0 during the transition from the badge on the head.
- The yellow wire and orange wire correspond respectively to the outputs RCL (Read Clock) and RDP (Read Data Pulse).
By feeding the reader and scrolling badge on the read head, we see the signal RCL through the logic high (5 volts) to 0 (ground), as many times as there are bits stored on tape. In practice, the RCL is the rate of output pulse of the reader and takes a logical value (0) when there is a bit on the map. The PDR signal is the data: the trailing edge of RCL, we must simultaneously read the signal RDP to whether the character is stored one (1) or (0). If the RDP is at logic low, it means that the read bit is a '1 'and Conversely, if the PDR is at high state, the read bit is "0". Now to the third element of our reading device, that is to say to the map of the microcontroller.

Table 1.

A programmer / multi-player society KDE.

Readers monotrack KDE. Note the reading head visible in the center.

The setup proposed in this article uses as a main component card reader produced by the Company KDE and which we reproduce here the main features:
- Reading Standard ISO 7811.
- Track work ISO 2 (ABA).
- Reading Method F2F (FM).
- 5 volt DC power supply.
- Absorption maximum of 10 mA.
- Read speed of 10-120 cm / sec.
- Lifetime of the playhead over 300,000 readings.
- Operating Temperature 0 to 50 ° C.
- Dimensions 30 x 99 mm (height 29 mm).
- Weight 45 grams.

The wiring diagram
As can be seen by looking at the wiring diagram, the circuit was reduced to its simplest form! All
stands on a single integrated circuit, a ST6260 designated by U2 in the schematic. To function, the microcontroller U2 needs a voltage of 5 volts between pins 9 (Vdd) and 10 (Vss), a crystal between pins 14 and 15, and a network of R / C (R2 / C6) on the spindle 16 to reset. The two LEDs LD1 and LD2 green color red, are controlled directly (without the interposition of a transistor) by a pin (PB0) and 2 (PB1) of the microcontroller.
The relay RL1 is controlled through the transistor T1, via pin 4 (PB2) of U2. The trimmer R1 sets the relay activation time: 0.5 seconds to a maximum of 30. Cursor R1 is directly connected to pin 8 (PA0) of the microcontroller is used as analog to digital converter to read the voltage value of the trimmer. Switches, DIP 1 and DIP 2 are respectively connected to pins 19 (PC3) and 20 (PC2) of integrated circuit U2. The three outputs of the player to scroll strips are connected directly to three pins on the microcontroller. For accuracy, the CLS will signal to pin 13, the RCL is connected to Pin 12 and RDP is connected to pin 11. The card must be powered by a DC voltage of about 12 volts which is then applied to the relay RL1 and the regulator U1. The diode D1 protects the card against possible reversals of polarity, while the capacitors C3, C4 and C5 are used to smooth the voltage downstream of U1 to 5 volts. Analysis of the wiring diagram is completed, now give a look to the software (cod.MF67) used in our application.

Figure 2: Diagram of access control card system.

Figure 3: Drawing of a printed circuit scale.

Figure 4: Components layout.

Iist
R1: 10 kW horizontal PCB mount trimmer
R2: R3 100 kΩ
: 1 kilohm
R4: 1 kilohm
R5 R6
22 kW: 22 kW
C1: 470 uF 16 V
electrolytic C2: 100 nF multilayer
C3 100 uF 16 V electrolytic
C4: 100 nF multilayer
C5: 100 uF 16 V electrolytic
C6: 1 uF 16 V electrolytic
C7: 22 pF ceramic
D1: 1N4002 diode D2
: Diode 1N4148
D3: 1N4002 diode
LD1: 5mm Red LED
LD2: LED 5 mm green
U1: U2
7805 integrated circuit: Microcontroller ST62T60
T1: BC547B transistor
DIP1, DIP2 DIP switch RL1
: Relay 12 V 1 circuit
Q1: 6 MHz quartz

Miscellaneous:
IC Sockets 2 x 10 pin PCB
ref. GO17
Terminal 2 Terminal 3 slots slots



Views circuit mounted.

software
Let us refer to the diagram in Figure 1. The microcontroller, after initializing its own lines of inputs and outputs, enters the main program "main program" where he continually runs two tests: the first is to read the signal from the CLS-scrolling tape drive, while the second concerns the state of the DIP 2. If this switch is placed in position, the microcontroller cancels the EEPROM. If the CLS line up at logic 0, the microcontroller leaves the main program and executes the routine of reading the map. When one starts to scroll the map on the read head, the drive track is a series of bits of synchronicity that are then interpreted and available on the output lines RCL and RDP. The synchronization bits, even if available, are of use to own internal decoder of the player to scroll strips, and that's why the software should ignore them, or better yet, read the various bits initial until it finds a sequence of characters equal to "11010" which coincides with the Start Sentinel. If it is found, the software must read the following five characters, and store them in RAM and repeat 9 times.
So, in summary, the program reads and stores 9 characters ISO2 format.
At this point, it must wait until the End Sentinel character that the output of the zone map reading head to the Card Load Signal must become significant.
must now prepare to extrapolate the data stored in each character read from the corresponding figure, while controlling the accuracy of the parity bit.
The other phase is complete, our microcontroller will contain, in a specific area of RAM, a 9 decimals, including the first three indicate the code installed and the other six represent the code stored on the card.
The microcontroller must check the accuracy code installed and if the test result is positive, check the switch position 1. If it is set to ON, the microcontroller stores the card code in the EEPROM, while if the switch 1 is OFF, it compares the code read with those already present in the EEPROM. The software can be stored in EEPROM a maximum of 10 different codes.
So if the code read coincides with one of the available codes in EEPROM, the microcontroller closes the relay during the time imposed by the trimmer.
Thus, the analysis software is also complete, it remains for us to take care of the practical card.

Directed assembly
In this context, we must first realize the PCB using the photo of the artwork given in Figure 4. By helping us in the board layout in Figure 3, we first insert and solder the various components on the board in ensuring the polarity of the polarizing elements such as diodes, capacitors and chemical regulator U1.
For the integrated circuit U2, it is advisable to use a support 20-pin. We then weld on the slots, a 5-pin male connector for receiving female connector scrollable tape drive and then insert the connector in place of the drive output polarity: the red wire should be connected to the pin marked "+". With a piece of cable with three conductors, two LEDs will link the three locations on the map marked "K1", "K2" and "A". Mounting
conclude, we can conduct an initial test. To this end, we will connect a 12 volt DC power supply (maximum current of 100 mA) to terminals "+" and "-" assembly. After a few seconds, if everything works properly, both LEDs will switched on simultaneously for about 1 second. They thus indicate the end of the initialization of the microcontroller and will know if it is operational or not.
We will place the switch 2 to ON for a moment to cancel the EEPROM U2. We provide one or more cards are properly planned and put switch 1 ON. It will scroll the map in the drive slot provided for this purpose: at the end of each passage, the red LED should light for about 1 second to indicate the correct code storage.
remember that this device can store up to ten different codes. After memorizing all possible maps, if we go into the drive one or more additional magnetic cards encoded differently, the codes would occupy the tenth area by erasing, of course, the code previously recorded. We now replace
DIP 1 in the off position, that is to say OFF, and it returns the cards or on the read head of the reader. Hopefully, the cards whose code has been stored in the first cause the closure of the relay and the simultaneous lighting of the green. The programming phase is now complete and the codes of the cards are stored so Standing in the microcontroller.

Installation
Generally, if the card reader can be placed in unprotected area, it is preferable to place the control card in a protected area. Suppose, for example, we use this circuit to unlock the electric lock of the door of the house. The reader can be installed outside the home (in a non-protected), however, enough in a place sheltered from the weather and humidity.
The son bonding through the walls of the house to reach the protected area (inside the house) will be installed where the electronic control board.

What cards use?
The reading system used in this embodiment conforms to the standard ISO 7811.
In our case, use only the second track, called ABA (American Bankers Association). The application states that this track is stored on a "word" consisting of 11 characters each using 5 bits. The first and last character delimit the zone data and should coincide with the character Start Sentinel and End Sentinel character with respect to the ISO protocol 2. The three characters stored after the Start Sentinel show the "system code" that our system is equal to the decimal number "101". The following six characters represent the actual code of the card, that is to say they express the decimal number from 000000 to 999999, which is stored inside the microcontroller.

Finally
The circuit proposed in these pages can have many applications, limited only to the reader's imagination. In all cases, to obtain proper operation of the circuit in all situations, it is advisable to follow a few rules that we can be summarized as follows:
- the reader to scroll strips, if placed outdoors must be protected from the weather because it is not waterproof,
- magnetic card must not be folded or placed near strong electromagnetic fields,
- the son of connection between the reader and the card must not exceed a length of two meters.
In the coming months, we will try to present other projects using magnetic cards.
We expect about the proposals and suggestions from readers by putting us now at available for making such circuits, provided they are of general interest.

0 comments:

Post a Comment