Using 1Sheeld, remote control an Arduino powered vehicle with the accelerometer in your Smartphone/Tablet.

Step 1: Essentials

You will require the following items, or equivalent.

1) Any Arduino powered vehicle platform. Pictured is the Dagu Wild Thumper 4WD with Sabertooth Dual 25A 6V-24V Regenerative Motor Driver.

2) Power. Pictured is a 6V 10000mAh Rechargeable NiMh Battery with Smart Charger. The size and weight of this pack makes it unsuitable for smaller vehicles, but is perfect for a larger platform such as the Thumper. Using Mini Tamiya Connectors makes connecting your battery pack to your motor driver a little easier.

3) 1Sheeld and Android Smartphone/Tablet

4) SeeedStudio 3 Pin Ultrasonic Range Finder (optional). The 3 pin is better than the available 4 pin sensors because it frees up a pin on your Arduino platform.

All items available at RobotShop

Step 2: Build Your Vehicle

Since this project is not really specific to any vehicle platform, I'll leave it to you to build your own vehicle. Many kits are available, you could build your own from scratch using another Instructable, or your could redeploy a platform you already have.

The Dagu 4WD Wild Thumper is a heavy duty platform that is robust enough to support future projects. Pictured is my "MALP" with a LynxMotion AL5D Robotic Arm on top and a Dagu 2 Degrees of Freedom (2DoF) Robot Arm & Gripper on back.

Want more? The Dagu Wild Thumper is also available in a 6WD version! Details can be seen at time 7:10 of the above Product Showcase video. Make sure you check out the Potato Cannon at time 13:50 !

Visit YouTube to see various videos of the Wild Thumper in action. Provided videos presented here are not my project, but also sourced from YouTube.

Step 3: 1Sheeld Explained

1Sheeld Android Smartphone Multi-Purpose Shield is an easily configured shield for Arduino. It is connected to a mobile app that allows the use of all of Android smartphones' capabilities such as LCD Screen, Gyroscope, Switches, LEDs, Accelerometer, Magnetometer, GSM, Wi-Fi, GPS …etc. into your Arduino sketch.

For more information, visit 1Sheeld Tutorials Archive

Step 4: Sabertooth Motor Driver Explained

The Sabertooth 2X25amp is a versatile, efficient and easy to use dual motor driver. It is suitable for high powered robots - up to 100lbs in combat or 300lbs for general purpose robotics.

The Sabertooth receives power via the B screw terminals, and can power other components via the 5V screw terminal. I did experiment with powering the Arduino from this terminal, but something about the power wasn't "clean enough" ... every time I hammered the throttle to maximum speed, the 1Sheeld would drop the connection. Rather than putting much time into this issue, I just used a separate power source for the Arduino.

Aways ensure the 0V screw terminal is connected to your Arduino ground, otherwise the Sabertooth will not receive control signals from your Arduino.

You can control the Sabertooth via various modes. This project uses Mode 3 Simplified Serial Mode... basically, you send a single byte of data representing a number from a digital pin on your Arduino to the S1 channel on your Sabertooth. In that single byte, you have a range of numbers between 0 (lowest), and 255 (highest)... each number representing a unique motor, direction, and speed setting all in one. The Sabertooth interprets that number and adjusts speed/direction power for either (set of) motors connected to the M1 and M2 screw terminals.

Here is a small code fragment illustrating driving one motor forward 50% and one motor backwards 75%.... 2x4 means 2/4, 1/2, 50% , and 3x4 means 3/4, 75% ...

// Values 1 thru 127 controls Left motor, 128 thru 255 controls Right motor

#define FORWARD_4x4_R_MOTOR 255

#define FORWARD_3x4_R_MOTOR 240

#define FORWARD_2x4_R_MOTOR 224

#define FORWARD_1x4_R_MOTOR 208

#define STOPNOW_0x4_R_MOTOR 192

#define REVERSE_1x4_R_MOTOR 176

#define REVERSE_2x4_R_MOTOR 160

#define REVERSE_3x4_R_MOTOR 144

#define REVERSE_4x4_R_MOTOR 128

#define FORWARD_4x4_L_MOTOR 127

#define FORWARD_3x4_L_MOTOR 112

#define FORWARD_2x4_L_MOTOR 96

#define FORWARD_1x4_L_MOTOR 80

#define STOPNOW_0x4_L_MOTOR 64

#define REVERSE_3x4_L_MOTOR 48

#define REVERSE_2x4_L_MOTOR 32

#define REVERSE_1x4_L_MOTOR 16

#define REVERSE_4x4_L_MOTOR 1


SaberSerial.write( FORWARD_2x4_R_MOTOR ); // 2/4 is 50%

SaberSerial.write( REVERSE_3x4_L_MOTOR ); // 3/4 is 75%

For more details, read the provided PDF documentation, and refer to the provided code later.

Step 5: The Sensor Explained

The ultrasonic sensor operates by sending a short ultrasonic pulse , and measuring the time it takes to receive an "echo" back. The shorter the amount of time, the closer the object.

Using a predefined library (included in provided code), the code to accomplish this is rather simple...


frontRangeInCentimeters = ultrasonicFront.microsecondsToCentimeters();

In the provided code, the ultrasonic sensor is used to override pilot commands to prevent the vehicle from running into a detected obstacle such as a wall. If you chose not to install the sensor, the code can be easily deactivated.

Step 6: The Algorithm - Throttle, Steering

The Accelerometer in your Smartphone/Tablet will control the speed/direction of your vehicle via the installed 1Sheeld app.

Holding your device straight up will stop (park) your vehicle.

Leaning your device away from you (pitch) will move the vehicle forward... the more lean, the faster.

Leaning your device towards you will move the vehicle backwards... the more lean, the faster.

Rolling your device to the left will steer the vehicle to the left, and right steers right.

You can easily make modifications to the sensitivity of the relationship between the device and the vehicle by making the appropriate code changes in the sketch.

Step 7: The Algorithm - Ignition, Throttle Governor

The 1Sheeld Slider is used as an "ignition switch". The vehicle will not run if the slider is at the lowest setting.

The Slider is also used as a "throttle governor". With it set halfway or less, the vehicle will run at a single moderate speed setting, suitable for beginners. More than halfway, all power settings are available.

The code is easily modified if you wanted to tweak the governor for other power settings.

Step 8: Install Code

I've provided an extensively documented Arduino sketch that provides the functionality as described in the previous steps..

If you've configured your components correctly, it should work as is. Some fine tuning will probably be required. Or, you could hack the code to suit your needs.

Step 9: Your Turn to Code!

With an impressive array of available 1Sheeld controls, you'll have lots of other potential projects for your vehicle.

For more information on the robotic arm, visit my related Instructable 1Sheeld Controlled Robotic Arm

<p>Blaine,</p><p>One question I have is does the robot follow you with you in the vicinity? Like within a couple feet of you? I have seen guys do it at indy where they put a little transmitter on their belt or in a pocket and have their cooler follow behind. The technology is pretty simple and all of the heavy lifting is done by the cooler</p>
We have been trying to make a Follow Me Robot. gPS too much drift. want something different than opencv. Also want to avoid ultrasonis. We think two 1sheelds with streamung maconmpass direction might work but don't know how to put it together.
Since compass directions can be sinced thought of putting servo on top of shaft of Tricycle wheel on go cart bough at Walmart so that when 1Sheeld says I am walking one degree East from due South then bot follows by one degree East from due South. We were assuming that the 1Sheeld magnetometers were going to be much more accurate than the GPS. Thank you very much for your instructable. We looked at the 1Sheeld video showing control of a robot arm, bought the Sabertooth, the tricycle gocart etc. but could not understand how to use the streaming data from apps like Sensor Data and Sensor Log to control the Sabertooth. Maybe some kind of frequent GPS checking and a way to maintain a relative distance (ultrasound) perhaps as close as five feet from the bot would enable it to be a reliable carrybot. Were looking for something that would avoid Pixhawk, the controller, and the follow feature in something like 3Dr. Ardupilot has code on follow me for rover http://ardupilot.com/forum/viewtopic.php?t=12801&amp;p=38927
<p>I've played a little with the GPS app on 1Sheeld to see if it would be possible to place a vehicle somewhere inside a gymnasium and see if it would drive itself to a predetermined spot ( ie the center of the gym). The Android device would be attached to the vehicle so it knows where it is, and then it's just a bunch of math to get the vehicle to move in the direction of the pre-programmed set of target coordinates. My initial experiments lead me to believe that it's possible to an acceptable degree of accuracy, but I haven't had time to devote to the project.</p><p>If we could get that solved, then the next logical step would be to replace the fixed target with &quot;you&quot;, and yes, it would involve doubling your gear. The Android/Arduino/1Sheeld setup fixed on the vehicle would be responsible for driving towards the target. Then, you would have a second Android device on *you* sending signals back to *another* Arduino/1Sheeld on the vehicle which gets &quot;your&quot; coordinates, then communicates them to the first setup via good old fashioned hardwired Arduino-Arduino communications. The first setup then keeps working away at getting &quot;its coordinates&quot; to match the &quot;target&quot; coordinates (that are now constantly changing).</p><p>I can see all the tech easily enough, I think the biggest problem is a barrel of math. </p><p>On my list of things to do of &quot;potential projects to tackle in the next year&quot;. Would be a great add-on to my MALP :) </p>
Maybe there is a compass heading servo. could wear droid on my hat so servo turns the droid as i go in different directions. The bot would follow my direction but there would be ten foot distance. Speed would be controlled by how fast I would be walking. ultrasonic could detect obstacles and stop bot when necessary. need wheelchair bot to carry supllies when walking on level wide trails.
<p>This looks like the answer to my questions that I have been waiting a long time for, or at the very least now has me pointed in the right direction. Will the App work on my Moto X Android 5.1 phone? also Do you know if the Sabertooth 2X60 dual motor driver work the same as the Sabertooth 2X25 ?</p>
1Sheeld claims to work on Android versions 4.0 and up.<br><br>The Sabertooth 2x60 documentation reads the same as the 2x25, so I assume it works the same, but with 60amp capability vs 25amp. Quite the beast :)
<p>I just wrote a reply but I can't tell if it sent it or trashed it</p>

About This Instructable




Bio: I make things. I teach other people to make things. On the weekends, my wife makes me do home renovations.
More by L1Ranger:Heads Up Display (HUD) Control for Nerf Vulcan Sentry Gun WiFi / Internet / Android Controlled Nerf Vulcan Sentry Gun 1Sheeld Controlled Robotic Arm 
Add instructable to: