Introduction: Battle Bots
Battle your friends with these Intel-powered battle bots. These little bots blast each other with squirts of water and detect hits with water sensors lined along their bodies. Each bot is powered by an Intel Galileo board and wirelessly controlled with ConnectAnyThing firmware.
(x1) Intel Galileo Board Mouser 607-GALILEO
(x1) Arduino Motor Shield Mouser 782-A000079
(x1) Grid-Style Printed ProtoBoard RadioShack 276-147
Robot Body, Power, and WiFi
(x1) Dagu Rover 5 4WD Tracked Chassis RobotShop RB-Dag-39
(x1) 2GB micro SD card with SD adapter Amazon
(x1) Fuel+ 9000mAh mobile Rechargeable Battery NewEgg PCPB90002
(x1) 12 V 1600mAh Rechargeable Battery RobotShop RB-Hpr-01
(x1) Quick Connect Battery Connector RobotShop RB-Onl-16
(x1) Intel Centrino Advanced-N 6205 Amazon
(x1) Half to Full Height Mini PCI Express(PCI-E) Card Bracket Adapter Amazon
(x1) Kit with pair of WiFi antenna with Hirose U.FL connectors Amazon
(x1) M connector Bentronics (70) 6880
(x1) USB cord Amazon
(x1) RioRand LM2596 DC-DC Buck Converter Step Down Module Power Supply Output 1.23V-30V Amazon
Parts for circuit board:
(x1) rocker switch Sparkfun 10727
(x3) mini photocell Sparkfun 9088
(x6) 3mm white or yellow LEDs Pololu 1072
(x1) piezo buzzer Adafruit 1739
(x1) 12V relay Amazon
(x4) 1/4W 1K ohm resistors Mouser 660-MF1/4DCT52A1001F
(x6) 220 ohm resistors Mouser 660-MF1/4DCT52R2200F
(x1) Schottky diode SparkFun 10926
(x1) 2N2222 transistor Mouser 863-P2N2222AG
Parts for sensors:
(x1) six oz. plastic squeeze bottle
(x1) 12V peristaltic pump with silicone tubing Adafruit 1150
(x1) High sensitivity water sensor Emartee 42240
Female header pins SparkFun 00115
Heat shrink tubing SparkFun 09353
Pipe thread tape Home Depot 31273
Other supplies and tools:
Black electrical tape
Silicone or hot glue
Copper conductive adhesive tape 5mm in width SparkFun 1056
Wire strippers and cutters
Step 1: Introducing the Intel Galileo Board
The Galileo is Intel's first DIY maker board, and it comes with a variety of features well-suited for these battle bots. The Galileo comes with an expansion slot for a PCI Express Mini card, making it easy to wirelessly control the bot. Not into programming but want to learn how to control a robot? No problem! The Galileo communicates with ConnectAnything firmware, an easy tool for real-time tinkering on a mobile device.
Step 2: Setting Up the Galileo
Proper drivers must be installed on all new Galileo boards. This is done through the Galileo IDE, based on the Arduino environment. Since this setup can be finky, this step is meant to provide tips and tricks about downloading the IDE and booting the board.
- First remove the micro SD card from the board.
- Plug the 5V wall wart into Galileo's 5V barrel connector before anything else or board might fry.
- Connect your computer to the Galileo's "USB client" port with a micro B to USB A cable. This is how you can install drivers and programs on your board.
- Download the appropriate driver (Linux, Mac, or Windows) from here.
- Follow the Galileo's "getting started" guide provided here. Select the appropriate instructions for your OS by following the hyperlinks at the top of the webpage. I found this site SUPER useful while first starting out with the Galileo. I am an OSX fan, so all the instructions from here on out are accounts of my experience on a mac.
Instructions from my experience using OSX:
- I downloaded and unzipped the Galileo driver for OSX. This driver is basically an IDE for the Galileo based on the Arduino environment.
- I named the download "Galileo2". You can name it anything you want, but avoid naming it "Arduino" so you don't confuse it with the real Arduino IDE. Also avoid names with spaces.
- Open the IDE and in "Tools" -> "Board" choose "Intel Galileo"
- In "Tools" -> "Serial Port" choose the serial port "/dev/cu/..." (meaning don't use a "/dev/tty/..." port. It won't work).
- Then select "Help" -> "Firmware Update". A pop-up box will remind you to connect the board to 5V. Press "ok". It will take about 5V minutes to download the firmware onto the board. If all goes correctly, a pop-up will say that the firmware successfully installed.
To test that the firmware installed properly:
- Select "File" -> "Examples" -> "Basics" -> "Blink"
- Upload the code onto the board exactly the same way you would upload code to an Arduino board.
- If all goes correctly, a small LED on the board attached to Pin 13 should start blinking.
Step 3: Setting Up WiFi: Mounting the WiFi Card
Despite the similarities between the Intel Galileo and Arduino boards, the way to connect the Galileo to WiFi is NOT through a WiFi shield. The Galileo instead comes with a MPCI connector built into its base. MPCI stands for "Mini Peripheral Component Interconnect". "Mini" means that the PCI is designed for a small computer. The Galileo's MPCI connector can hold a Wi-Fi or Bluetooth card, making it very easy to connect the board to WiFi. Currently, the Galileo supports the Centrino n-135 and the Centrino n-6205 modules out of the box. For this project, I used a Centrino n-6205 card.
To prepare the hardware for WiFi communication, I screwed the half height extender to the Wi-Fi card. Then I powered down the Galileo and inserted the card at an angle into the MPCI connector. I pressed the extender down until it clicked into the connector's plastic retaining clips. The desktop antenna have very small connectors attached to their ends that are snapped into the card. The antenna are attached to the Wi-Fi card right before putting the battle bot together.
These instructions mainly came from Clay and Galileo's website at http://www.hofrock.com/setting-up-wi-fi/. I found this website very useful when first working with the Galileo. It also outlines how to install drivers for wireless cards other than the Centrino n-135 and n-6205.
Step 4: Setting Up WiFi: ConnectAnyThing
ConnectAnything is a software package that enables real-time electronic tinkering on the Galileo using a mobile device. It is targeted at makers with little programming experience, but is useful for mocking up interactive experiences. The software turns the Galileo board into a hot spot, broadcasting its own wireless network. For this project, we will connect to the Galileo through its unique wireless network and control it with a smart phone.
The hardware for wireless communication was described in the previous step. Here, I will describe how to set up ConnectAnything. Most of these instructions are also outlined on ConnectAnything's github page here.
- Use a micro SD card greater than 2 GB. Insert it and its adapter into your computer.
- Download ConnectAnything from the ConnectAnything github page here.
- A folder called "ConnectAnything" will appear in the Downloads folder. Open the folder and copy only its contents onto the SD card.
- In the SD card, unzip the file "image-full-clanton.zip"
Now the micro SD card is ready to go! Insert it back into the Galileo board. As a test to make sure WiFi is working, connect the desktop antenna to the WiFi card and plug the Galileo into the wall. If working properly, three lights should turn on: a yellow light next to power, an orange light on the ethernet connector, and a yellow light near the usb host connector. You should see the network ConnectAnything on your computer in a few minutes. Open your web browser and go to "cat.com". You should see the environment shown in the image above.
Later I will describe how to change network names so we can control two battle bots separately with two smart phones.
Step 5: Circuit Diagrams
The main circuit diagram for your battle bot is shown above. Although the Galileo board is not included in the diagram, the same pins are shared between the Galileo and Arduino motor shield. All pin connections are listed below:
2 - optical resistor
3 - optical resistor
4 - optical resistor
5 - water sensor
2 - buzzer
3 - 5V (motor pwm A)
4 - 1 LED
5 - 3 LEDs
6 - 2 LEDs
8 - motor brake B
9 - motor brake A
11 - 5V (motor pwm B)
12 - motor direction A
13 - motor direction B
The Arduino motor shield assumes each motor needs four pins to operate: direction, speed, break, and current sensing. The dagu chassis uses two servos. We don't need to monitor motor current draw, and we are keeping motor speed constantly at max, meaning we just need to control two pins per motor.
To get the bot to move forward, the command for the Arduino motor shield would look something like:
//Motor A forward digitalWrite(12, HIGH); //Establishes forward direction of Channel A digitalWrite(9, LOW); //Disengage the Brake for Channel A //Motor B backward digitalWrite(13, LOW); //Establishes forward direction of Channel A digitalWrite(8, LOW); //Disengage the Brake for Channel A
That means someone would have to execute four commands to tell their robot to move forward in ConnectAnything! Ugh! Instead, we want to turn your cell phone into a remote control with simple buttons you can hit to go forward, turn right, turn left, and stop. We can do this with a combination of real wiring on the board and digital wiring in ConnectAnything.
The ConnectAnything "digital circuit" is shown above. In ConnectAnything, we will want:
A2 to engage the breaks
A3 to control the direction of one motor
A4 to control the direction of the other motor
Let's keep rolling with the forward command example. To move forward, I press the green pin 6 button in the ConnectAnything Control Mode, as shown in the included image. This turns on any LED physically connected to pin 6 on the protoboard circuit. There are two LEDs that are connected to pin 6, one in front of a photodiode connected to A2 and another in front of A4. That pulls A2 and A4 high. However, we will set the analog pins to inverse, so then A2 and A4 are low while A3 is high. Because A2 is pulled low, the breaks are disconnected. A4 is pulled opposite of A3, so one motor moves full speed forward and the other moves full speed back, moving the entire robot forward.
- The Galileo requires exactly 5V to operate and needs at least 2A if using WiFi. To meet these conditions I used two power supplies, one specifically for the Galileo and another for the rest of the circuit.
- The servos and pump require more power than what just the Galileo can provide, which is why I used an external 12V battery. Some power is sent through a lm2596 (switching dc-dc buck converter) to ramp it down to 5V to power the servos and connect the supply to the rest of the circuit. A switching step down converter is more efficient than a linear voltage regulator. It doesn't lose as much power to heat because it is constantly switching.
- PWM pins should always be high, so just link both PWN pins to 5V. This step will be described in more detail later.
Step 6: Power Requirements
Three main parts of the battle bot have specific power requirements. Relevant document specs are listed below.
Pump: Adafruit peristaltic liquid pump
- Voltage requirement = 12VDC
- Amperage requirement = 200 - 300mA
Arduino motor shield:
- Voltage requirement = 5V - 12V
- Amperage requirement = 2A per channel or 4A max
Board: Intel Galileo
- Voltage requirement = 5V
- Amperage requirement = 3A max input
The Galileo board requires a regulated 5V and needs at least 2.5A if hosting WiFi. For this reason, I decided to power it separately with a mobile rechargeable battery. The battery is connected to the board with a USB cord that I spliced and soldered to an M barrel connector. The battery must be charged before being placed inside the battle bot. To be recharged, simply remove it from the tank.
A 12V rechargeable battery powers the pneumatic pump, and is stepped down to 5V with a voltage regulator to power the Arduino motor shield.
Step 7: Opto Switches (Part of Circuit)
The optical switches help translate the commands, "forward", "turn left", "turn right", and "stop" in ConnectAnything to commands the motor shield can comprehend. Optical isolators are used so multiple diodes can be excited with a single I/O input. They are also used to prevent current backflow that could potentially excite other I/O input pins, which would ruin the commands. I custom made optical isolators so I could have multiple LEDs shining onto a single photocell (standard opto-isolators you can buy have only one photocell per LED). I covered each bundle of LEDs and photocells with a piece of rubber balloon. I secured the rubber to the board by punching staples through the protoboard and soldering them down.
Step 8: Water Cannon Circuit
I used a relay driver circuit to control the pneumatic pump. A relay driver circuit uses low power as a switch to control devices requiring a larger power source. In this circuit, the Galileo's I/O pin 7 is used to connect and disconnect 12V from the pump. I used a 12V mechanical relay, which was probably overkill. I could have used a smaller solid state relay or transistor since the pump only requires at max 300mA.
Step 9: Water Sensor
The battle bots detect that they've been hit with a water sensor. Water sensors work by measuring the difference in resistance between two pieces of metal. The water sensor I bought works just this way. I wanted to line the battle bot tank with water sensors to detect hits on all sides of its body. I extended the metal lines on the water sensor, effectively turning one sensor into five. I took a piece of ribbon wire and soldered each wire to each metal etching on the water sensor. A piece of shrink tubing protects the solder joints.
Step 10: Water Sensor Connector
The water sensor has a three prong male connector on one end. I made a three prong female connector for the water sensor that would be soldered into the protoboard (see the full circuit diagram in the previous step). Solder a thick braided wire to a smaller wire and protect with shrink tubing. Do this three times for the water sensor's three I/O pins. Solder these to female header pins, and protect with more shrink tubing.
Step 11: Motor Shield
The protoboard is mounted on top of an Arduino motor shield. PWM pins 3 and 11 control the motor's speed. Solder wires from pins 3 and 11 to 5V so the servos move at max speed. There are two servos in the robot chassis, each with a connection to power and ground. Connect the red wires to the shield's (+) Channel A and B terminals and the black wires to the (-) Channel A and B terminals.
Step 12: Chassis
Because we are using the Arduino motor shield to control the robot's servos and because we are already setting the servos' speed to max, we don't need the servo encoders that come inside the robot chassis. Take a pair of cutters, snip them away, and cover the ends with electrical tape.
Step 13: Tape
Cover any exposed metal inside the chassis well as the underside of the Galileo board with electrical tape. This prevents the board from shorting.
Step 14: Body
Why not make these battle bots look like real army tanks? The body for these bots was designed in Autodesk Inventor to look like the WWII Sherman Tank. The cad files for the body are provided above. The body was printed on an Object 3D Printer.
- The body fits together in three pieces: the main body and two pieces for the pump housing.
- There is a pair of parallel indented lines running along the body's exterior. They are meant to hold copper tape that connects to the bot's water sensor extensions. Further description is outlined in the steps to come.
- Screw holes on the main body's top are meant for mounting the water pump.
- There are loops inside the main body to loop velcro through. Velcro will hold the water tank.
- The body houses the protoboard, Arduino motor shield, Galileo board, water container, and power supplies. The top pieces hold the pump and the cannon's pneumatic tubing.
- There are holes in the tank's back for mounting the antenna and inserting the power switch.
Step 15: Add the Water Pump
Insert the pneumatic pump into the large hole on top of the main body. Screw the pump down into the small holes and secure with nuts. Choose any side of the pneumatic tubing and insert into one of the larger holes. This tube will connect to the water container inside the battle bot. Take the other tube and pull it through the cannon until it comes out the end.
Take the red plastic tip that comes with the plastic squeeze bottle (used for the water container) and puncture a small hole into its top with a pushpin or needle. I glued the red tip to the end of the cannon with hot glue.
Step 16: Make the Water Tank
Take the squeeze bottle and remove its red tip. Cut its nozzle to the diameter of the pneumatic tubing with a pair of scissors. Stick the tubing through the nozzle, seal with silicone or hot glue, and finally cover with electrical tape. To prevent leakage, cover the bottle's tapped neck with pipe thread tape.
Step 17: Mount the Water Tank
The water bottle is placed inside the front end of the battle bot and secured in place with velcro threaded through loop holes.
Step 18: Install the Water Sensors
Section the ribbon wire soldered to the water sensor into 5 pairs.
Place the water sensor inside the tank, as shown in the included image, and secure down with electrical tape. Each pair of parallel lines outside of the bot has a pair of holes. Stick pairs of adjacent ribbon wire through these holes. Glue the wires on the inside of the bot with hot glue. Place the copper tape into the indentations and over the wires.
Step 19: Armor
Armor for the battle bots was designed in Inventor and cut from red and blue acrylic with an Epilog laser cutter. Sand the bottom sides of the vinyl pieces so they adhere better to the plastic tank. Glue them to the outside of the tank with hot glue.
Step 20: Putting It All Together
Before anything, push the antenna connectors from the inside of the tank out to the back and screw down with washers and nuts. Screw the plastic antenna onto the metal connector. Connect the antenna wires to the WiFi card mounted on the underside of the Galileo, as shown in previous steps.
Place the circuit boards, power supplies, and water container into the tank as outlined in the previous steps. Now you are almost ready for battle!
Step 21: Controlling the Board: Renaming the Network
To connect to ConnectAnything, first switch the bot's power on by toggling the rocker switch located near the bot's antenna. This will power the board. With a smartphone, connect to the ConnectAnything WiFi network. Choose "use without internet" if prompted. Go to the phone's web browser and type in the webpage "cat.com". The ConnectAnything Environment will appear on the screen.
Next, change the board's WiFi network name so you can identify your bot. Click the small wheel located in the top center of the screen. A dialog box called "App Settings" will appear. Click "Change Network Name" and type in a new name for your battle bot that's different from your opponent's.
Reboot your board to save the network name. To do this, simply disconnect and then replug the Galileo to its power source.
Step 22: Controlling the Board: Setting Up Pins
Next, click the button "Controller Mode" at the bottom center of the page. Click on the analog pins A2, A3, A4, and A5 and the digital pins 2, 4, 5, 6, 7, 8, 9, 12, and 13 to add them to the Configure Mode, as shown in the included image.
Press the button "Configure" at the bottom of the page. Double click each pin image to rename them as shown in the included image. Click inside a yellow circle on an analog pin button and then inside a green circle on a digital pin button to make the connections shown in the images above. Next, double click analog pins 2, 3, and 4, and press "invert".
Step 23: Controlling the Board: Commands
Here are pictures of the Controller Mode with the commands turn left, turn right, go forward, and shoot, and what the connections look like for these commands.
Have fun battling your friends!