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:
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
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
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?
You can compile the assembly source code with avrdude. I don’t remember the exact flags needed, look at the manpages.
Arduino IDE is also using avrdude so if you are having the Arduino IDE installed you can find avrdude among its binaries.
Also, why don’t you use the provided Makefile?
https://github.com/dimme/avrfid/blob/main/Makefile
You can simply type: make build
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!!
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.
Hello!
Is it possible to make the code work with 13,56 MHz tags?
I don’t think that you can do that just by changing the code.
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.
I am using the Arduino interface for this. I used an Arduino as an ISP programmer as seen in the picture, you can find code for it here: http://arduino.cc/en/Tutorial/ArduinoISP
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
The .hex file is specific to my tag. You will not be able to change the tag code if you don’t compile yourself.
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)
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
Hi Dimme,
Why do we need a coil here. The first pic which I saw in the article
http://scanlime.org/2008/09/using-an-avr-as-an-rfid-tag/ only uses a resistor of 1k ohm. Can I use only the ATTINY85 and one resistor to make it work.
That is an inductor (coil), not a resistor.
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?
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?
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.
Uhm the site doesnt have the code anymore
Article updated.