EasyTransfer Arduino Library

Posted in Arduino Libraries by Bill
30 May 2011
EasyTransfer Arduino Library

The purpose of this library is to make it easy for the everyday Arduino user working on projects with multiple Arduinos communicating with each other and sharing data. I had many people ask me for the code I used in my PS2X library example that sent PS2 Controller values wirelessly to my SAGAR robot. It got to be tiresome answering the questions and I had an idea to write a library to help the inexperienced with micro controller communications. This is a easy to use and no frills way to send data between two Arduinos.

In most of my own projects I define and write my own NMEA standard communication protocols. This makes communications human readable and easy to debug, but proves wasteful with bandwidth and processing power so it’s not right for every application. Binary communications is much more efficient and versatile, but requires careful handling. This library abstracts the finer points of packetized serial communication away from the user so it easy to use and understand.

To use the library, simple define all the data types you want to share inside a data structure. This keeps all the data stored together in memory.

  //put your variable definitions here for the data you want to send
  int blinks;
  int pause;

When requested, the library will send all the binary data in the structure to another Arduino via serial with a checksum to avoid transfer errors.

void loop(){
  //this is how you access the variables. [name of the group].[variable name]
  mydata.blinks = random(5);
  mydata.pause = random(5);
  //send the data

The receiving Arduino will verify the checksum, and copy the new data onto a identical structure in it’s memory.

void loop(){
  //check and see if a data packet has come in. 
    //this is how you access the variables. [name of the group].[variable name]
    //since we have data, we will blink it out. 
    for(int i = mydata.blinks; i>0; i--){
      digitalWrite(13, HIGH);
      delay(mydata.pause * 100);
      digitalWrite(13, LOW);
      delay(mydata.pause * 100);


It’s important to make sure the structure is the same on both Arduinos for this to work. Now sharing data between Arduinos is easy without having to define and program your own communications protocol and have to worry about syncing or transmit errors. EasyTransfer will do that for you.

Using Structures to hold the data allows for versatile communications by allowing any type and number of data points to be shared, as long as the whole structure is under 255 bytes. You could define int’s, arrays, longs, etc inside the structure and share the data. It’s also possible to create two way communications by defining two sets of structs on each end and creating two objects using the library. I will have an example of that up shortly.

You can download the library and example below. The example requires two Arduino boards to be connected to each other via their Uarts. One will create two random numbers and send the data to the other that will flash out a sequence of flashes based on those numbers. The first one will also flash out the same sequence.

Now it’s easier to pick which Serial port to use; Serial, Serial1, etc. AND support for the NewSoftSerial library for creating software serial ports on any pin. EasyTransfer is for hardware serial, SoftEasyTransfer is for software; each has there own set of examples. There’s also an example for two way communications using the library.

Source Code available on GitHub project pages.


Or Direct Download



Thanks to Kumy, there’s now an I2C version of EasyTransfer. There’s also an experimental VirtualWire version for use with those cheap low frequency radios. All are in the single download zip file above.


To install the Library, open the zip file and transfer the EasyTransfer folder into your Arduino ‘libraries’ folder. Then follow the examples to add the code to your project. If you have any problems or questions, let me know in the Support Forum.

Need Help?

Please use the Support Forum to ask for help. Don’t use the comments below.


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.


Warning: count(): Parameter must be an array or an object that implements Countable in /homepages/46/d285670699/htdocs/bill/wp-includes/comment.php on line 879
  1. 443 Comments.

    • davez5No Gravatar says:

      I have a question with ET and the new soft serial. When you call begin, you use the method details(). Where and what is this method?
      ET.begin(details(mydata), &mySerial);

      • BillNo Gravatar says:

        It’s not actually a method but a pre-processor macro that looks like one:

        #define details(name) (byte*)&name,sizeof(name)

        I did it that way just to keep the ‘front end’ a little neater for the end user. The library requires the memory address of the struct (cast as a byte array) and it’s size.

        If you look at the prototype for begin:

        void begin(uint8_t *, uint8_t, NewSoftSerial *theSerial);

        you can see the three variables it really takes. The macro just adds all the needed special characters in the function call so the end user doesn’t have to worry about it.

    • RIckNo Gravatar says:

      I get this wen i compile?

      EasyTransfer_TX_Example.cpp:1:26: error: EasyTransfer.h: No such file or directory
      EasyTransfer_TX_Example:3: error: ‘EasyTransfer’ does not name a type
      EasyTransfer_TX_Example.cpp: In function ‘void setup()’:
      EasyTransfer_TX_Example:18: error: ‘ET’ was not declared in this scope
      EasyTransfer_TX_Example:18: error: ‘details’ was not declared in this scope
      EasyTransfer_TX_Example.cpp: In function ‘void loop()’:
      EasyTransfer_TX_Example:31: error: ‘ET’ was not declared in this scope
      Any ideas? I have the directory where it belongs..

      • BillNo Gravatar says:


        It looks like you did not unzip the library and put it in your libraries folder correctly. Be sure the ‘EasyTransfer’ folder is in your Arduino libraries folder.

        • RickNo Gravatar says:

          I tried 7 zip and still no luck. I have used a lot of library in the past and never had this issue. Could I have downloaded a bad zip?

          • BillNo Gravatar says:

            Well, try downloading it again.

            In the Arduino IDE, If you go to Sketch -> Import Library, do you see EasyTransfer as an option?

            And this is on the example sketch, correct?

            • RickNo Gravatar says:

              Yes, but it don’t import anything…

            • RickNo Gravatar says:

              I got it to work….
              I had to move examples to the EasyTransfer
              directory ( making that folder “root” in the libraries folder) and delete the software EasyTransfer directory. The software acted like it didn’t want them combined in the same folder?

            • BillNo Gravatar says:

              No, you have to unzip both folders and put them in the libraries folder separately.

    • CameronNo Gravatar says:

      I’m trying to set up two way communication between Arduinos. The first Arduino has 4 relays and two encoders attached. It needs to send the encoders position back to the second Arduino. The second Arduino will compare the encoders position with user inputs and send data back to the first Arduino to open or close the relays. I can sent the encoder position back the first Arduino, but when I try to add in the relay information to be sent nothing happens. I’m using one structure for the TX data and one for the RX data, is this correct? What is the proper way to set up two way communication?

    • RickNo Gravatar says:

      I did the simple one way communication. I worked great! I also tried to do two way communication. It worked sorta. It was really slow. It’s probably me. I will send the two files to you. Any advice would be appreciated.

    • ArjunNo Gravatar says:

      Hi Bill,

      I wanted to parse a string from one arduino to the other. When I try declaring char[] str; it seems to throw an error. Do you suggest any better way to parse a string using your library?

      • BillNo Gravatar says:

        My library implements a binary communications scheme between two arduinos. It requires both arduinos to be running the library. It’s not meant for parsing ASCII communications.

        Binary is much faster and efficient then ASCII text communications.

    • ArjunNo Gravatar says:

      I am trying to declare char[] str; inside the structure. I have no issues parsing char or int values but string seems to be a problem. Thanks in advance.

    • ArjunNo Gravatar says:

      Hi Bill, Thanks for the advice. I did end up implementing on both ends and now I can parse data coming from arduino which has a bunch of sensors on it. There is no loss of data and my packet data has no issues. Your library does a great job. At the moment implementing a RS232-485 interface. Thanks again.

    • Fabio VaresanoNo Gravatar says:

      I would suggest moving EasyTransfer_RX_Example and EasyTransfer_TX_Example folders within EasyTransfer/examples/ and do the same for the Soft* stuff. This way you’ll have the examples in the correct ways within the File->Examples in the Arduino IDE.

    • rickNo Gravatar says:

      I am having issues with the library when I am using two way communication. I lags both uC down quite a bit…(where the the input controls of on uC are delayed quite a bit from the output of the other uC)I was wondering if anyone has two way working and if I could see there code.

      • BillNo Gravatar says:

        Rick, I’ll try testing it tonight. In the mean time, can you send me your sketches and i’ll see if I find anything that might be the cause. Emaill address in page footer.

    • EugeneNo Gravatar says:

      Great Job on easy transfer. Makes what i am trying to do so much easier! I am trying to setup 2 way comms like cameron but it’s not working for me as well. Basically, what i am trying to do is uno1 has a input switch which turn on uno2 output. uno2 output then send the signal that it receives and into input to activate uno1 output. It’s just to verify that a switch has been turned from uno1 to uno2.


    • BillNo Gravatar says:

      Guys and Gals,

      Version 1.7 includes a 2way example and a critical bug fix that would cause delays and data getting lost altogether, give it a try.

    • darrellNo Gravatar says:

      I just stumbled across your blog!

      Can you use 433mhz rx and tx modules? I
      I have ordered a par of APC220’s but would like to use your library as a replacement to virtual wire! Is that possible with your library?


      • BillNo Gravatar says:

        Hi darrell,

        As of right now, no. But it seems a few have requested the functionality so I am looking into it. No promises on when I’ll have it ready to go though, sorry.

    • darrellNo Gravatar says:

      Thanks Bill.

      I’m also wondering if this library will work with the Attiny core (attiny85 and attiny2313)?

      • BillNo Gravatar says:

        I know the attiny85 doesn’t have a hardware UART and I’m not sure about the attiny2313. If you can get NewSoftSerial to work on an ATtiny then yes, you could get the corresponding version of my library to work as well.

    • FlorianNo Gravatar says:

      i would be really happy to have that code implemented into Processing. Does someone know how to do that?
      It would be really great if someone could help me!

      • BillNo Gravatar says:


        Are you asking to be able to send data between an Arduino and Processing?

        • FlorianNo Gravatar says:

          Yes 🙂
          It would be great if it could be accomplished the same way as the Arduino to Arduino EasyTransfer.
          This way you could easily control your Arduino from the computer (in combination with Xbee for example)

          By the way you got a really great page here! ^^

    • PaulNo Gravatar says:

      Bill, I have a Arduino energy monitor, which serial.prints outputs for four different readings; power1, power2, voltage, & temp.
      A second Ethernet enabled Arduino sends the data to Pachube.
      I have tried for the past week to connect the two via the Rx/Tx pins and transfer the data, AND FAILED!!
      I have found your website tonight and wondered if your library would achieve this.
      Many thanks for any advice or help.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.