Introduction: Raspberry Pi SumoBot
For this project, I used LabVIEW to create a Raspberry Pi controlled Sumobot. I also made a 2 joystick, 2 trigger controller that is also powered by a Raspberry Pi and can control the Sumobot over WiFi. This bot is going to be used to compete against its BeagleBone Black counterpart to see which robot can stay in the ring the longest. The LabVIEW VI for the BeagleBone Black and Raspberry Pi 2 is attached in the last step, LabVIEW 2014 and Linx 3.0 are required to run this code. Below are some related Instructables:
Step 1: Materials
Step 2: Mounting the Raspberry Pi to the Fingertech COBRA Minisumo
Go to this Link for an instructable detailing the setup of the Cobra Minisumo. Once you have followed those instructions the next step is mount the Raspberry Pi. I used a laser cutter to cut out a plexiglass stand that would allow the Raspberry Pi to attach to the spacers.
Step 3: Raspberry Pi Setup
Step 4: Controller Setup Part One: 3D Printing the Controller
The 3D printable files for the Controller are attached. you will need to print 2 of the "Single Joystick", one for each side of the controller.
Step 5: Controller Setup Part Two: Soldering to Wire to the Pmods
The Raspberry Pi 2 only has one set of MOSI, MISO and CLK pins so you will need to find a way to split the wire two ways. I did this by soldering a single header pin to a pair of header pins(picture shown above).
Step 6: Controller Setup Part Three: Wiring From the Raspberry Pi
Once you have the controller printed you will mount the Raspberry Pi 2 to the center and insert a Pmod JSTK 2 into each side. Once you have it assembled you will connect both of the 6 pin sides of the 2x6 Pin to Dual 6-pin Cable to each of the Pmod JSTK's making sure that the symbol is facing backward. You will then need to connect the CS, MOSI, MISO, SCK, Ground and VCC (Pin out diagram). Using a 2x6 Pin to Dual 6-pin cable to to connect the wires to each PmodJSTK 2.
Step 7: Sumo Raspberry Pi Setup Part One: PMOD LVLSHFT Setup
Next, run a wire from the J4 VCCB pin on the PmodLVLSHFT to one of the "W" pin headers on the Sumobot and then run a wire from the J4 GND pin to the "B" header on the Sumobot. Next, run a wire from the J1 VCCA pin of the LVLSHFT to pin 1 on the Raspberry Pi 2 and then run a wire from the J1 GND pin to pin 6 on the Raspberry Pi. Next, run a wire from J1 pin 1 to pin 7 on the Raspberry Pi and then run a wire from J1 pin 2 to pin 36 on the Raspberry Pi. Finally, run a wire from J3 header 101 to the "DIR" header on the left side of the Sumobot and then run a wire from J3 header 102 to the "DIR" header on the right side of the Sumobot.
Step 8: Sumo Raspberry Pi Setup Part Two: PMOD AD2 Circuit
The Connection diagram for the PmodAD2 is shown above. SDA and SCL form the 2-wire I2C compatible interface. External pull-up resistors are required for both the SDA and SCL lines. You can see the pictures of the circuit above, I used 47 Ohm resistors. Connect one of the yellow wires to the SDA pin of the AD2 and the other yellow wire to the SDA pin(pin 3) of the Raspberry Pi. Next connect one of the green wires to the SDA pin of the AD2 and the other green wire to the SDA pin(pin 4) of the Raspberry Pi. On the other side connect one of the red wires to 3.3 volts(pin 17) on the Raspberry Pi and then connect the other wire to the J1 VCC on the AD2.
Step 9: Sumo Raspberry Pi Setup Part Two: PMOD AD2 Setup
Next step is to wire the J2 analog voltage inputs to the sensors of the Sumobot. First connect a wire from J2 V1 pin of the PmodAD2 to the "R" header on the right side of the Sumobot. Next, connect a wire from J2 V2 pin of the PmodAD2 to the "R" header on the left side of the Sumobot. Finally, connect a wire from J2 V3 pin of the PmodAD2 to the "R" header on the back of the Sumobot.
Step 10: Sumo Raspberry Pi Setup Part Four: Finals Touches
Once you have mounted the Raspberry Pi, the Pmod AD2 and the Pmod LVLSHFT you can start wiring. (Raspberry Pi pinout diagram) Run a wire from pin 40 to the "PWM" header on the left side of the Sumobot and then from pin 38 to the "PWM" header on its right side. After this, the Sumobot should be complete.
Step 11: LabVIEW Code - Manual Control
Once you have deployed both VI's onto your Raspberry Pi 2's you will see that there are 2 modes. The regular mode allows you to control the Sumobot with the controller over WiFi. The Sumobot controller uses tank drive, so each joystick controls one of the motors, the farther you push the controller forward or backwards the faster the Sumobot will go. You can also press the triggers to spin the robot in place, right trigger spins to the right and left trigger spins it to the left. The robots will automatically stop when the see white and you will have to move them off of the white and then pull both triggers at once to restart them.
Step 12: LabVIEW Code - Autonomous
You can switch to this mode by clicking the "auto" switch. This will cause the Sumobot to move in any direction at an adjustable speed until one of its front sensors sees white. Once the Sumobot sees white it will turn until the front sensors no longer see white. You can also switch in and out of autonomous mode by pressing down both of the joysticks at once.
For an in-depth explanation of the Sumobot code check out my instructable Sumobot (LabVIEW Code). Also check out PmodJSTK 2 controller LabVIEW code for an explanation of the controller code. The LabVIEW code for the BeagleBone Black and the Raspberry Pi 2 is attached below. Thank you for reading my instructable, please comment with any questions you may have.
Participated in the
Summer Fun Contest 2016