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.

    • Michel TerresNo Gravatar says:

      Man, that’s awesome! I’m using your playstation controller library with EasyTransfer library with 2 xbees(one with arduino fio, the other with arduino mega), and it works perfect! thank you.

    • luniaNo Gravatar says:

      i don’t understand why does the EasyTransfer library when i install it on the library and import the library it wont appear and when i insert the example coding it said that ET does not declared.I want to use two Arduino Uno.

    • KendroNo Gravatar says:

      Hi Bill,

      Quick question, how do you send a string/char-array using the library?


    • wayne hallNo Gravatar says:

      Bill, lib works great using same struct with my uno’s

      if I have a struct SEND_DATA_STRUCTURE and struct RECEIVE_DATA_STRUCTURE in an Uno

      will ET.receiveData use RECEIVE_DATA_STRUCTURE
      ET.sendData(); use SEND_DATA_STRUCTURE automatically or do I have to specify something.

      Thanks wayne

      • JoshNo Gravatar says:

        Wayne, I think you would need to create a new instance of EasyTransfer…


        EasyTransfer ETrx;
        EasyTransfer ETtx;

        then assign different struct’s to each and call the respective instances correctly in your code..

        ETrx.begin(details(rxstruct), &Serial);
        ETtx.begin(details(txstruct), &Serial);

        You can of course just Easytransfer the same struct from one device to the other and vice versa tho the difficulty with this depends on what your trying to achieve.


    • shamsheer vermaNo Gravatar says:

      Very helpful 🙂 made my work easy

    • VaseNo Gravatar says:

      Hello, I’m new to arduino. I’m trying to control an arduino with labview (I managed to do that already) and send two pwm values and two digital input values to another arduino through Serial. I tried modifying the LIFA base code that I am uploading in the labview controlled arduino and write a code on the receiver arduino using the Easy_transfer_RX and TX examples but I didn’t managed to make them communicate and I don’t understand what I’m doing wrong. I’m using a arduino mega for labview control and an arduino uno to receive data. The conection between arduinos is RX1-Tx and TX1-rx (I used serial1 to not interfere with labview communication). What can be the problem? sorry for mistakes in writing (my english is not the best)

    • DavidNo Gravatar says:

      I am a new comer to arduino and the last couple of months have been a very steep learning curve.
      I am working on a project that may require 3 or more arduino boards. I need to send data between this group of arduino boards. I understand that if I do not make one of the arduino master by using Wire.begin(). I can make all of them slave and they can be masters if they require to send data.
      How can I send data to and from any arduino board to another eg slave to slave or master to slave. I am using I2C comms. Do I have to write it to the master first and then write to the slave I wish to address.

      • BillNo Gravatar says:

        I2C is built around the premise a single master talks to less-powerful (usually just sensors) slaves. If you have multiple, ‘powerful’ Arduino cores trying to communicate with each other, why are you using I2C?

        And yes, without getting into complicated multiple master configurations, your ‘master’ would have to route all traffic between ‘slaves’.

        • DavidNo Gravatar says:

          Your library makes it so much easier to communicate.
          For this type of project, what form of comms would you suggest instead of I2C? It needs to be relatively quick. I will be using a SD card for data logging and incorporating a GPS device as well.

          • BillNo Gravatar says:

            Quick is relative. I assume you are using a vanilla Arduino and only have one serial port? GPS tends to be slow so you could move that to a software serial port on an unused pin.

            • DavidNo Gravatar says:

              I am communicating between 3 x mega 2560. If not I2C. What would be a better/faster comms to communicate between boards? I am mainly concerned with the speed of comms between boards and have limited it to mostly boolean change of state and int quantities. To try and minimize the traffic – I am checking to make sure the boolean state or value has changed before sending to other boards.

    • TihomirNo Gravatar says:

      Thank you for writing this library.
      Works excellent and saves hours of work.

    • JoshNo Gravatar says:

      Hey Bill, Any chance of compatibility with Arduino Due? 🙂

      • BillNo Gravatar says:

        Don’t know, Don’t have one to test. Depends on how much they changed the core Arduino code.

        • AMacNo Gravatar says:

          It is not compatible without changing some things. I was debugging and the part of the code within receiveData() {

          if (_serial->readByte() == 0x85){
          rx_len = _serial->readByte();
          //make sure the binary structs on both Arduinos are the same size.
          if(rx_len != size){
          rx_len = 0;
          return false;

          This had rx_len = 8 and size = 4. Either I don’t understand something or this means that the arduino DUE uses 8 bit packets.

    • EliNo Gravatar says:

      Great library! Setup for EasyTransferI2C was such a breeze. Thanks a bunch!

    • emielNo Gravatar says:

      I have a question, I am planning to use the library but would like to know if what I am planning would work.
      I have one Arduino that reads the joystick and some buttons that send out a serial signal.
      I can use the library to send these to a other remote arduino, but can I have multiple arduino’s on the remote site. So I select camera 1 and remote arduino should be contacted via Myserial1 and when camera 2 is used Myserial2 should be used, I think I need to have multiple instances of the library running? is that so and if so if that possible.

      Kind regards

    • DucoNo Gravatar says:

      Great library! I used the SoftEasyTransfer library to communicate between an Attiny 85 and my arduino uno. Works perfect.

      • Jeff CNo Gravatar says:

        Duco, I’m trying to do the same thing and its not working, could you share some ideas on how you did it ? maybe some code samples of each sides ?


        • DucoNo Gravatar says:

          Hi Jeff,
          Sorry for my late reply, I was busy with my study project (for which I used the code attached).
          You can find the arduino side here:

          The ATtiny side here:

          What it basicly does:
          It lets you adjust the color of an rgb led on the arduino side with three potentiometers for example. By the press of the sendButton the RGB values are send to the attiny.
          The attiny stores the values and sets its own led to the same color. It will then start sending these values constantly (there isn’t space for a button on the attiny side, but you can let the arduino send a value or something to set it on/off).

          If you press the recieve button on the arduino it will read the values send from the attiny and set its own RGBled to that value.
          I then use a sort of snap function to enable the potentiometers again; you have to turn them untill the sensor value is close to the color value, only then they will start to effect the color again. This snap has to be perfected because it is slow. If you twist the potentiometer too fast it will never match the color value.

          Goodluck! If you have more questions, just reply

    • WillNo Gravatar says:

      Are there any issues with using EasyTransfer with softwareserial.h? Just wanted to check before I write a lot of code that uses both.

    • Hiya all,

      I’ve recently been working on controlling a robotic arm with an iPad and found that the easiest way to make the iPad talk to an Arduino was to make the iPad pretend to speak EasyTransfer.

      So I’ve basically created a port of the EasyTransfer library in Objective-C and you can find it on GitHub. Check it out!

Leave a Reply

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