Electronic Design

Simple Circuit Creates Magnetic-Card Lock

This is a simple but interesting circuit to make a magnetic card lock. Using this lock system, shown in the figure, you can open a door, switch on a machine, start a process, etc., all by merely swiping a magnetic card.

The first step is to close jumper JP1 and swipe a suitable card through the reader. If the read operation is successful (the LED connected to the RA2 pin switches on for about two seconds), it will save the card information in EEPROM memory. Then, jumper JP1 is removed, leaving the system in a “read” state.

Once configured, when a card is swiped, the system will check first if the card is correct (first character found, no parity error, etc.). If it’s also the previously saved card, a pulse will be generated on the corresponding output for about two seconds. If the magnetic card isn’t correct, it will indicate the error detected (parity error, control character error, missed start character, etc.).

The only “special” device needed to build this circuit is a manual magneticcard reader—the type used with standard credit cards. For this development, an LCC LM300 manual magnetic-card reader was used for ISO 2 strips conforming to ISO 7810, 7811, and 7812 specifications. It is important to carefully verify the manual reader pin assignments because they are sometimes in a different order.

At the core of the system lies the Microchip PIC16F84 microcontroller. This device has a 64-byte EEPROM in which the desired card information is saved. It also has a timer that’s used as a time-out function to detect the case of an incomplete read operation.

After sliding a card through the reader, the microcontroller’s outputs are set to a high or low level, depending on the result of the operation (Table 1). Acceptable magnetic cards contain the data represented in Table 2.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.