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.

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

Making a Physical Mifare 1K UID Clone
Making a Physical Mifare 1K UID Clone

January 10, 2019

Follow these steps to learn how to use a Chinese Magic Card 1K to make a Physical Mifare 1K UID clone. This blog is using a Proxmark3 running firmware V3.0.1.

View full article →

Making a physical HID Prox 2 Clone - Firmware V3.0.1
Making a physical HID Prox 2 Clone - Firmware V3.0.1

January 10, 2019

Follow these easy steps to make a physical HID Prox 2 clone using the Proxmark3 with firmware V3.0.1.

View full article →

Making a physical EM4100 Clone - Firmware V3.0.1
Making a physical EM4100 Clone - Firmware V3.0.1

January 10, 2019

Follow these steps to make a physical EM4100 clone using the Proxmark3 firmware version 3.0.1.

View full article →