SmartCard PC Serial Reader / Writer (Phoenix) Electronic Circuit - CircuitsArchive
- pin 7=GND and pin 14=VCC of 74HC04N and 74LS04
- Pin 9 and 10 of the smartcard connector are for card presence switch.
|C9||Capacitor||27 pF 16V|
|C8||Capacitor||27 pF 16V|
|Y1||Crystal Oscillator||3.579 MHz Quartz|
|U2||+5V Powered RS-232 Driver/Receiver||MAX232|
|J1||Serial Connector||DSUB 9 PIN FEMALE|
|JP1||Smartcard Connector||ISO 7816|
|P1||2-Conductor Plug||Power Plug +9V / +12V|
|C4||Polarized Capacitor (Radial)||1 uF 16V|
|C3||Capacitor||0.1 uF 16V|
|C2||Capacitor||0.33 uF 16V|
|C5||Polarized Capacitor||1 uF 16V|
|C7||Polarized Capacitor||1 uF 16V|
|C10||Capacitor||100 pF 16V|
|C6||Polarized Capacitor||1 uF 16V|
|C1||Polarized Capacitor||470 uF 16V Elettr.|
|U1||Positive Voltage Regulator||7805 +5V Voltage Regulator|
The MAX232 converts the RS-232 levels (about +10 and -10 V) to TTL voltage (0 and +5 V) and vice versa without requiring anything else than +5 V power supply. This chip contains two TTL->RS-232 and two RS-232->TTL drivers and needs four external 1 uF capacitors in order to generate the RS-232 voltage internally. The adapter electronic gets its power supply from the smartcard reader device VCC line or you can use an external 5 V supply if you wish.
The card slot's RST line is connected using one of the TTL->RS-232 drivers in the MAX232 to DCD, so that the software and the reader can easily resynchronize in case of a protocol error.
The I/O line is a bidirectional half-duplex asynchronous TTL level serial port.
We can connect this line to a MAX232 TTL input driver (which is connected to RxD and sends bytes to the PC) in order to receive data from the card. The TxD signal is converted in the MAX232 to TTL level and is connected with an hex buffer TTL to I/O. The R4 (a pull-up resistor to +5 V on I/O) guarantees that the adapter is in high impedance state if the TxD line is idle and delivers the correct voltage if the PC sends bytes and the smartcard is in reception mode. As we don't connect totem-pole or tristate outputs to I/O, a short circuit should be impossible in the adapter.
Pay attention to the polarity of the capacitors (marked with a + in the diagram next to each capacitor)! The -->-- symbols in the MAX232 diagram above indicate the voltage converters inside the chip.
The RED LED show you when the reader is powered.
The GREEN LED shows you the I/O traffic.
As a side effect of this simple interface design, every byte sent by the PC is at the same time also received by the PC. Consequently, you can test the circuit with a terminal emulator by switching off local echo: if you still see every typed character immediately on the screen, the interface should be all right.
Software must be capable of dealing with this echo from the interface.
A few additional hints
To change the clock frequency you must change the XTAL Quartz and the R6 resitor. For 6MHz Quartz R6 must be 680 Ohm
Cables of 12 m length have sucessfully been used and you shouldn't have problems with RS-232 cables up to 25 m length and more.
There are many alternative ways to build this interface if you don't have some of the components available. E.g. the MAX232 could be replaced by the fully compatible LT1081 from Linear Technology. The circuit still works fine if you use higher capacitors than 1 uF (e.g. my prototype worked fine with 4 22 uF types which were left from a previous project), but use equally sized capacitors. If you use the pin compatible MAX220 (a low power version) instead of the MAX232, then use capacitors with 10 uF or higher. The MAX232 should be the easiest available one of these chips.
If you don't have the experience to etch your own PCB (it's not very difficult) or don't know someone who does, then you could solder the components in a universal raster PCB or plug them into an experimental board. Then produce just a simple PCB with only the ISO card contacts and connections to outside the smartcard reader device by mechanically removing the thin copper layer with a good knive between the 4 contacts and lines.
- Nicola Asuni
- Markus Kuhn