ROVER ShiELD User Guide v1.0 v1.0 Oct 1, 2014 This guide is only available in English Ce manuel est seulement disponible en Anglais RobotShop Inc. www.RobotShop.
Description The DFRobotShop Rover Shield is the ideal “all in one” shield for small, Arduinobased mobile robot development. The shield allows you to power your Arduino using a 3.7V LiPo battery and even has a 3.7V LiPo charger onboard, allowing you to charge the battery via USB. The onboard L298P Hbridge (dual brushed DC motor controller) is perfect for controlling two small, low voltage gear motors such as those offered by Tamiya, and allows for full control over speed and direction.
Pinout The following pins are permanently connected. If you wish to stack other boards, be sure to check that the same pins are not used for each shield. If you choose not to use specific features, such as the onboard motor controller, then you can still send signals via the I/O pins to the other shields.
Features Dual DC Motor Controller / Hbridge These two pairs of screw terminals are for connecting two small DC motors. M1 and M2 are silkscreened on the shield. The chip used, the L298P, is intended to be used with brushed DC motors and can provide at most 2A per channel. When running DC brushed motors, be sure to leave them time to cool down as the duty cycle (time in operation vs time cooling off) is around 25%. IR Receiver This is the infrared receiver.
JST LiPo connector The mini JST connector is intended to be used with a 3.7V LiPo battery, though you can use it with other power sources such as NiMh, Alkaline or other. The onboard voltage regulator will provide this voltage directly to the motors (unregulated) and regulate (step up or step down) the voltage to be used by the Arduino microcontroller and other electronics.
XBee Headers The XBee headers included on the board are ideally used for wireless communication. They are compatible with normal series 1 and series 2 XBee modules, as well as many Bluetooth and WiFi modules which have an XBee footprint. Be sure to install the module in the same orientation as the silkscreen on the board. When uploading code to the microcontroller, either the wireless XBee module needs to be removed, or the shield itself needs to be removed.
Power Pins In addition to the JST connector, there are two unpopulated connections which allow you to solder your own connector or cable. Reset The reset button provides the same functionality as the reset button found on the Arduino microcontroller, but saves you the trouble of having to remove the shield to access the one on the Arduino. Turning the board Off and then On again has the same effect. RobotShop Inc. www.RobotShop.
Sample Code When connected to an Arduino microcontroller, the DFRobotShop Rover Shield adds the basic hardware needed to run a small mobile robot. We offer basic software examples below to help get you started in programming mobile robots and Arduino. The code below is not “optimized” but is intended to get you started with each of the main features of the shield. Sketch #1: Basic Rover – Full speed forward The code below will cause both motors connected to the onboard Hbridge to rotate at full speed.
Motor Controller W/A/S/D Computer Control Code The code below allows serial commands to be sent to the DFRobotShop Rover by either a wired (USB) or wireless (Bluetooth, XBee) connection. If you are planning to create your own code, you can use this to get a basic understanding as to how to run the motors. The keyboard commands are: ● "w" : drive forward ● "a" : rotate clockwise (i.e. left) ● "s" : rotate counterclockwise (i.e.
break; case 's'://Move Backwards reverse (leftspeed,rightspeed); break; case 'a'://Turn Left left (leftspeed,rightspeed); break; case 'd'://Turn Right right (leftspeed,rightspeed); break; default: stop(); break; } } void stop(void) //Stop { digitalWrite(E1,LOW); digitalWrite(E2,LOW); } void forward(char a,char b) { analogWrite (E1,a); digitalWrite(M1,LOW); analogWrite (E2,b); digitalWrite(M2,LOW); } void reverse (char a,char b) { analogWrite (E1,a); digitalWrite(M1,HIGH); analogWrite (E2,b); digitalWrite(M2
Encoders - Counting The code below simply counts the number of changes as viewed by a single channel analog encoder. The suggested encoder (Tamiya Encoder Kit) uses a disc with 8x white sections and 8x cutouts. This will provide a count of 16 per 360 degree rotation. It is up to you to optimize and integrate it with your code. The code also sends commands to the motors to have them rotate.
Determining IR Codes The code below will help you determine the values for the signals being sent from an IR remote control. Note that the code does not work for all IR remotes and may need to be customized. Copy and paste all of the code (in italics) below into the Arduino window (as a new “sketch”). Note that this code will only work if you have the IRemote library successfully installed (see instructions above). #include #include
Sample IR code w/ Motor Control The following code has the rover move forward for a specific time when a specific IR code is detected. We encourage you to understand the WASD code provided above and use the sample code below as a template in order to make an IR controlled rover. #include #include
HyperTerminal Control To access Hyperterminal in Windows XP / 2000: Start > All Programs > Accessories > Communications > HyperTerminal Windows 7 does not come with Hyperterminal as a standard feature, so you must find an alternative. Note that hypertrm.exe is available online and emulates Hyperterminal. RobotShop Inc. www.RobotShop.
The name “DFRobotShop Rover is not necessary; you can name it whatever you want. Specify the COM port (USB) that is connected to the DFRobotShop Rover. If you are using XBee, Bluetooth or RF, select the COM port connected to the Bluetooth dongle / XBee breakout / RF Transmitter (USB). No configuration is needed for the DFRobot Bluetooth Module – simply connect to it in your Bluetooth application and the module installed on the DFRobotShop Rover will be picked up (assuming it is powered).
The Bits per second should correspond to the Serial communication Baud rate in the Arduino code. In the sample code, we selected 9600. Flow control Xon/Xoff works best. Of course, make sure the On/Off switch on the robot is set to ON (closer to the power input). Use the W, A, S, D and X keys to move the robot. Note that if you purchased the basic kit, you will need to have the robot connected to the computer via USB for it to receive commands. RobotShop Inc. www.RobotShop.