Silicon ChipReader/Programmer For Smart Cards - January 2003 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Queensland TV repairs now need an electrical licence
  4. Feature: Receiving TV From International Satellites; Pt.2 by Garry Cratt
  5. Project: Reader/Programmer For Smart Cards by David Freeman
  6. Project: The SC480 50W RMS Amplifier Module by Peter Smith and Leo Simpson
  7. Project: A Tiptronic-Style Gear Indicator by John Clarke
  8. Project: Active 3-Way Crossover For Loudspeaker Systems by Mick Gergos
  9. Feature: Using Linux To Share An Optus Cable Modem: Pt.3 by John Bagster
  10. Weblink
  11. Feature: Chips Monitor Tyre Pressure by Peter Holtham
  12. Vintage Radio: Intermediate Frequency (IF) Amplifiers; Pt.2 by Rodney Champness
  13. Notes & Errata
  14. Market Centre
  15. Book Store
  16. Outer Back Cover

This is only a preview of the January 2003 issue of Silicon Chip.

You can view 20 of the 96 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • Receiving TV From Intenational Satellite (December 2002)
  • Receiving TV From Intenational Satellite (December 2002)
  • Receiving TV From International Satellites; Pt.2 (January 2003)
  • Receiving TV From International Satellites; Pt.2 (January 2003)
Items relevant to "Reader/Programmer For Smart Cards":
  • Reader/Programmer for Smart Cards PCB pattern (PDF download) [07201031] (Free)
Items relevant to "The SC480 50W RMS Amplifier Module":
  • SC480 amplifier module PCB, TO-218 transistor version [01201031] (AUD $12.50)
  • SC480 amplifier module PCB, TO-3 transistor version [01201032] (AUD $15.00)
  • SC480 amplifier module power supply PCB [01201033] (AUD $5.00)
  • SC480 50W RMS Amplifier Module PCB patterns (PDF download) [01201031-3] (Free)
Articles in this series:
  • The SC480 50W RMS Amplifier Module (January 2003)
  • The SC480 50W RMS Amplifier Module (January 2003)
  • The SC480 50W RMS Amplifier Module; Pt.2 (February 2003)
  • The SC480 50W RMS Amplifier Module; Pt.2 (February 2003)
Items relevant to "A Tiptronic-Style Gear Indicator":
  • PIC16F84(A)-04/P programmed for the Tiptronic-Style Gear Indicator [GEAR.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC16F84 firmware and source code for the Tiptronic-Style Gear Indicator [GEAR.HEX] (Software, Free)
  • Tiptronic-Style Gear Indicator PCB patterns (PDF download) [05101031-3] (Free)
  • Panel artwork for the Tiptronic-Style Gear Indicator (PDF download) (Free)
Items relevant to "Active 3-Way Crossover For Loudspeaker Systems":
  • 3-Way Active Crossover PCB pattern (PDF download) [01101031] (Free)
  • Panel artwork for the 3-Way Active Crossover (PDF download) (Free)
Items relevant to "Using Linux To Share An Optus Cable Modem: Pt.3":
  • Linux firewall files (Software, Free)
Articles in this series:
  • Using Linux To Share An Optus Cable Modem; Pt.1 (November 2002)
  • Using Linux To Share An Optus Cable Modem; Pt.1 (November 2002)
  • Using Linux To Share An Optus Capble Modem; Pt.2 (December 2002)
  • Using Linux To Share An Optus Capble Modem; Pt.2 (December 2002)
  • Using Linux To Share An Optus Cable Modem: Pt.3 (January 2003)
  • Using Linux To Share An Optus Cable Modem: Pt.3 (January 2003)
  • Using Linux To Share An Optus Cable Modem; Pt.4 (February 2003)
  • Using Linux To Share An Optus Cable Modem; Pt.4 (February 2003)
Articles in this series:
  • Intermediate Frequency (IF) Amplifiers; Pt.1 (December 2002)
  • Intermediate Frequency (IF) Amplifiers; Pt.1 (December 2002)
  • Intermediate Frequency (IF) Amplifiers; Pt.2 (January 2003)
  • Intermediate Frequency (IF) Amplifiers; Pt.2 (January 2003)

Purchase a printed copy of this issue for $10.00.

READER/ PROGRAMMER FOR SMART CARDS Since blank smart cards are now available at attractive prices, it’s quite feasible to program them with your own software and data for all kinds of applications. Here’s a low cost and easy to build ‘Phoenix type’ reader/programmer, which can be used with most of the programming software available on the Web to suit this type of serial-port device. W ith their embedded microcontroller and serial EEPROM combination, today’s ‘smart cards’ have many more uses than dumb cards which merely have a magnetic stripe. Smart cards are already used for pay TV set-top box and mobile phone authorisation but these applications really only scratch the surface of their potential. You could use them to build your own personalised security access system, for example, or to provide a ‘plugin brain and memory’ for small robots and digitally controlled machines. Or to provide plug-in schedules for 16  Silicon Chip automatic control of a model railway, or pointing data for a computer-positioned telescope, or whatever... Using smart cards for your own applications is now quite feasible because blank smart cards and matching ‘sockets’ are now available at quite reasonable cost. For example, Jaycar stores are offering blank cards with an embedded PIC16F84A micro and 24LC16B EEPROM for $19.95 (Cat ZZ-8800). Jaycar can also supply suitable ‘sockets’ in both through-hole (PS-0012) By David Freeman and SMD (PS-0010) versions for only $8.75 each. By the way, the PIC16F84A micro-controller chip (made by Microchip Technology) is used in many of the commonly used smart cards. Although only an 8-bit processor it’s quite powerful, with 1024 words of program memory, 68 bytes of data RAM and 64 bytes of data EEPROM. It is even smarter when it’s teamed up with the 24LC16B serial EEPROM (which has a capacity of 16K bytes); the combo is capable of a surprising range of applications. Other smart cards team up the PIC16F84A micro with a 24C64 EEPROM www.siliconchip.com.au which offers 64K bytes of memory. They can, of course, because the for reading and programming. (Note The Atmel AT90S8515 micro is also cards are available over the coun- that the card’s EEPROM is read and used in some smart cards. Usually it’s ter as well as being used in pay TV programmed ‘through’ the micro, with teamed up with either the 24C64 or set-top boxes and mobile phones. its ‘cooperation’.) 24C128 (128K bytes) EEPROM. So because the matching sockets In this article, I’m describing a Fig.1 shows what’s acsimple reading/programtually inside a common ming interface which is smart card, of the type quite low in cost and using the PIC18F84 with easy to build. I can’t a 24LC16. Because both claim it involves any chips use serial commugreat design innovation. nication, all of the conIn fact, it’s very simnections to the ‘outside ilar to quite a few deworld’ are made via only signs that have been five of the tiny array of available on the Internet eight gold-flashed conand like them, based on tacts. what seems to be called Contact C1 is used to the ‘Phoenix’ configusupply the chips with +5V, ration. C2 to reset the micro, C3 (I haven’t been able to provide the micro with to find out where that clock signals (3.75MHz name came from – perFig.1: here’s what is inside that innocuous-looking piece or 6.0MHz), the large ‘L haps the person who of plastic. There’s a lot more to it than meets the eye! shaped’ C5 for ground and came up with the first C7 for serial data input design lived in Phoenix, amd output. Arizona!) This kind of card makes a compact are readily available as well, it has The main advantage of using this (86 x 54 x 0.8mm) and cost effective become quite feasible to use them in kind of design is that it’s compatible package containing such a useful your own projects. with a lot of the smartcard reading micro and EEPROM. How they can All you really need for this is a small and programming software available fit those chips, bonding wires and hardware interface to connect the card for free downloading from many sites contacts inside a card with a total up to your PC, and suitable software to on the internet. thickness of only 0.8mm is beyond me! allow you to ‘talk’ to the card’s micro By the way, SILICON CHIP will NOT The smart card reader/programmer is assembled on a single PC board. Basically, it is just an interface between the card, which slides into the slot at right, and the PC. www.siliconchip.com.au January 2003  17 Fig.2: the complete circuit. There’s not much to it – just a couple of crystal oscillators, an RS-232 chip and power supply. be able to provide you with any software to go with the hardware, because according to Australian federal law this combination of hardware and software is capable of being ‘used for the purpose of defeating encryption systems’, and is accordingly deemed illegal. Needless to say, we are certainly not describing this project with the idea that you would use it to defeat any encryption systems. In fact we must warn you that it should NOT be used for this purpose, because doing so would be illegal and make you liable to be prosecuted. All we can do with regard to helping you find suitable software is list the URLs for some of the web sites where you may be able find some, and leave the rest to you. These are shown in the accomp-anying panel. Be warned again, though: some of the software on these and other sites MAY be designed specifically for illegal smart card applications. So let the user beware! Incidentally, we understand that kits for this hardware interface will be available from Jaycar Electronics. So you shouldn’t have any problems building up the interface itself or get18  Silicon Chip ting blank smart cards for use with it. Free-standing board As you can see from the photo, there’s very little in the project and all of its components fit on a small freestanding single-sided PC board. The board measures only 89 x 76mm, and is coded 07201031. It’s supported on four small rubber feet and has the smart card socket on the front, flanked by two LEDs: one (green) to indicate when the unit is powered up, the other (red) to show when the PC is reading from or writing to the card. Here’s a selection of “blank” smart cards showing different types of contacts available. This reader/ programmer suits only the 8-contact version, as shown on the left. Along the back of the board are a DB9F socket for a standard RS-232C serial link cable to the PC serial port, plus a 2.5mm concentric DC power connector to accept the cable from a 9-12V plugpack power supply. Everything else is on the board itself. Circuit description The hardware of this project is designed to perform just three main functions: (a) to provide +5V DC to the smart card plugged into its socket; (b) to provide the card with a clock signal of either 3.75MHz or 6.0MHz, selectable via a jumper shunt; and (c) to provide a serial communications interface between it and the PC’s software, to allow reading and writing. Referring to the circuit diagram, power for the interface is derived from a 9-12V DC plugpack, connected to the unit via CON3. Series diode D1 prevents damage due to an accidental reverse polarity connection, while low power regulator REG1 provides smoothed and regulated 5V DC for both the smart card and the rest of the interface circuitry. LED1 is the green power indicator, which runs directly from the unregulated input. Clock signals for the smart card are provided by the circuitry around IC2, a www.siliconchip.com.au Full-size view of the completed PC board. . . low-cost 74HC00 quad gate. Two of its gates (IC2c/d) are connected as crystal oscillators, one for 3.75MHz using crystal X1 and the other for 6.0MHz using X2. Which oscillator runs at any particular time is determined by the position of the jumper shunt in the 3-pin header LK1, because this applies +5V to the second input of either IC2c or IC2d. Each oscillator only operates when its second gate input is taken to +5V, so the oscillator whose second input is held low via the 10kΩ resistor is disabled. The outputs of the two oscillators are fed into IC2a, used here as an OR . . . along with the matching component overlay. gate. Then the clock signals are passed through IC2b, used as a buffer, before being fed to the CLK pin of the smart card socket (C3). The rest of the circuitry forms the interface between the smart card and the serial port of the PC (via CON2). The heart of the interface is IC1, a standard MAX232 dual RS-232C serial bus transceiver. This chip is very handy because it contains internal ‘charge pump’ circuitry which generates the correct RS-232C voltage levels from a standard +5V supply rail, using the four 1µF capacitors connected to pins 1-6. One of the two receivers of IC1 has its input (pin 8) connected to the transmit data line from the PC (TxD, pin 3). The output of this receiver (pin 9) is used to operate LED2, the Read/ Write indicator. The same output is also used to pull down the Data I/O pin on the smart card socket (C7) via Schottky diode D2, to send data to the card during write operations. The smart card pin (Data I/O) is normally pulled high by a 10kΩ resistor to +5V but can easily be pulled low by pin 9 of IC1 because of the very low voltage drop in D2. When the smart card micro itself pulls the Data I/O pin low during a read operation, this is fed back to Fore and aft close-up views of the business ends of the smart card reader/programmer, showing the RS232 and power supply connections (left photo) and the smart card slot (right photo) www.siliconchip.com.au January 2003  19 Parts List – Smart Card Reader/Programmer 1 1 1 1 1 1 1 4 2 6 4 PC board, code 07201031, 89 x 76mm 3.57MHz crystal (X1) 6.00MHz crystal (X2) 3-pin SIL header strip with 2-way jumper shunt (J1) ICA-700 DIP smart card socket (CON1) DB9F connector, 90° PCB mount (CON2) 2.5mm DC power connector, PCB mount (PS-0520) (CON3) M3 x 6mm cheesehead machine screws M3 x 9mm cheesehead machine screws M3 hex nuts small rubber feet, screw attachment type PC via the ‘carrier detect’ line (CD, pin 1) of the serial comms port, this allows the software to monitor when a card is present in the socket. Putting it together You shouldn’t have any trouble putting the interface together if you follow the board assembly diagram carefully, as a guide to positioning the various components and their orientation. I suggest that you fit the card socket, the DB9 connector and the DC power socket to the board first, as all three Semiconductors of these may need a small amount of 1 78L05 low current regulator(REG1) board hole ‘tweaking’ before their pins 1 MAX232 or ST232CM interface (IC1) all mate with the board correctly. It’s 1 74HC00 quad NAND gate (IC2) easier to do this before you add all of 1 3mm green LED (LED1 — power) the other components. 1 3mm red LED (LED2 — read/write) Note that the card socket mounts 1 1N4004 power diode (D1) with its card entry slit towards the 1 1N5819 Schottky signal diode (D2) front(!), and that as well as the various contact connection pins it also Capacitors has a couple of 3mm diameter plastic 1 10µF 16V RB electrolytic locating spigots which sit in matching 4 1µF tantalum holes in the board. 3 100nF metallised multilayer ceramic (code 100n or 104) Once the three connectors are fitted 4 22pF NPO disc ceramic and soldered in place, you can then Resistors (0.25W 1%) add the remaining components in the 2 1MΩ (brown black green brown or brown black black yellow brown) usual order. That is, wire links first 4 10kΩ (brown black orange brown or brown black black red brown) (there are only two), then the 3-pin 1 1.5kΩ (brown green red brown or brown green black brown brown) SIL header, then resistors, capacitors 3 1kΩ (brown black red brown or brown black black brown brown) and crystals. Finally come the diodes, regulator, LEDs and ICs. As always, make sure you fit all pothe serial port (CON2) via one of the in card sensing switch. The other larised parts with the correct polarity IC1 transmitters, as pin 10 is also side of the switch is connected to as shown in the diagram. connected to this point. The output +5V, so when a card is inserted into Both LEDs have their cathode ‘flat’ from pin 7 of IC1 is connected to pin the socket and pushed right in, the side towards the front of the board, 2 of CON2 which is while both ICs the RS-232C receive have their notch data (RxD) line. end towards the The second reback. Take special Here are some website links where software compatible with this smart ceiver of IC1 has its care with the pocard reader/programmer is available for free download: input (pin 13) conlarity of the four www.adteknik.se/english/ nected to the Ready 1µF tantalum cawww.angelfire.com/space/aussiemulate/ to Send (RTS) line pacitors on the outfrom the PC (CON2 er side of IC1. www.maxking.co.uk pin 7), and its output When the board www.maxkingtunisia.com (pin 12) to the Reset is fully assembled, www.skyvisiontech.com/card_reader.htm pin of the smart card the four small rubNote that neither SILICON CHIP nor the author of this article can accept socket. This allows ber feet can be responsibility for the operation of any of this software or its potential to the software in the attached to it usbe used for unlawful purposes. PC to issue a reset ing M3 x 6mm command to the mach-ine screws micro in the smart and nuts. card whenever this The feet are important with this kind switch operates and pin 11 of IC1 is of ‘naked board’ assembly because is required. The input of the second transmitter pulled high. they give the board proper support The output of this transmitter (pin while lifting the solder joints away section of IC1, pin 11, is connected 14) thus swings to RS-232 ‘mark’ level, via a 10kΩ resistor to ground but also from whatever surface the interface to one side of the card socket’s built and as this output is passed back to the may be placed on. Where to look for software 20  Silicon Chip www.siliconchip.com.au That’s about it. Your smart card interface should now be ready to use, but before hooking it up to one of the serial comms ports of your PC you might want to give it a quick check-out. 1-minute checkout To do this, connect the output cable of the 9V plug pack to CON3, and apply power to the plugpack. Power indicator LED1 should immediately light — if not, remove the power and check that you’ve fitted it the right way around. The only other reason for ‘no glow’ is that you may have wired in diode D1 in wrong way around, or the plug is fitted to the plug pack output cable with the connections reversed. Assuming the LED is happily glowing, check the DC voltage at pin 14 of IC2 and pin 16 of IC1 with your DMM. In both cases you should get a reading within a few millivolts of 5.0V, and you should also be able to measure the same voltage at the ‘+5V’ pin of the card socket and/or the end of the 1kΩ resistor right next to it (and alongside D2). If these voltages measure OK, you must have connected the regulator in the correct way around. At this stage your interface is probably working as it should. However, if you have access to a scope (CRO) you might also want to check the crystal oscillators. This too is very straightforward. With the unit powered up, try fitting the jumper shunt joining the centre and lefthand pins of the SIL strip (looking from the front). With the scope probe on pin 6 of IC2, you should find a 5V peak-peak square wave of 3.75MHz. If you shift the jumper shunt to join the centre and righthand pin instead, the waveform at pin 6 should simply change in frequency to 6.0MHz. Assuming this is what you find, you can conclude that your smart card reader/programmer is all present and correct. All you need now is a cable to con- nect it to a spare comms port of your PC and of course some software so that your PC knows how to talk to a card plugged into the front socket. Plus a card or two, of course... Incidentally there’s a lot of specialised knowledge and jargon associated with some areas of smart card technology. You’ll find a lot of this explained in some of the documentation files available on the Angelfire website. If you’d also like more information on the PIC 16F84A micro and the 24LC16 EEPROM, this can easily be downloaded from the Microchip website (www.microchip.com). There are applications notes available as well as device data sheets — most of them in PDF file format. So once you have the interface, your future with smart card technology will SC await. Over to you! Where from, how much. . . This project was designed for Jaycar Electronics and is only available through Jaycar Electronics stores, dealers and mail order service. Expected retail price is around $29.95. Jaycar also have blank smart cards available for $19.95 each. Contact your nearest Jaycar Electronics store. ELECTRONICS Do You Eat, Breathe and Sleep Technology? Jaycar is a leading electronics retailer with over 6,000 products from electronic components to computer accessories. Management Opportunities plus Full and Part Time Sales Positions Available Nationwide We are growing rapidly with 30 stores and we have an expansion programme to open many more. Backed by mail order and a fully interactive website, we need dedicated individuals to help achieve our goals. You need to be customer focused, with an eye for detail and empathy for the products we sell. Ideally you will have some experience in retailing, coupled with management experience for the senior positions. You will also need to be energetic, enthusiastic and have excellent interpersonal skills. Career opportunity with full training is available if you have the drive and ambition to make your future at Jaycar. We offer a competitive salary, sales commission and many other benefits. To apply for any of the above positions please ask in-store for details or alternatively send a full C.V. indicating the roll you are interested in, location and details of current salary to; Retail Operations Manager Jaycar Electronics Pty Ltd P.O. Box 6424 Silverwater NSW 1811 Fax: (02) 9741-8500 Email: jobs<at>jaycar.com.au www.siliconchip.com.au January 2003  21