RFID tag emulation with an AVR

Some time ago, I read this article about using an AVR ATtiny85 microcontroller to emulate an EM4102 RFID tag, and today I thought of giving it a try.

I used an Arduino as an ISP programmer to program the ATtiny85 with this source code. The electronics used:

  • 1x AVR ATtiny85
  • 1x 10uF capacitor
  • 1x 22uF ceramic capacitor
  • 1x Home-made coil from toilet paper cardboard

Here are some pictures and a video from the result:

22 thoughts on “RFID tag emulation with an AVR”

  1. hello it would be too cool if it would be possible to have direct code for arduino uno s please grieve I do not speak English well

    Reply
    • This won’t work with the Arduino. You have to burn straight assembly code right on the microcontroller with an AVR programmer without any bootloader or any other things. I used an Arduino ISP programmer as seen in the picture, you can find code for it here: http://arduino.cc/en/Tutorial/ArduinoISP

      Reply
  2. How did you compile the assembly source code you’ve listed? I’ve been having a lot of trouble compiling with the free avr assembler Atmel has for download. What did you use for compiling the code into a hex file to transfer to the attiny85?

    Reply
  3. Awesome!! As a side note does it matter what guage of wire you use? Also can I just pop the attiny85 into a protoboard with the wire loop and get it to work?

    Thanks!!

    Reply
    • I just used a wire that I had laying around. Any thin wire should word. You could use one from old speakers. It should work with a protoboard as long as you strip the sides of the wire.

      Reply
  4. Would it be too hard for you to describe the steps you used to load the code you mention into the Attiny? I’m guessing that you are not using the Arduino interface for this. I get this up to where you are using the Arduino as an AVR, after that it is all a blur.

    Reply
  5. Great project,
    I’m trying to do the same stuff but I only need the EM4102 part of the code which is not compilable by AtmelStudio. So do you have the .hex-file for that part.
    Best Regards, Max

    Reply
    • The .hex file is specific to my tag. You will not be able to change the tag code if you don’t compile yourself.

      Reply
      • So how can I compile the .S-file in AtmelStudio? (I firstly build a C-Project-Folder and copied the EM4102 part in a .S-item and tried to compile it–> did not work)

        Reply
  6. To compile the code use linux:
    mkdir rfid
    wget http://svn.navi.cx/misc/trunk/avrfid/Makefile
    wget http://svn.navi.cx/misc/trunk/avrfid/avrfid.S
    make

    But before you need to install AVR toolchain:
    sudo apt-get install avr-libc avr-gcc
    sudo apt-get install avrdude

    When you launch make you will get the .hex file into your rfid folder vous aurez un fichier .hex

    Hope it helps you :D

    Reply
  7. I tried to make it with a small 1mH coil (resistor size). But my reader do not read it as a tag. I don’t know why. I guess there is to less power to start the attiny. My question ist, how many winds did you make for the coil? Do you think i could take a coil from a tag to make it work? I don’t know the the capacity inside the attiny to calculate the resonant circuit.

    The other question is that you use a 22uF ceramic capacitor. But i can’t see it connected. Did you use it?

    Reply
  8. Hi Dimme,
    thank you for this post. I really what to build my own attiny based EM4102 tag. But I want to understand it too. My knowledge of electronics is not the best… So the questions I have are:
    * What is the purpose of the 10uF capacitor? And why 10uF?
    * What is the purpose of the 22uF ceramic capacitor? And why 22uF? And why ceramic?
    * As Marco pointed out: How many winds did you make for the coil?
    * Also pointed out by Marco: Where to connect what? Could you provide some kind of schematic?

    Reply
  9. Hi Dimme,

    I would like to work in this. So I need your help. can you give circuit details and coding details?. I am waiting for your reply.

    Reply

Leave a Reply to Dimme Cancel reply