Getting Started with MagSpoof using Arduino IDE

March 27, 2017

This guide covers the process of uploading code to the MagSpoof with Arduino IDE.

You will need the following items for this guide:

1. Install Arduino IDE

2. Open Arduino IDE as root/administrator.


  • Open a terminal application and navigate to the Arduino IDE folder. Run the following commands inside the Arduino folder.
  • sudo ./arduino
  • Enter your root password.
  • Arduino IDE should now open.


  • Navigate to the Arduino IDE folder.
  • Right click and click run as administrator.

3. Download Samy's code from GitHub.

git clone

4. Copy the contents of magspoof.c into a new sketch. Save the new sketch. 

5. Inside Arduino IDE click file –> preferences. In the settings tab at the very bottom you will see an option called "Additional Boards Manager URLs". Enter the following URL.
  • Click OK

Arduino IDE Preferences

6. Click Tools –> Board –> Board Manager. Navigate to the bottom and click on the new entry called "attiny by David A. Mellis", select version 1.0.1 and click install. Then close Board Manager.

Board - Arduino IDE

Board Manager - Arduino IDE

7. Configure the board settings.

  • Click Tools –> Board and select ATtiny.

Arduino IDE - Board Select MagSpoof

  • Click Tools –> Processor select ATtiny85.

Arduino IDE - Process Select MagSpoof

  • Click Tools –> Clock select 8 MHz (internal).

Arduino IDE - Clock Select MagSpoof

8. Click Tools -> Programmer and select your programmer from the list shown. In this example we are using the Sparkfun AVR Pocket Programmer, and set the programmer to USBtinyISP.

Arduino IDE - Programmer

9. Place the battery inside your MagSpoof and turn it on. Connect the programmer to the MagSpoof, the header on the MagSpoof end should be in the following orientation. Do not power the device via the Programmer. Make sure the Power Target is in the off position on the Programmer. If you have both battery power and programmer power you will burn out your chip.

MagSpoof connected to Programmer

10. Verify the software by clicking the check mark in the top left hand corner.

Arduino IDE - Verify

11. Upload the code by clicking on the arrow. If it completes successfully your MagSpoof is now programmed. 

Arduino IDE - Upload

12. Change the track information highlighted below as follows.

Arduino IDE - Code Change MagSpoof

  • Track 1
"%B4444444444444444^ABE/LINCOLN^291110100000931?\0", // Track 1
  • Track2
";4444444444444444=29111010000093100000?\0" // Track 2

Your code should now look something like this.

Arduino IDE - Track change MagSpoof

Upload the new code to the MagSpoof.

13. Open up a new text document and connect your MagStripe Reader. MagStripe readers pretend to be USB keyboards and will enter text in the document after completing a successful read. Try it by swiping a real credit card.

With your MagSpoof touching the reader, press the button. You should see output similar to the string shown below. Play around with the angle if you are getting different results. 


14. There is a variable in the code called CLOCK_US that controls the speed at which the card data is transmitted. At the current CLOCK_US you only get the second track, if you change the CLOCK_US to 120 you should get the first track. This is due to the variable bit densities of track data. 


15. Change the following code and add your credit card information below. We recommended swiping your card with the MagStripe Reader and copying and pasting the output.

Arduino IDE - Your Credit Card MagSpoof

If you have any questions related to this blog please email us at

Also in Blog

Proxmark Pro - Sniffing a Mifare Desfire 4K Tag
Proxmark Pro - Sniffing a Mifare Desfire 4K Tag

October 21, 2019

This post covers how to Sniff a Mifare Desfire 4K tag with the ProxmarkPro.

View full article →

ProxmarkPro - Sniffing a Mifare 4K Tag
ProxmarkPro - Sniffing a Mifare 4K Tag

October 21, 2019

This post covers how to Sniff a Mifare 4K tag with the ProxmarkPro.

View full article →

ProxmarkPro - Sniffing a Mifare 1K Tag
ProxmarkPro - Sniffing a Mifare 1K Tag

October 21, 2019

This post covers how to sniff a Mifare 1K tag with the ProxmarkPro.

View full article →

We use cookies to ensure that we give you the best experience on our website. If you continue we'll assume that you are understand this. Learn more