logo elektroda
logo elektroda
X
logo elektroda

125kHz RFID reader with integrated antenna, Attiny13A

mjc  Cool? (+59)



Hello.
I have been interested in RFID technology for a long time and today I would like to present the development of my old design, namely an RFID card reader with an integrated antenna on a PCB.

Due to the complicated structure of the antenna (small distances between the paths), the board was ordered from an external company. The heart of the project is the Attiny13A microcontroller and the EM4095 transreceiver. I used the processor in a DIP housing, because I do not have an adapter for SMD programming. Except for one resistor, everything else is in the SMD 1206. The circuit is unusual because virtually all other projects are based on large processors, eg Atmega8, Atmega32, PIC16Fxx etc., but I couldn't find something on such a small circuit.

The reader reads cards as standard UNIQUE at 125kHz . Cards are encoded with a 64-bit unique serial number.
As I mentioned, the board was commissioned to an external company - XXXXX. I am very pleased with the performance - no short circuits, despite the small distance between the tracks. High-quality tin-plating, metallization and solder mask - does not come off when heated with a soldering iron. I think that the most interesting element of the board is the antenna - it has a range of about 8 cm with the Unique card. The board has a 3x godpin strip - Tx respectively - data transmission in the TTL, GND, VCC standard (5V, also checked 3.3V - works, but the range is visibly smaller).

On the board, in addition to the processor and strip mentioned above, there is an LED signaling the card reading and the standard application of the EM4095 chip.

Firmware - microcontroller software
The software has been significantly changed compared to the first version published in the topic Link .

* increased transmission speed to 19200bps

* data is not sent as ASCII characters but as data bits. I gave up the data as ASCII code due to the simpler implementation of the algorithm in the receiving programs, either on the PC or on the AVR. Data sent this way may not be readable in some programs (eg PuTTY or hyperterminal), so I recommend Bray ++ Terminal. After putting the terminal in HEX mode, we get nice data.

* added XOR checksum. The biggest disadvantage of the previous version was the lack of a checksum. The XOR checksum is calculated according to the algorithm: (1-byte of card code data) XOR (2-byte of data card codes) XOR (3-byte of data card codes) XOR (4-byte of data card codes) XOR (5-byte of data codes cards),

e.g. we have a card specified with numbers in hexadecimal notation: 28 00 B8 60 7A then the XOR checksum looks as follows:
(28) xor (00) xor (B8) xor (60) xor (7A) = (28) ^ (00) ^ (B8) ^ (60) ^ (7A) = 8A


The reader sends 9 bytes of data:
1. # 7Eh - transmission start symbol
2.1-byte card code data (MSB)
3.2-byte card code data
4. 3-byte card code data
5. 4-byte card code data
6.5-byte card code data (LSB)
7. # 5Eh - symbol of transm. check totals
8. Checksum - XOR checksum
9. # 7Ch - symbol of end of transmission

If the card is kept in the reader field continuously, such a frame is sent every 700ms. The reader informs that the card has been read by lighting the LED for 350ms.

Due to the lack of a hardware USART interface in the microcontroller, it was necessary to use a software implementation of the UART. It is a constantly developed version and I hope that it is free from bugs and flaws. At this point, I have a question for more experienced users: how do you test this type of solution?

The program, during its work cycle, after the initial reading of the card number, decodes it (Manchester encoding) and checks the parity, this prevents sending an incorrectly received code to the receiving device (e.g. some interference, etc.).

Of course, the program was written in C (Avr Studio 4 + WinAVR-20100110) and partly in Assembler - I cannot imagine implementing this problem in the BASCOM environment for such a small processor as Attiny13. BASCOM offers RFID support through a few simple commands, but it is a terribly suboptimal solution, it takes up an awful lot of memory and is suitable for Atmega rather than Attiny.

The program takes 788 bytes.

Gross costs

Board: PLN 27 / piece (prototype)
EM4095: PLN 10
Attiny 13A: PLN 4.5
General cargo: less than PLN 1

I wrote a PC software for the reader in C # 2010. I chose the platform mainly because of the license for the entire Visual Studio package, but also the built-in, very good serial port control. The program receives data from a designated serial port, analyzes them in terms of header and checksum compliance - if everything is correct - the data goes to the user. In a similar style, I wrote uC programs in the two most popular C languages (avr-gcc) and BASCOM-BASIC.

Due to the inability to make a tile with home methods, I do not publish the pattern of the paths.

When selecting capacitors for EM4095, using the Excel file provided by the manufacturer may be inconvenient, so I wrote a simple program EM4095 Dsigner Tool presenting the data in an accessible form.

Plans for the future:

In the future, I plan to modify the Attiny PCB in SMD and add a Watch-Dog to the program.

When soldering, unfortunately I touched one via with the tip, which made it an unsightly "tuber". I am also not satisfied with the angular goldpin strip, but it was the only one I had.

To sum up:

I am very pleased with the design. It does the job and I hope it looks nice.
In the attachment I am adding a diagram, a program for receiving data (you can see what the interface looks like), the EM4095 Designer Tool program, about which I wrote earlier, and catalog notes for the EM4095 system.
I do not include the HEX file this time.
I used materials widely available on the Internet to develop the project.

Moderated By androot:

Removed the name of the tile company - surreptitious advertising



A few pictures:



About Author
mjc
mjc wrote 165 posts with rating 107 . Live in city Siedlce. Been with us since 2012 year.

Comments

blue_17 11 Aug 2012 22:33

What did you do PCB and how did you count the antenna :?: In eagle :?: maybe you used some script :?: Regards [Read more]

mjc 11 Aug 2012 22:52

The CAD software does not matter - you have to create paths "on the spot" anyway. You can count, but it is time-consuming, for measurement you should use an oscilloscope - RLC system at 125kHz, you can... [Read more]

sedr 11 Aug 2012 23:05

I recommend Micorwave Office for counting and guiding antennas. [Read more]

vayo 11 Aug 2012 23:18

Hello, cool design. I also became interested in RFID and the EM4095 chip about two years ago, but I didn't play with the hardware, because a lot of it is available online. I bought a ready reader... [Read more]

piotrva 11 Aug 2012 23:23

Such question, what cards does the colleague use to enter his ID? Where did a colleague buy such? I wanted to get one too, but in Poland it is hard ... [Read more]

blue_17 11 Aug 2012 23:27

I think it does :) because in a good EDA system there are tools that allow you to generate such antennas Regards [Read more]

vayo 11 Aug 2012 23:32

I used Q5 and bought it about two years ago here Link [Read more]

Urgon 12 Aug 2012 08:44

AVE ... I really like the project itself. But since you can read cards, you can also burn and emulate them. Maybe you could modify this chip to emulate the read card? And about RFID projects, this is... [Read more]

Anonymous 12 Aug 2012 11:05

A checksum in which all bytes (including CRC) can have the same value should not be used. In your case, when all data will be 0, CRC will also be 0. Negate at least CRC, or better do this: CRC = (0x100... [Read more]

mjc 12 Aug 2012 12:25

As for emulation, I am afraid that there is not enough processor memory for it, it would be necessary to switch to some atmega. R-MIK thanks for your attention, I will definitely use it. [Read more]

RomanFilipecki 12 Aug 2012 15:05

Everything is fine, but what are you planning next for this project? There are readers available, at least from two Polish producers, maybe there is a niche on the market? [Read more]

mjc 12 Aug 2012 15:23

Hello I know that there is a niche on the market, but unfortunately the price of my solution is not the lowest and I cannot think about competition. [Read more]

Olo999 12 Aug 2012 17:45

Could you give the "internal" dimensions of the antenna (length, width), width of the tracks and the distance between them? [Read more]

Wojtek001 19 Aug 2012 02:07

Can you count on a program listing? I would like to write this type of program in BASCOM but without using these ready-made procedures, therefore the listing in C would be useful for me. [Read more]

mjc 19 Aug 2012 17:38

BASCOM and C it is a big difference. I will not share the source code. [Read more]

r06ert 04 Sep 2012 20:07

Hello, How does the EM4095 chip work? Is the device sensitive to changes in temperature and humidity? What is the range? And the most important question: If the tag will be in the reader's reach... [Read more]

mjc 04 Sep 2012 22:59

I am very happy with it and the layout itself is the basis of many commercial products. Temperature and humidity changes are a widely understood phenomenon. It is logical that the circuit will not work... [Read more]

Julio R 28 Sep 2016 03:32

forum friends good. my name is julio rojas i am in bogota colombia i want to ask there is a special favor for the EM4095 RFID reader and ATtiny13 the reader works fine but i want to know if someone can... [Read more]

%}