<< return to Pixycam.com

User Tools

Site Tools


wiki:v2:pixy_zumo_howto

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
wiki:v2:pixy_zumo_howto [2018/07/13 01:17]
pixycam
wiki:v2:pixy_zumo_howto [2019/01/28 23:32]
jfrench [Troubleshooting]
Line 1: Line 1:
-====== ​Assembling the Pixy2 Robot ======+====== ​Making a Pixy2 Mobile ​Robot ======
  
 The robot in the [[https://​youtu.be/​EcCbEWiyiQY|Pixy2 video]] is something you can assemble yourself with some additional robot parts. ​ It makes a fun little robot that is capable of useful tasks, such as, uh, chasing things and following lines. ​ Its controller is a standard Arduino. ​ And since it's an Arduino, you can easily modify our examples to make the robot do whatever you want.  The robot in the [[https://​youtu.be/​EcCbEWiyiQY|Pixy2 video]] is something you can assemble yourself with some additional robot parts. ​ It makes a fun little robot that is capable of useful tasks, such as, uh, chasing things and following lines. ​ Its controller is a standard Arduino. ​ And since it's an Arduino, you can easily modify our examples to make the robot do whatever you want. 
Line 37: Line 37:
 ===== Assemble the Pixy2 pan tilt ===== ===== Assemble the Pixy2 pan tilt =====
  
-The assembly docs can be found [[https://​docs.pixycam.com/​wiki/​doku.php?​id=wiki:​v2:​assembling_pantilt_mechanism|here]]. ​ You will be mounting the pan-tilt mechanism ​ontop of your Arduino as shown below, so pay attention to which holes in the base-plate to use for the stand-offs. ​ The stand-offs should align with the Arduino'​s mounting holes.+The assembly docs can be found [[https://​docs.pixycam.com/​wiki/​doku.php?​id=wiki:​v2:​assembling_pantilt_mechanism|here]]. ​ You will be mounting the pan-tilt mechanism ​on top of your Arduino as shown below, so pay attention to which holes in the base-plate to use for the stand-offs. ​ The stand-offs should align with the Arduino'​s mounting holes.
  
 Once you've attached the stand-offs to the base plate, go ahead and mount the pan-tilt on your Arduino with 4 more of the 2-56 fasteners that came with the pan-tilt kit.  Refer to the picture below. ​ Notice how the Arduino headers are facing down.  ​ Once you've attached the stand-offs to the base plate, go ahead and mount the pan-tilt on your Arduino with 4 more of the 2-56 fasteners that came with the pan-tilt kit.  Refer to the picture below. ​ Notice how the Arduino headers are facing down.  ​
Line 46: Line 46:
  
  
-==== Test your pan-tilt ====+===== Test your pan-tilt ​=====
  
 If you haven'​t done so already, you should test your pan-tilt before proceeding by [[wiki:​v2:​run_the_pantilt_demo|running the pan-tilt demo]]. ​ If you run into any problems, refer to the  [[[[wiki:​v2:​my_pantilt_is_acting_sort_of_crazy|pan-tilt troubleshooting guide]]. ​     If you haven'​t done so already, you should test your pan-tilt before proceeding by [[wiki:​v2:​run_the_pantilt_demo|running the pan-tilt demo]]. ​ If you run into any problems, refer to the  [[[[wiki:​v2:​my_pantilt_is_acting_sort_of_crazy|pan-tilt troubleshooting guide]]. ​    
  
  
-==== Assemble the Zumo base ====+===== Assemble the Zumo base =====
  
-Assembly docs for Zumo can be found [[https://​www.pololu.com/​docs/​0J57/​2.b|here]]. ​ The Zumo base assembly requires a soldering iron, and I (personally) found it somewhat challenging. :-/ The "sumo blade" (bumper) isn't necessary but doesn'​t ​adversely affect ​things either.  ​+Assembly docs for Zumo can be found [[https://​www.pololu.com/​docs/​0J57/​2.b|here]]. ​ The Zumo base assembly requires a soldering iron, and I (personally) found it somewhat challenging. :-/ The "sumo blade" (bumper) isn't necessary but doesn'​t ​hurt things either.  ​
  
  
-==== Test the Zumo base ====+===== Test the Zumo base =====
   ​   ​
 After you assemble the Zumo base, run a simple Arduino program to test the motors and buzzer. ​ Below is a simple Arduino program you can cut and paste into the Arduino IDE.  Note, the files ZumoMotors.h and ZumoBuzzer.h are part of the Pixy2 Arduino library (found [[https://​pixycam.com/​downloads-pixy2/​|here]]). ​ Install the Pixy2 Arduino library if you haven'​t already.  ​ After you assemble the Zumo base, run a simple Arduino program to test the motors and buzzer. ​ Below is a simple Arduino program you can cut and paste into the Arduino IDE.  Note, the files ZumoMotors.h and ZumoBuzzer.h are part of the Pixy2 Arduino library (found [[https://​pixycam.com/​downloads-pixy2/​|here]]). ​ Install the Pixy2 Arduino library if you haven'​t already.  ​
 +
 +
 +It's easy to hook the Zumo motors up backwards. ​ This program will help you determine if your Zumo is working correctly. ​ If something isn't right, none of the Zumo demos will work!  So it's good to give this test a whirl...
        
  
Line 111: Line 114:
  
  
-==== Making the cable ====+===== Making the cable ====
 + 
 +Making the cable is probably the most challenging step.  It requires some decent maker skills.
  
 1. Start by measuring 9 inches of 10-conductor ribbon cable and cut to length. ​ 1. Start by measuring 9 inches of 10-conductor ribbon cable and cut to length. ​
Line 124: Line 129:
 6. Cut wire number 2 on the ribbon cable close to the 10-pin connector, being careful not to cut the adjacent wires. ​ Cutting wire 2 prevents the 5V regulator on Zumo from fighting with the 5V regulator on Pixy2. ​ Refer to the picture below.  ​ 6. Cut wire number 2 on the ribbon cable close to the 10-pin connector, being careful not to cut the adjacent wires. ​ Cutting wire 2 prevents the 5V regulator on Zumo from fighting with the 5V regulator on Pixy2. ​ Refer to the picture below.  ​
  
-{{wiki:​v2:​img_5279_result.jpg}+{{wiki:​v2:​img_5279_result.jpg}}
  
  
Line 132: Line 137:
  
  
-==== Putting it all together ====+===== Putting it all together ​=====
  
 1. Clip a single pin from a 0.1" breakaway header and solder into the Vin hole on the Zumo as shown. ​ Vin is labeled in Zumo's silkscreen. ​ Be careful to choose the right pin (3 holes from the right, 3 holes up from the edge). ​ Vin is a 7V (or close) power rail provided by a boost converter on Zumo.  1. Clip a single pin from a 0.1" breakaway header and solder into the Vin hole on the Zumo as shown. ​ Vin is labeled in Zumo's silkscreen. ​ Be careful to choose the right pin (3 holes from the right, 3 holes up from the edge). ​ Vin is a 7V (or close) power rail provided by a boost converter on Zumo. 
Line 139: Line 144:
 {{wiki:​v2:​img_5291_result.jpg?​400}} {{wiki:​v2:​img_5291_result.jpg?​400}}
 {{wiki:​v2:​img_5290_result.jpg?​400}} {{wiki:​v2:​img_5290_result.jpg?​400}}
-3. Plug the Pixy2/​pan-tilt/​Arduino assembly on top of the Zumo as shown.  If all is correct, Pixy should be facing forward (away from the Zumo power switch and LEDs). The extra pin plugs into the Vin pin.  ​+3. Plug the Pixy2/​pan-tilt/​Arduino assembly on top of the Zumo via the I/O connectors.  If all is correct, Pixy should be facing forward (away from the Zumo power switch and LEDs). Note, because of the thickness of the Arduino cable connector, the Arduino won't be able to fully engage with the I/O connectors on the Zumo.  There will be about 0.050 inch gap, but it's no biggee. 
 + 
 +4. The extra pin plugs into the Vin pin.  ​
 {{wiki:​v2:​img_5310_result.jpg}} {{wiki:​v2:​img_5310_result.jpg}}
  
Line 145: Line 152:
 {{wiki:​v2:​img_5300_result.jpg}} {{wiki:​v2:​img_5300_result.jpg}}
  
-==== Power-on test ==== 
  
-Go ahead and switch ​on your Zumo by flipping the switch in the back.  Pixy's LED should initially flash pink and turn off, which means Pixy is getting power. ​ This is an excellent sign because it means that your cable is likely good.    ​+===== Power-on test =====
  
 +Go ahead and switch on your Zumo by flipping the switch in the back.  Pixy's LED should initially flash and turn off, which means Pixy is getting power. ​ This is an excellent sign because it means that your cable is likely good.
  
-==== Running the Zumo chase demo ====+If your Pixy doesn'​t come on, check the cable and its connections,​ and make sure the Vin pin is in the correct location. ​ Is the Zumo powering on?  (Check the Zumo LEDs.) ​ If Zumo isn't powering on, make sure the batteries are inserted correctly. ​ Then perhaps unplug Pixy from the cable and retry. ​    
 + 
 + 
 +===== Running the Zumo chase demo =====
  
 The chase demo is a good program to run first to test and possibly debug your robot. It's shown in the [[https://​youtu.be/​EcCbEWiyiQY?​t=40s|Pixy2 Youtube video]]. ​   The chase demo is a good program to run first to test and possibly debug your robot. It's shown in the [[https://​youtu.be/​EcCbEWiyiQY?​t=40s|Pixy2 Youtube video]]. ​  
Line 164: Line 174:
  
  
-=== Troubleshooting ===+==== Troubleshooting ​====
  
 If your robot doesn'​t seem to be working, put the robot on something (e.g. a stack of quarters) to lift its treads off the ground, so that its treads are free to move, and you can more easily see what's going on without the robot running away.  ​ If your robot doesn'​t seem to be working, put the robot on something (e.g. a stack of quarters) to lift its treads off the ground, so that its treads are free to move, and you can more easily see what's going on without the robot running away.  ​
Line 178: Line 188:
  
  
-==== Running the line demo ====+**Note:** if you're using Arduino Due or Mega, you will probably get an error like this: 
 + 
 +''​libraries\Pixy2\ZumoBuzzer.cpp:​90:​5:​ error: expected constructor,​ destructor, or type conversion before '​('​ token''​ 
 + 
 +In that case, just go into your Pixy library and delete the following 4 files: 
 + 
 +{{:​wiki:​v2:​todelete.png}} 
 + 
 +It should then compile! 
 + 
 +===== Running the line demo =====
  
 The line demo is a fun demo -- the same one shown in the [[https://​youtu.be/​EcCbEWiyiQY?​t=1m2s|Pixy2 Youtube video]]. ​ If you haven'​t tried the chase demo (described above), we recommend running it first to test and possibly debug your robot. ​   The line demo is a fun demo -- the same one shown in the [[https://​youtu.be/​EcCbEWiyiQY?​t=1m2s|Pixy2 Youtube video]]. ​ If you haven'​t tried the chase demo (described above), we recommend running it first to test and possibly debug your robot. ​  
Line 198: Line 218:
  
  
-If you look at the code for line\_zumo\_demo,​ you'll notice that it's surprisingly simple for what it does. +==== The code ==== 
 + 
 +If you look at the code for line\_zumo\_demo,​ you'll notice that it's surprisingly simple for what it does.   
 + 
 +  * It has a PID loop to adjust the heading of the robot given the Vector'​s x1 value. ​ (The Vector'​s x1 value is the column value of arrow-end of the Vector.) 
 +  * It calls setNextTurn() every time it sees a turn sign (barcode). 
 + 
 +There is some interesting logic for setting the wheel velocities (setLeftSpeed() and setRightSpeed()). ​ Sure, there is a PID loop wrapped around the robot heading. ​ But in particular, if the Vector is pointing down (or down-ish), i.e., the y1 value of the Vector is _greater than_ the y0 value -- if so, the robot will actually need to back-up to keep the line in view.  You can see this happen in [[https://​youtu.be/​EcCbEWiyiQY?​t=1m42s|the video]] when the robot makes a left-turn, because of the shape of the intersection.  
 + 
 +As an exercise to the reader (don't you love those?), use the [[https://​github.com/​charmedlabs/​pixy2/​raw/​master/​documents/​other/​barcodes.zip|barcode images]] and your favorite drawing program to make a "​U-turn"​ sign.  Then modify the program to deal with a U-turn sign, such that when it sees it, the program issues a reverseVector() command, flipping the Vector. ​ What do you expect will happen? ​ Discuss with your lab partner. ​    
  
  
-=== Troubleshooting ===+==== Troubleshooting ​====
  
  
Line 220: Line 249:
  
  
-==== Happy tinkering! ====+===== Happy tinkering! ​=====
  
 Let us know how it goes -- send us pictures and videos! ​ And if you need [[https://​pixycam.com/​email-us/​|help]],​ don't be bashful. Let us know how it goes -- send us pictures and videos! ​ And if you need [[https://​pixycam.com/​email-us/​|help]],​ don't be bashful.
wiki/v2/pixy_zumo_howto.txt · Last modified: 2019/02/15 21:37 by jfrench