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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • 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
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • 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 Use your Android phone as remote control for your rover
  • 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: madhugovindarajan
  • Date Created: 13 Sep 2018 7:51 PM Date Created
  • Views 1245 views
  • Likes 8 likes
  • Comments 1 comment
Related
Recommended

Use your Android phone as remote control for your rover

madhugovindarajan
madhugovindarajan
13 Sep 2018

image

Introduction

This project is an extension of the mobile rover project in the Arduino Engineering Kit. I added the following features to change how one can control the rover –

  • Instead of programmatically specifying a set of waypoints for the rover to travel, I control it using my android phone.
    • The inspiration for this project came from remote controlled cars, hence the design – tilt phone forward and backward to control the drive and tilt the phone sideways to control the steering.
  • Instead of controlling rotation angle or distance moved, I implemented separate PID Controller on each wheel to get the desired angular velocity.

Here is a video of the final project in action.

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

 

Simulink to program Arduino and Android

image

Simulink is a block diagram-based environment for modeling and simulating dynamic systems. You can develop algorithms here that can be embedded directly onto Arduino and other hardware devices including Android phones. When deployed to the phone, Simulink builds an Android app on your phone, which can be used to a) access different sensors and b) visualize them on your phone.

There are two Simulink models associated with this project: an Arduino model and an Android model. The Arduino model is deployed to the rover, while the phone model is deployed to the Android device.  Both models contain TCP/IP send and receive communication blocks that allow the devices to talk to each other over Wi-Fi. All we have to do is type the IP address of each device and specify a unique port for the communication to work.

Arduino model

image

Phone model

image

Phone App

image

 

Now let’s dig a little deeper into the models.

 

In the Android model, The DeviceOrientation block outputs the XYZ tilt of the phone. Since, we only need the X and Y values to control the rover; only those two are sent and they are also displayed on the Android app for reference. A slider is used that ranges from 1-4 to control which state the rover is in: disable, drive, turn, or move forklift. Another slider is used to control the forklift angle. Each block is connected to the TCP send and the datatype conversion block is used to make sure the data transfer to the Arduino is seamless.

 

In the Arduino model, TCP receive blocks are used to read the data sent by my phone (as long as they are on the same Wi-Fi network). These blocks, along with encoder speed calculation blocks from the Arduino Engineering Kit Learning materials act as the inputs to the control logic. Before I describe the logic in detail, the outputs of the logic are angular velocity command to each dc motor, and angle command to the servo. These are then fed into the respective motor block.

 

State Logic

image

The logic consists of 4 states:

  1. disabled - here the wheel velocities are always commanded to be zero
  2. WheelCtrl - here the rover is driven straight using PID control
  3. AngleCtrl - here the rover is turned according to the turn commands from the phone using PID control
  4. forklift - here the forklift can be controlled using the commands from the phone.

As mentioned before, The PID control is different from the Engineering kit models because with good wheel speed control we can achieve better straight-line motion. I set a 15-degree cushion. What this means is that when I turn the phone, it starts moving the rover itself only after reaching this mark so that small changes do not command the rover.

The WheelCtrl and AngleCtrl states read the speed from the TCP receive block in deg/s and sends that as the reference speed for the PID controller to both wheels. Both states use the same PID controller.

The forklift state reads the commanded angle from the slider on the app and commands the servo to that angle.

Future ideas

  1. Implement a feature to turn and drive the rover simultaneously (like a car).
  2. Have the forklift motion be smooth, by adding more resolution to the commanded angle.
  3. Remove the slider that changes rover’s states. This can be done by adding some smarts to the algorithm which will decide automatically which state the rover should be in based on the tilt of the phone.

Note: All these techniques described here can be used to program any Arduino and Android device.

The models can be downloaded here.

  • Sign in to reply
  • madhugovindarajan
    madhugovindarajan over 7 years ago

    For those who are interested to learn more about the kit, here is a recent webinar that my colleague Dan and I gave - https://www.mathworks.com/videos/classroom-ready-projects-with-the-new-matlab-and-simulink-based-arduino-engineering-kit-1537279713545.html

    • 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