In this article we will make a two wheeled robot using Arduino, motor shield and 1Sheeld uses Bluetooth as its communication channel. This will be a two wheeled robot that will be controlled using the game pad in the 1Sheeld application to control the robot.
is a great layer of abstraction to make you use almost all the sensors in your mobile phone to interface with the Arduino.
The code will be so simple as we’ll use the Adafruit library to help us more in reducing our code and circuit wiring using Adafruit shield.
We’ll begin by listing the components then we’ll start off.
Throughout the tutorial I’ll show you the way around how to get the required applications either for your phones or for your PCs.
This tutorial requires basic Arduino knowledge (Arduino power and basic coding).
List of Components
- Arduino Uno / Mega
- PC with Arduino IDE installed
- Android mobile phone with Bluetooth enabled and 1Sheeld application installed
- Adafruit motor shield
- 2-Wheel drive robot chassis
1Sheeld is an open-source product that simplifies the interfaces between your android phone (and soon iPhone) sensors, and the Arduino using Bluetooth technology.
You can literally use all the sensors in your phone to interact with the Arduino and even more than your phone’s sensors. 1Sheeld’s main page can be found here.
The pages explains the shield thoroughly so I’ll let you explore its details and will just mentions the common catches and the starting tips. A direct link to the download section is here. You must download the library and add it to Arduino IDE to start using it. If you’re wondering how to add a library check this link.
Preparing the shield
Download the 1Sheeld app using Google play
Connect the shield to the Arduino -push it gently with equal force on both sides
The Motor Shield
The +M (positive terminal -red-) and GND (negative terminal -black-) terminals will be connected to the battery or the power supply (12v ) which is fine by the Arduino, It also provides power for the Arduino.
Connecting the motors to the motor shield
It’s so simple as you’ll choose a terminal and connect the 2 motor wires, you also should follow a standard connection for each motor, just the same as the wiring example.
The Motor Shield
You’ll need Adafruit library for the motor shield, try the following steps:
- Download the GitHub project as a ZIP file from this link
- Uncompress the ZIP file
- Rename the uncompressed folder AFMotor. Be sure that there are the AFMotor.cpp and the AFMotor.h files in the AFMotor folder.
- Add the library to the Arduino IDE as mentioned in step 1-3
The 1Sheeld App
We’ll use the game pad shield from the application. before using the mobile as a shield you need to find your 1Sheeld and connect to it, if you’re being asked to enter a PIN code enter 1234.
After selecting your 1Sheeld board, you’ll turn on the game pad shield
Then open the shields menu by tapping on the rectangle and stay on the game pad shield screen.
The main difference between the brake condition and the release condition is that in the brake condition the motor is forced to stop at its place, but in the release condition the motor is free to move a little bit according to its inertia.
int ledPin = 13;
/* Use the game pad */
/* Include 1Sheeld library. */
// Motor objects, motor number on the motor shield board
/* Start communication. */
// The LED just works as an indicator that the 1Sheeld is working fine
/* Always check the status of gamepad buttons. */
else if (GamePad.isUpPressed())
else if (GamePad.isLeftPressed())
else if (GamePad.isRightPressed())