element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino Projects
  • Products
  • Arduino
  • Arduino Projects
  • More
  • Cancel
Arduino Projects
Blog Arduino Uno Pololu VNH 5019 Motor Shield using 2 Motors and 1 Joystick and 2 Xbee for wireless communication
  • Blog
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino Projects to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fabiolus
  • Date Created: 24 Jun 2025 5:49 PM Date Created
  • Views 273 views
  • Likes 1 like
  • Comments 3 comments
  • joystick
  • motors
  • xbee
  • arduino
Related
Recommended

Arduino Uno Pololu VNH 5019 Motor Shield using 2 Motors and 1 Joystick and 2 Xbee for wireless communication

fabiolus
fabiolus
24 Jun 2025

This video demonstrates how to wirelessly control two DC motors using two Arduino Unos. One Arduino acts as a controller with a joystick and XBee module, while the other acts as a receiver with a motor shield and XBee module. The video shows the connections and provides a basic overview of the code used to read joystick input and control the motors wirelessly.

Project#1

DualVNH5019MotorShield library
2 x Arduino Uno
2 x xbee series 1
1 x tumb joystick
1 x 9 Volt power pack
1 x Pololu VNH5019 Motor Shield
2 x 12 Volt dc motors
1 x power supply 12V


GitHub:
https://github.com/Fabiolus2020/ArduinoUno_1Joystick_2Motors_2Xbees_DualVNH5019MotorShield 


EasyTrasnfer library:

https://github.com/madsci1016/Arduino-EasyTransfer 

Example Sketch:

https://codebender.cc/example/EasyTransfer/EasyTransfer_2Way_wPot_Example#EasyTransfer_2Way_wPot_Example.ino 

Pololu VNH5019 user guide
https://www.pololu.com/docs/0J49/all 

How to program Xbees
https://learn.sparkfun.com/tutorials/exploring-xbees-and-xctu/all 

Demo Video

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

controller sketch

//created by Fabiolus 2021/01/08


#include <EasyTransfer.h>

//create two objects
EasyTransfer ETout;
const int potpin1 = A0;
const int potpin2 = A1;


struct SEND_DATA_STRUCTURE {
  //put your variable definitions here for the data you want to receive
  //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
  int valX;
  int valY;

};

SEND_DATA_STRUCTURE txdata;

void setup() {
  Serial.begin(9600);

  //start the library, pass in the data details and the name of the serial port. Can be Serial, Serial1, Serial2, etc.
  ETout.begin(details(txdata), &Serial);

}

void loop() {
  txdata.valY = analogRead(potpin1);
  txdata.valX = analogRead(potpin2);

  ETout.sendData();

}

receiver sketch

//created by Fabiolus 2021/01/08


#include <DualVNH5019MotorShield.h>
#include <EasyTransfer.h>
DualVNH5019MotorShield md;

void stopIfFault()
{
  if (md.getM1Fault())
  {
    Serial.println("M1 fault");
    while (1);
  }
  if (md.getM2Fault())
  {
    Serial.println("M2 fault");
    while (1);
  }
}

EasyTransfer ETin;

struct RECEIVE_DATA_STRUCTURE {
  //put your variable definitions here for the data you want to receive
  //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
  int valX;
  int valY;

};

RECEIVE_DATA_STRUCTURE rxdata;

void setup() {
  Serial.begin(9600);

  md.init(); //initiates default pololu shield pins
  ETin.begin(details(rxdata), &Serial);

}

void loop() {

  for (int i = 0; i < 5; i++) {
    if (ETin.receiveData()) {

      rxdata.valY = map(rxdata.valY, 0, 1023, -255, 255);
      rxdata.valX = map(rxdata.valX, 0, 1023, -255, 255);

      if (rxdata.valX >= 10)
      {
        md.setM1Speed(rxdata.valX);
        md.setM2Speed(rxdata.valX);
        stopIfFault();
      }

      else if  (rxdata.valX <= -10)
      {
        md.setM1Speed(rxdata.valX);
        md.setM2Speed(rxdata.valX);
        stopIfFault();
      }

      else if  (rxdata.valY <= -10)
      {
        md.setM1Speed(rxdata.valY);
        md.setM2Speed(-rxdata.valY);
        stopIfFault();
      }


      else if  (rxdata.valY >= 10)
      {
        md.setM1Speed(-rxdata.valY);
        md.setM2Speed(rxdata.valY);
        stopIfFault();
      }

      else {
        md.setM1Speed(0);
        md.setM2Speed(0);
      }
    }
    delay(10);
  }
}

  • Sign in to reply
  • cstanton
    cstanton 24 days ago in reply to fabiolus

    Hi fabiolus , you can insert video from the 'insert' menu, you can either upload it into the Community or insert a link from youtube.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fabiolus
    fabiolus 24 days ago in reply to DAB

    Sorry Dab, I will fix this but you can copy/paste in the meantime.

    thank you

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB 24 days ago

    No video and none of the links are active.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube