background image

Each motor’s positive terminal is indicated by a plus sign (+) in the black plastic end of the motor,
as indicated in the picture below. The motors should be soldered into the shield with the positive
terminal closest to the front, so you should attach the leads to allow the motors to be oriented this way.
(However, don’t worry if you accidentally get the orientation of one or both motors wrong. You can later
compensate for it in software with our

Zumo Shield Arduino library

[https://www.pololu.com/docs/0J57/

6]

.)

10. Place the motors into the channel in the front of the chassis, aligning the gearbox with the

grooves in the channel. The front plate of the gearbox should be even with the edge of the
chassis.

Pololu Zumo Shield for Arduino User’s Guide

© 2001–2019 Pololu Corporation

2. Assembly

Page 15 of 52

Summary of Contents for Zumo Shield For Arduino

Page 1: ...Pololu Zumo Shield for Arduino User s Guide Pololu Zumo Shield for Arduino User s Guide 2001 2019 Pololu Corporation https www pololu com docs 0J57 all Page 1 of 52 ...

Page 2: ...erometer magnetometer and gyro 36 4 Schematic diagrams 39 5 Arduino pin assignment table 40 6 Zumo Shield Arduino library 41 7 Example sketches 44 7 a RC Zumo 44 7 b Simple border detecting sumo robot 45 7 c Collision detecting sumo robot 47 7 d Line follower 47 7 e Maze solver 47 7 f Using the compass 48 8 Controlling a servo 49 8 a Controlling a servo with an Arduino Uno 49 8 b Controlling a ser...

Page 3: ...es all the electronics necessary to power the motors and includes some additional fun components for making a more interesting robot such as a buzzer for making sounds and inertial sensors including an accelerometer and gyro Zumo Shield for Arduino v1 2 as it ships assembled with surface mount components only Assembled Zumo Robot for Arduino with an Arduino compatible A Star 32U4 Prime LV A Zumo c...

Page 4: ...03DLHC https www pololu com product 2124 accelerometer and magnetometer Zumo Shield https www pololu com product 2504 Zumo robot kit for Arduino https www pololu com product 2505 Zumo robot for Arduino https www pololu com product 2506 July 10 2015 update The Zumo Robot for Arduino now features black spoked sprockets in place of the original white ones which can still be seen in some of the pictur...

Page 5: ...m product 1419 installed Zumo Shield The shield itself comes with the following components right angle slide switch two pushbuttons https www pololu com product 1400 buzzer 2 pin battery charging header https www pololu com product 1012 three jumper wires for soldering motors to the shield two 25 pin 0 1 straight breakaway male headers https www pololu com product 965 four blue shorting blocks htt...

Page 6: ...r 1 4 2 56 screws and nuts Battery terminals Basic sumo blade for Zumo chassis https www pololu com product 1410 You will receive the black acrylic spacer and mounting plates with protective paper masking on both sides You can peel this masking off to expose the acrylic surface or you can leave it on to increase the thickness of the plates The shield and chassis kit include extra parts like jumper...

Page 7: ...components found in the Zumo robot kit for Arduino along with these additions Two 75 1 HP micro metal gearmotors https www pololu com product 2361 Zumo reflectance sensor array https www pololu com product 1419 Pololu Zumo Shield for Arduino User s Guide 2001 2019 Pololu Corporation 1 Overview Page 7 of 52 ...

Page 8: ...al gearmotors https www pololu com category 60 micro metal gearmotors we recommend 100 1 75 1 or 50 1 gear ratio versions with HP https www pololu com category 173 6v high power hp micro metal gearmotors or HPCB https www pololu com category 174 6v high power carbon brush hpcb micro metal gearmotors motors The pre assembled version of the Zumo robot https www pololu com product 2510 includes two 7...

Page 9: ...adjustable temperature control Wire cutter Small Phillips screwdriver 3 mm Allen wrench hex key long nose pliers for bending the Zumo blade mounting tabs 2 b Assembling the Zumo Shield and chassis Please follow these instructions carefully to assemble your Zumo Shield and chassis properly These pictures show the original Zumo Shield https www pololu com product 2504 but the assembly process is the...

Page 10: ...at on the spacer plate and chassis Arduino headers 3 Separate the 1 40 pin breakaway male header into the appropriate segments for connecting your Arduino and solder them to the shield These header segments should be soldered to the sets of holes outlined with white rectangles on the top of the shield with the pins facing up The A Star 32U4 Primes and the newest Arduino boards including the Uno R3...

Page 11: ...ow Be careful to insert the header pins into the correct set of holes before you begin soldering Note if you use this alignment technique make sure your soldering iron temperature is not excessively hot and avoid holding the iron on a single pin for more than a few seconds as this could melt the Arduino s female headers 4 On the bottom of the board trim the four Arduino header pins closest to the ...

Page 12: ...roken by cutting the trace on the top of the board between the holes Note there is not enough clearance to use male headers on the battery level and compass I C jumpers if you are using an Arduino with a DIP through hole microcontroller Instead of making a wire connection you can solder a 1 3 male header to the buzzer jumper holes to allow the use of a shorting block for connecting the buzzer You ...

Page 13: ...he board and if you add any through hole parts to the prototyping areas on the shield you will need to drill corresponding holes in the acrylic spacer plate for the leads to fit into Motors and drive sprockets 7 Press the output shafts of the motors into the drive sprockets with the raised lip on one side of the sprocket facing away from the motor as shown below The end of the gearbox shaft should...

Page 14: ... it helpful to make a small bend at the tip of each lead to hook into the hole in the motor lead tab to hold it in place for soldering Warning holding the soldering iron against the motor lead for more than a few seconds can start to damage the motor brushes so try to be reasonably quick efficient with this soldering if the first attempt does not go well remove the soldering iron and let the motor...

Page 15: ... way However don t worry if you accidentally get the orientation of one or both motors wrong You can later compensate for it in software with our Zumo Shield Arduino library https www pololu com docs 0J57 6 10 Place the motors into the channel in the front of the chassis aligning the gearbox with the grooves in the channel The front plate of the gearbox should be even with the edge of the chassis ...

Page 16: ...s will not be able to rotate within them These nuts will be used to mount the idler sprockets later 12 If you want peel the protective paper masking off both sides of the acrylic spacer plate pieces Alternatively you can leave the masking on for additional thickness If you leave the masking on it will be mostly concealed when the robot is fully assembled 13 Cover the chassis and motors with the sp...

Page 17: ...rs or battery terminals 14 In each of the four mounting holes insert a 2 56 machine screw through the shield spacer plate and chassis and tighten it against a nut under the chassis It is usually easier to place the nut into the recess first and hold it there with a finger or piece of tape while inserting the screw Note that the kit includes two different sizes of 2 56 machine screws 1 4 and 5 16 T...

Page 18: ...nd battery contacts Note If you intend to solder anything to the front expansion area of the shield such as a Zumo reflectance sensor array you will have more room to work if you do the soldering before adding the sumo blade To install the blade first bend its mounting tabs to the appropriate angle Next place them on top of Pololu Zumo Shield for Arduino User s Guide 2001 2019 Pololu Corporation 2...

Page 19: ... adjusting the angle of the sumo blade while it is mounted to the chassis as this can crack the acrylic spacer plate if you apply sudden or excessive force We recommend you do not try bending the blade while it is mounted to the chassis 15 Solder each motor lead to the shield then trim off the excess length of wire Pololu Zumo Shield for Arduino User s Guide 2001 2019 Pololu Corporation 2 Assembly...

Page 20: ...he two individual contacts should be inserted into the battery compartment so that their solder tabs protrude through the holes in the top of the chassis you might want to temporarily tape these two individual contacts in place until they have been soldered to the shield as described in the next step or you can use a battery to temporarily hold them in place Pololu Zumo Shield for Arduino User s G...

Page 21: ...otruding side of the sprocket hub should face the same direction as the threaded end of the bolt in toward the chassis 19 Insert the shoulder bolts through the side of the chassis into the nut Use a 3 mm hex key Allen wrench to tighten the bolts until the washers are snug against the chassis Be careful not to overtighten the shoulder bolts as doing so can bend the washers Note Be careful if you us...

Page 22: ...g them around the sprockets on each side of the chassis Your Zumo Shield and chassis are now complete just add batteries and an Arduino to get your Zumo robot moving Pololu Zumo Shield for Arduino User s Guide 2001 2019 Pololu Corporation 2 Assembly Page 22 of 52 ...

Page 23: ...everse Make sure to replace the spacer plate pieces properly 2 c Adding a Zumo reflectance sensor array optional Overview The Zumo reflectance sensor array https www pololu com product 1419 is an easy way to add line following and edge detection capabilities to the Zumo robot It is designed specifically to mount to the front expansion area of the Zumo shield and it includes everything you need for...

Page 24: ...oldered to sensor PCB blue shorting block Before soldering in the main male header strip we recommend soldering one of the two included 1 3 male headers into the set of three holes along the edge of the board This step is optional but recommended because it allows dynamic control of the IR emitters and red LEDs By controlling when these LEDs are on you can save power and make your programs easier ...

Page 25: ... if you are using an Arduino Leonardo or A Star 32U4 Prime you should use the shorting block to connect LEDON to analog pin 4 A4 The extended 2 12 male header strip should be mounted to the sensor array PCB on the opposite side from the components Make sure you solder the shorter side of the pins to the PCB not the longer side Note that only 12 of the 24 pins are actually used by the sensor array ...

Page 26: ...With the female header in place the assembled sensor array can be plugged directly into the Zumo shield Pololu Zumo Shield for Arduino User s Guide 2001 2019 Pololu Corporation 2 Assembly Page 26 of 52 ...

Page 27: ...y call init with no arguments If you opt to leave off the LEDON shorting block you should use the QTR_NO_EMITTER_PIN initialization parameter reflectanceSensors init QTR_NO_EMITTER_PIN Otherwise the library code will still be trying to do something with the emitter pin A4 or 2 depending on which Arduino you are using and this would interfere with your being able to use that pin for alternate purpo...

Page 28: ...no I O line and the left hole connects to sensor There is a single trace on the component side of the PCB between the two holes of each pair and this trace can be cut to disable the sensor and free up the I O line The proper place to cut is marked on the silkscreen by carets For example if you want to use your Zumo for solving a line maze you can likely get by with just four sensors you can use th...

Page 29: ...e those sensors you can connect across the cut trace with a wire or you can use a wire to remap the sensor to a different pin The following example shows how you could re enable the A2 sensor and remap the A3 sensor to pin A5 instead To configure the ZumoReflectanceSensorArray object to use this remapped configuration call init with these arguments Or if you are not using an I O line to control th...

Page 30: ... inertial sensors Power The Zumo chassis has an internal compartment for four AA batteries We recommend using rechargeable AA NiMH cells https www pololu com product 1003 which results in a nominal voltage of 4 8 V 1 2 V per cell You can also use alkaline cells which would nominally give you 6V A direct connection to the battery terminals is provided by the battery charger connector on the rear Po...

Page 31: ...o will create a short between the shield s power supply and the Arduino s power supply that could permanently damage both the Arduino and the Zumo Shield When the Arduino is connected to a computer via USB it will receive power and supply 5V and 3 3V to the shield even when the Zumo Shield s power switch is off This can be useful if you want to test your Arduino program without allowing the motors...

Page 32: ...ith a buzzer that can be used to generate simple sounds and music for example you could use it to produce an audible countdown at the beginning of a sumo match The buzzer control line is labeled BZ on the shield if you alternate between driving it high and low at a given frequency the buzzer will produce sound at that frequency The ZumoBuzzer object in the Zumo Shield Arduino library https www pol...

Page 33: ...o the two I C pins SDA and SCL However please note that the I C pins are not independent pins they are respectively duplicates of analog pins A4 and A5 on the Uno R3 and digital pins 2 and 3 on the Leonardo and A Star 32U4 Prime Typically you will only be able to use these pins for either I C communication or general I O not both Additionally pin A1 is used to monitor the battery voltage if you in...

Page 34: ...le if you are not using I C These pins are not accessible via the front expansion but they can be accessed from other points on the shield and used for interfacing with additional electronics if free Additionally digital pin 12 can be used for interfacing with many types of additional electronics especially if you are not using the shield s user pushbutton Pin 12 is completely free when the pushbu...

Page 35: ...5 To convert it back to the actual battery voltage multiply this number by 5000 mV 3 2 and divide by 1023 The buzzer control jumper connects one of the Arduino s PWM outputs to the buzzer on the Zumo Shield This jumper is disconnected by default on both the assembled and kit versions of the Zumo robot it must be connected to enable the buzzer If you have an Arduino Uno or an older Arduino with an ...

Page 36: ...in 5 and SDA to analog pin 4 on the Zumo Shield in order to use the compass with an older Arduino The most convenient place to do this is in the front expansion area where these pins are all located together as indicated by the light blue boxes in the picture above More details about the inertial sensors can be found in Section 3 d Instead of making a wire connection you can solder a 1 3 male head...

Page 37: ... a basic LSM303 Arduino library https github com pololu lsm303 arduino and L3G Arduino library https github com pololu l3g arduino included with the Zumo Arduino Shield library https www pololu com docs 0J57 6 that makes it easier to interface the sensors with an Arduino as well as an example project https www pololu com docs 0J57 7 f that demonstrates how to use the magnetometer to help the Zumo ...

Page 38: ...the x and y axes so you probably will want to ignore the z readings We were generally able to get decent results using only the x and y magnetometer readings to determine heading Additionally you might need to decrease the magnetometer sensitivity if the magnetometer returns a value of 4096 that is a sign that the sensitivity range is set too narrow for your particular environment Pololu Zumo Shie...

Page 39: ...eld schematic diagrams https www pololu com file 0J779 zumo shield v1_2 schematic pdf 449k pdf Original Zumo Shield schematic diagrams https www pololu com file 0J591 zumo_shield_schematic pdf 121k pdf Pololu Zumo Shield for Arduino User s Guide 2001 2019 Pololu Corporation 4 Schematic diagrams Page 39 of 52 ...

Page 40: ...n control line 8 left motor direction control line 9 right motor PWM control line 10 left motor PWM control line 11 digital I O front expansion 12 digital I O user pushbutton pressing pulls low 13 digital I O yellow user LED high turns LED on Analog pins Zumo Shield function Notes alternate functions A0 analog input and digital I O front expansion A1 analog input and digital I O front expansion op...

Page 41: ...mo shield arduino library master to ZumoShield 3 Move the ZumoShield folder into the libraries directory inside your Arduino sketchbook directory You can view your sketchbook location by opening the File menu and selecting Preferences in the Arduino IDE If there is not already a libraries folder in that location you should make the folder yourself 4 After installing the library restart the Arduino...

Page 42: ...ctanceSensorArray ZumoReflectanceSensorArray provides a set of functions for reading reflectance values from a Zumo reflectance sensor array https www pololu com product 1419 See Section 2 c for more information on the Zumo reflectance sensor array This depends on QTRSensors The ZumoReflectanceSensorArray class is a subclass of QTRSensorsRC The functions provided by QTRSensorsRC can also be used o...

Page 43: ...ds based on the ATmega32U4 this library uses Timer 4 and pin 6 PD7 OC4D This library will conflict will other libraries that use the same timer or pin Pushbutton Pushbutton https github com pololu pushbutton arduino provides a set of functions that are useful for detecting and debouncing pushbutton presses While the most obvious application of this library is to work with the Zumo Shield s user pu...

Page 44: ...rary https www pololu com docs 0J57 6 installed the sketch file can be opened in Arduino by selecting File Examples ZumoShield RCControl A Zumo robot with an RC receiver attached to make a radio controlled vehicle An easy way to connect the receiver to the Zumo Shield is to solder two 1 3 male header strips https www pololu com product 965 to the locations shown in the diagram below then plug in a...

Page 45: ...ut of a circular ring it is important for a robot to be able to detect the border of the ring so it can avoid driving over the edge Since standard robot sumo rings are colored black with a white border around the edge infrared reflectance sensors like our QTR sensors https www pololu com category 123 pololu qtr reflectance sensors are great for this purpose The Zumo Reflectance Sensor Array https ...

Page 46: ...ropriate for slower motors We found that these default values worked well with a Zumo using 75 1 HP motors https www pololu com product 2361 Finally the sensor reading threshold used to differentiate between black and white surfaces QTR_THRESHOLD might need to be changed to suit your lighting and ring conditions Upload the sketch to an Arduino mounted on a Zumo place the Zumo on a sumo ring or a s...

Page 47: ...cts contact the Zumo speeds up which should allow it to either more effectively push the opponent out of the ring or to escape the opponent if it collided at an undesired angle from the rear or side To read more about how this program works please see the comments contained in SumoCollisionDetect ino 7 d Line follower This example program demonstrates how a Zumo with a reflectance sensor array htt...

Page 48: ...le can be opened in Arduino by selecting File Examples ZumoShield Compass Because the batteries motors and motor current affect the z axis of the magnetometer much more strongly than the x and y axes this program calculates the Zumo s orientation using only the x and y readings from the magnetometer assuming that the robot is always level In order to prevent external locally varying magnetic field...

Page 49: ...ecial to get servo control working To control a servo with an Arduino Uno see Section 8 a To control a servo with an Arduino Leonardo or A Star 32U4 Prime see Section 8 b 8 a Controlling a servo with an Arduino Uno The example Arduino Uno code below shows how to control a single servo using Timer 2 Because it uses Timer 2 instead of Timer 1 this code does not interfere with ZumoMotors but it will ...

Page 50: ...IN 11 This is the time since the last rising edge in units of 0 5us uint16_t volatile servoTime 0 This is the pulse width we want in units of 0 5us uint16_t volatile servoHighTime 3000 This is true if the servo pin is currently high boolean volatile servoHigh false void setup servoInit void loop servoSetPosition 1000 Send 1000us pulses delay 1000 servoSetPosition 2000 Send 2000us pulses delay 1000...

Page 51: ...se The servo pin is currently low if servoTime 40000 We ve hit the end of the period 20 ms so do a rising edge highTimeCopy servoHighTime digitalWrite SERVO_PIN HIGH servoHigh true servoTime 0 interruptCount 0 OCR2A highTimeCopy 256 256 2 1 void servoInit digitalWrite SERVO_PIN LOW pinMode SERVO_PIN OUTPUT Turn on CTC mode Timer 2 will count up to OCR2A then reset to 0 and cause an interrupt TCCR2...

Page 52: ... to see the files inside 2 Open ServoTimers h in a text editor 3 Locate the following lines of code in ServoTimers h 4 The lower two lines of code specify that the library should use Timer 1 To use Timer 3 instead just change _useTimer1 to _useTimer3 and _timer1 to _timer3 5 Save the file The Arduino IDE will automatically incorporate your modifications to the Servo library The next time you compi...

Reviews: