Chapter 12. The Battle-Bot

You have likely heard of (or watched) the various televised Battle-Bot competitions, in which two or more robots are entered into a ring (actually a bullet-proof cage) and let loose until there is only one robot moving–kind of like ultimate fighting for robots. This chapter focuses on building one of these fighting robots, either to enter into a competition or to act as your personal body guard around the house. When building a Battle-bot (Figure 12-1), the point is to disable and destroy your opponents robot, so let your destructive juices flow and come up with some otherwise really bad ideas!

In this chapter, you build a four-wheel drive robot with a heavy duty steel frame, steel plating on each side, and two types of weapons attached. The primary control method is a 2.4GHz R/C, which provides the Arduino with user commands for both the drive motors and weapon system. Instead of using DC gear motors to drive this bot (as with the other large robot projects in this book), you use ungeared DC scooter motors and reduce the speed of each using a chain and sprocket drive train–even with gear reduction, this robot is fast! I added two types of weapons to my Battle-bot: two dual-tipped steel ramming spears fixed to the front and rear of each side of the frame, and a motor-driven spike hammer attached to a 3-foot swinging arm, both used to impale the opponent.

Warning

The project in this chapter is not suitable for children. This type of robot is intended to be used in a sealed Battle-bot arena and should be tested with extreme caution and the weapons removed!

This robot has only what is needed in battle and focuses on speed and agility. The four-wheel drive is composed of four independent DC motors using a separate drive train for each wheel. This way, if one of the drive wheels is damaged, the bot can still move. Unlike previous chapters where SLA batteries are preferred for cost efficiency, I decided to use Lithium Polymer batteries for this robot to reduce weight.

The mostly completed Battle-bot, sporting spears and a swinging spike arm

Figure 12.1. The mostly completed Battle-bot, sporting spears and a swinging spike arm

The Battle-bot in this chapter has some unique features not included on previous robots, which can help its chances in battle:

  • Four-wheel-drive–Each wheel has its own motor, drive train, and motor controller.

  • All-steel construction–There is no plexiglass or other easily breakable materials.

  • Lithium Polymer batteries–Used to reduce weight, while maximizing run time.

  • Multiple weapons–By using two types of weapons, active and passive, the bot can always defend itself.

  • Symmetrical frame–Can attack from either direction with a bidirectional spike-hammer weapon and ramming spikes on both sides.

The robots in this book have so far been for "proof of concept" if you will, enabling a beginning robot builder to materialize some popular concepts without breaking the bank. The primary focus in earlier chapters was getting the bot to work using simple and the least-expensive methods. So what do you do after you prove that you can build a robot that does what you programmed it to do? You start strapping weapons to it, and then you look for another robot to get into a fight with—what else did you have in mind?

Robotic Combat Is Born

I am a person of peace, not wanting to fight anyone or hurt anybody, which is why robotic combat is so much fun to watch. You know that someone is hurting for all the repair work they will have to do on their beloved robot, but no living beings are injured or otherwise harmed in a robotic battle. Safety is the #1 concern at any robotic battle competition—extra precautions are placed on weapon safety, emergency shut-off switches, and radio failsafes to make sure that if humans are nearby, they will not be harmed by one of the robots.

The opposite is true for the robots competing in the match; they are usually subjected to arena hazards meant to distract and damage both bots during the match. If your larger and scarier opponent wasn't enough to deal with, you also have spikes on the walls, saw-blades coming up from the floor, a hammer that smashes you if you get near it, and a pneumatic arm that lifts up a section of the floor if you drive over it—just to name a few of the typical arena hazards.

I'm not exactly sure how the first robot battle came about, but according to http://www.robotcombat.com/history.html (website of the popular Team Nightmare and the Robot Marketplace), robotic combat dates back to at least 1994, when a man named Marc Thorpe decided to organize an event made specifically for battling robots, which was called, Robot Wars. I won't get into the many popular subsequent event names, but it is safe to say that as long as people are building robots, they will want to fight them.

A Battle-bot should not be designed simply to work; it must work through the roughest conditions a robot builder can imagine. In battle, there is no timeout to fix a loose wire, or asking the other guy to avoid ramming your left side because that's where you motor controller is mounted. You have to plan ahead for the worst, and hope you designed a better robot than your opponent. Any hidden weaknesses your bot has will become obvious when it is hammered, rammed, and impaled by its opponent.

Battle-Bot Rules and Regulations

As with any "sport" there has to be a set of rules or guidelines that each contestant must follow to make the game more interesting and keep things fair. Certain attack methods and weapon types are not allowed to be used because they require little ingenuity and seem a bit insulting to other robot builders. For instance, your weapon cannot shoot water, oil, or other liquids or chemicals onto your opponent or the arena floor; Although this might disable their bot, it is not exactly the "exciting" type of combat that robot battles are designed for.

The most important regulation to many builders is the weight restrictions that separate the contestants into classes. There have been several different weight classes throughout the robotic combat saga; Wikipedia describes them with corresponding class names. These classes range from under 1 lbs to 340 lbs and are not from any one specific league or competition, but rather a collection of different weight classes from various events (see Table 12-1).

Table 12.1. List of Battle-Bot Weight Classes Obtained from Wikipedia

Weight

Class

* For more information about Battle-bots, visit http://en.wikipedia.org/wiki/Robot_Combat.

75 grams (g)

Fleaweight

150 g

Fairyweight

1 pound (454 g)

Antweight

1 kilogram (2.2 lbs)

Kilobot (Canada)

3 pounds (1.36 kg)

Beetleweight

6 pounds (2.72 kg)

Mantisweight

12 pounds (5.44 kg)

Hobbyweight

15 pound (6.80 kg)

BotsIQ Mini class

30 pound (13.6 kg)

Featherweight

60 pound (27 kg)

Lightweight

120 pound (54 kg)

Middleweight/BotsIQ Large class

220 pound (100 kg)

Heavyweight

340 pound (154 kg)

Super Heavyweight

No Price Limit!

Although there are weight and safety restrictions, there are no rules about how much money you can spend on your Battle-bot. This means that you can expect there to be some expensive robots entering the ring. The heavy-weight Battle-bots competing in the televised competitions would routinely cost several thousand dollars to build. Machined aluminum frames, titanium weapons and armor, CAD designed parts, and engineering-grade battling robots are what came from this phenomenon—along with a wave of inspired DIY robot builders each concocting their own version of the ultimate techno-warrior. Although this new "sport" is not productive in nature, it is extremely competitive, which grabbed the attention of many who would normally have no interest in building a robot. I can honestly say that no sport (on TV) has ever kept my undivided attention, but when a Battle-bot competition starts, it's extremely hard to look away until the match finishes.

Price may not be an issue for some builders, but it is for me (and probably you, if you are reading this book)–so it is good to plan to make a Battle-bot that is within your price range. You will have to replace some parts, so try to make sure you don't use parts that are impossible or extremely difficult to replace.

Is This Going to Be Expensive?

The total cost of the robot depends on your parts supply and how long you have to acquire them. Can you be thrifty, use recycled parts, and be patient? If so, you might find a perfectly good scooter with dead batteries in the dumpster at work (like I did), and use pieces from it as your weapon drive system. If you don't want to pay retail, eBay often has some excellent deals on things such as surplus or discontinued wheels, sprockets, motors, and other harder to find items. I found the brand new scooter wheel assemblies used in this project on eBay for $12.99 each, when the same item at several online scooter-part retailers was selling for $40 or more each. My point is, if you don't have a lot of money, you can still find excellent parts for cheap—just keep looking and be patient.

I have tried to make the projects in this book affordable by limiting the price of any one project to $500. I originally met my budget by using some smaller motor controllers (Sabertooth 2×12), but the extra weight of the weapons made the bot draw a bit too much current to be effective in battle using these controllers. I decided to use larger motor controllers (Sabertooth 2×25) for this project, driving the price higher; this project ended up costing approximately $650 as tested.

Although this sounds like a lot of money, it is a small amount if you want to build a competitive Battle-bot. This bot should classify as a Lightweight or Middleweight, depending on weapons, armor, and batteries used. Also, you can build only the base of this robot and install any type weapon that you want. See what you can come up with on your own.

Parts List for the Battle-Bot

The parts list for this project is more of a guideline than an exact list of materials. The part numbers for each part that I used on the Battle-bot are listed, but there are many different options that you could substitute for parts that I used.

If you built the Lawn-bot from Chapter 10, you might have some chain and a few universal chain links left over, and some bolts and scrap metal that might come in handy.

I always peruse my parts supply from previous robots and acquired thrift-store finds before buying any parts for a new robot. You might be surprised how many things can be recycled and repurposed. Take a look at the parts list for the Battle-bot in Table 12-2.

Table 12.2. Battle-Bot Parts List

Part

Description

Price

Electronics

  

2.4 GHz R/C transmitter and receiver pair

HobbyPartz.com (part# 79P-CT6B-R6B-RadioSystem): I have used these 2.4Ghz 6-channel hobby radio pairs on several bots.

$32.00

Two Sabertooth Dual motor controllers

Dimension Engineering Sabertooth 2×25: These are used for Drive motors.

$125.00 ea (x2)

One OSMC motor controller

Used for weapon: Any high-power H-bridge works here, assuming it has a voltage rating of +24vdc or better. I provide plans for you to make a smaller OSMC clone for about $40.

$40.00

Drive Train

  

Four DC motors

Allelectronics.com part# XYD-15B – 24VDC, 135W, 10 Amp: Currie Technologies and electric scooter motors.

$15.00 ea

#25 chain – 10 feet

Allelectronics.com part# CHN-25: 10 feet should give you some extra in case of a break. It is sold by the foot for $2.50/ft.

$25.00

Four Master chain links

Allelectronics.com part# ML-25: You need at least 4 of these, maybe 8 to 10 for good measure.

$1.00 ea

Four wheel/tire/sprocket set

PartsforScooters.com part# 119-49: These wheel/tire/sprocket assemblies are made for an E300 Razor electric scooter. I purchased these from the PartsforScooters eBay store (same wheels for less money) instead of its website.

$15.00 ea

(4) Motor drive sprockets

PartsforScooters.com part# 127-6: These sprockets have an 8mm bore and 11 teeth for #25 chain. They may also need shaft collars to secure.

$6.00 ea

Power

  

two 3-cell LiPoly batteries – 11.1v, 3000mAH

HobbyPartz.com part# 83P-3000mAh-3S1P-111-20C: You need at least two of these packs to achieve 22.2vdc, but you can alternatively arrange the packs in parallel, operating the bot at 11.1v and 6000AH.

$16.00 ea

Frame

  

2-inch wide angle iron – 6 feet long

Hardware Store: This composes the perimeter of the square frame, in equal 18-inch sections.

$17.00

¾-inch wide angle iron – 36-inch long

Hardware Store: I cut this into two equal pieces and used them as cross braces for the center of the frame, also used to mount the electronics (Battle-box) to.

$6.00

two 5/16-inch (8mm) diameter threaded-rod – 36-inch long

Hardware Store: Use these for the front and rear axles.

$4.00 ea

two ¾-inch square steel tubing – 36-inch long

Hardware Store: Use these to mount the active weapon to the frame.

$8.00 ea

two pc. Sheet metal 36-inch x 36-inch

Hardware Store: These sheets are used as armor to coat the top and bottom of the frame to protect the electronics and wiring.

$12.00 ea

Weapon

  

24v, 350w, 22 Amp - electric scooter motor

Allelectronics.com part# DCM-1352.

$20.00

two ¾-inch steel square tubing

Used two 36-inch long pieces to make the weapon brackets.

$4.00 ea

two 5/8-inch solid steel round-rod

Used for the ramming spears on the front and rear of the frame.

$7.00 ea

Scrap-metal for spike-hammer weapon

Angle iron, steel flat bar, or anything you can find.

$0.00

Sprocket assembly

I used the rear-wheel assembly from a Schwinn electric scooter that I found in a dumpster at work. For me this included a motor and all, but I have included the model number in case you are not so fortunate.

$0.00

Now consider some provisions for using R/C control in a battle-bot competition, and select a control system to use accordingly.

Input Control

If using a hobby R/C system in a battle-bot competition, as of July 1, 2009, it must be a 2.4GHz system because legacy radio systems (27 MHz, 49MHz, 72MHz, 75MHz, and so on) are no longer allowed to be used. As earlier discussed, the 2.4GHz spread-spectrum radio transmitters must "bind" to their receivers rendering them nearly impervious to crossing signals.

This rule is in effect because the legacy 75MHz controllers rely on two crystals of the same frequency (one in the tx and one in the rx) to avoid interference. If another transmitter in the same vicinity (possibly a poor loser) uses a crystal of the same frequency as a competing robot–well, this could cost someone a match and an expensive robot. Maybe this is how the first robot battle began?

Other methods of wireless control are sometimes allowed, provided they meet the other general guidelines. This means that you could use an Xbee 2.4GHz Serial link to control your bot using a laptop, home-made controller, or joystick. If you try this you will likely be heavily inspected by the officials for safety, so make sure any custom control systems have the appropriate failsafe features as required by the contest rules. I encourage such actions because they make these events more interesting.

Fly Sky CT-6: The $32, 5-ch*, 2.4GHz Radio Alternative

When they first became available, 2.4GHz transmitter/receiver pairs were quite expensive and rarely found for under $100. As of 2010, several places online sell quality 6-channel 2.4GHz radio systems for approximately $35. I have used the Fly Sky CT-6 system from HobbyPartz.com on several projects and have been pleased (see Figure 12-2).

Most 2.4GHz R/C transmitters can be paired with various R/C receivers using the bind process described in the transmitter instruction manual. If you already own a 2.4GHz R/C system (as used in Chapter 8, and Chapter 10), you might want to simply buy an additional 2.4GHz R/C receiver and use your existing transmitter. This would help save a bit of money if you plan to build several remotely controlled robots and want to keep from buying multiple R/C systems; you can purchase additional R/C receivers (HobbyPartz.com part# 79P-R6B-Receiver) for under $10 each!

Fly-sky 2.4GHz R/C system

Figure 12.2. Fly-sky 2.4GHz R/C system

Normal airplane receivers typically have built-in failsafe functions that upon signal loss, continue sending the previous good value to each channel. Although that may be good for an airplane, it is bad for most robots. The FlySky CT-6 is programmable to be used for either airplane, helicopter, or in our case, a robot. The CT-6 radio system even comes with a free programming cable and programming software that enables you to change the settings of each channel.

Upon losing signal, the receiver in this system is set to output a LOW signal with no previous pulse or other failsafe signal. This is handy when reading the R/C signal with the Arduino, because it is easy to determine when the signal has been lost. The Fly Sky CT-6 (and several other brands using the same software) have computer programmable servo reversing, channel mixing for helicopters, and assignable switch features–all accessible using the free software called T6_config (Figure 12-3), downloadable at http://www.mycoolheli.com/t6config.html.

This transmitter has four channels contained in the two dual-axis joysticks, and another usable channel for robots in the form of an on/off switch or an analog potentiometer knob. I operate this system so that the up/down channels of each joystick control the motors direction, whereas the left/right channel of one of the joysticks controls the weapon, enabling one person to control both the bots direction and weapon simultaneously. You can also use steering-mixing to control the bot's motion with one joystick and its weapon with the other joystick (either axis)–it all boils down to what feels most natural to you when driving. (I prefer independent control of each wheel.)

The T6_config tool is used to re-program the Fly-sky R/C transmitter.

Figure 12.3. The T6_config tool is used to re-program the Fly-sky R/C transmitter.

I am including my T6 configuration file for you to download, which makes this transmitter/receiver pair robot-friendly allowing use of all four joystick channels with no mixing and the use of a switch or potentiometer as a fifth channel. Simply upload my file to the configuration program with your transmitter connected via the USB adapter cable (which should come with your R/C system), and you can have the same configuration as the transmitter I used for this project. The one hindering aspect of this system is that there are no servo reversing switches located on the transmitter. You must use the T6 config tool to reverse the servo direction, which was not a problem for me on this project because I was near my computer for most of the build.

Download my T6 configuration file at https://sites.google.com/site/arduinorobotics/home/chapter12_files.

This configuration enables channels 1 to 4 to be a standard/proportional control with no channel mixing. Channel 5 is a combination of SW.B, which is an on/off toggle switch, and VR(A), which is a variable potentiometer. If you want to use the variable control, turn SW.B on and you can use the potentiometer VR(A) for a variable signal. If you want to use the digital on/off signal (as in this chapter) turn VR(A) all the way to the left, and you have an on/off output.

You can play with the settings of the T6 config tool because you can always download my file to get it back to normal if you need to. I tried for quite some time, playing with the limited configuration settings, and could get only solid use of either Ch5 or Ch6–but not both at the same time. This means that I could get it to work only as a 5-ch system, which is one more channel than I use, so it worked out well.

Attention Hackers

The sixth channel on this system is only available to use with channel mixing for a 3D helicopter or airplane. However two toggle switches and two potentiometers are available for use, and a USB-programmable microcontroller is obviously telling each channel what to do (because you can reprogram the transmitter with a USB cable). My hope is that someone with better knowledge of these systems can program the use of the sixth channel for robot use...anyone?

Note

As this writing, the T6_config software works only on Windows systems. As an Ubuntu Linux user, I had to get out the old, dusty laptop that still has Windows installed to reprogram my transmitter.

With the CT-6 transmitter programmed for this project, now proceed to building the electronics.

The Electronics

Most robots that compete in battle competitions use multiple electronic speed-controllers (ESC) to interface the R/C system to the motors and weapon. These are simple to use but are limited to what you can do with your robot. The only reason that I included a Battle-bot as a project in this book is because there are many things that you can potentially do with an Arduino that you cannot do with a standard ESC or other preprogrammed microcontroller. If nothing else, you can simply pass the signals through the Arduino to add a software failsafe in case of signal loss. This enables you to work with a variety of input signal types, while still producing the type of output failsafe conditions required by the rules of the particular event you enter.

By feeding the R/C channels through the Arduino, you can utilize a remote weapon disable switch, internal failsafe in case of lost signal, and power external LED lighting for visual feedback of your bot's condition during battle, and add Telemetry using Xbee, or control your bot using a 2.4GHz wireless Serial link (Xbee) rather than R/C. Using an Arduino, you can control any aspect of the robot using one central microcontroller that you can change as you want. You no longer have to use a separate ESC to read each R/C signal.

The Arduino

I again chose to use a nonstandard Arduino design (for reliable connections), similar to the ones used in Chapters 8 and 10. This board features built-in LEDs for D12 and D13 to act as both neutral indicator lights for the drive channels, and an acquiring-signal indicator when there is no R/C link. (They blink back and forth until the signal is restored.)

Also installed on the board are a 5v 1.5A voltage regulator, 3-pin servo connectors for each Analog pin, and screw-terminals used for secure connections to each I/O pin–remember, this is going to be used in battle! The Arduino design that I used in this project can be programmed using a standard FTDI programming cable from SparkFun.com, just as the other Arduino designs in this book. Figure 12-4 shows the Eagle PC board layout file of the Arduino used in this chapter.

The Battle-duino Eagle layout file

Figure 12.4. The Battle-duino Eagle layout file

You can download the design files to build your own Arduino and OSMC motor controller from https://sites.google.com/site/arduinorobotics/home/chapter12_files.

To build the Battle-duino clone, simply download the Eagle files and print your own using the instructions from Chapter 6. If you already know how to etch a PCB, then you know what to do.

The Motor Controllers

Five different motors in this project need bidirectional control. Four of them are drive-motors, and each set (left or right) of those four are controlled by the same signal. The fifth motor controls your weapon of choice: spinning-blade, lifting linear actuator, reversible hammer-spike, or anything else you can come up with. The result will be three inputs (left, right, and weapon), and five outputs (four drive motors and a weapon motor).

You can choose many different options for motor controllers, but I tend to go for what I can afford and what works. What I can afford usually limits my options down to one of the cheapest, commercially available options, or making one myself. As you might have noticed by now, that I am drawn toward using two specific motor controllers other than my own designs: the OSMC H-bridge and the Dimension Engineering Sabertooth line of motor controllers.

I almost always recommend the Sabertooth 2×25 motor controllers for most projects. They are inexpensive (comparatively), easy to use, and have an over-current limit that can keep you from burning them up. The Sabertooth drivers are for the people that don't want to build their own motor controller but want their robot to work without worry. In a Battle-bot competition, there is no time to worry about your electronics, so I recommend trusting the movement of your Battle-bot to a well-tested motor controller platform.

To prepare each Sabertooth to work for this project, set onboard DIP switches 2 and 5 to the on position, while leaving the remaining switches turned off. This enables the Sabertooth controllers to operate using lithium batteries (with low voltage cutoff), R/C pulse signal inputs, no timeout for use with a microcontroller (the Arduino), and independent mode (tank) steering. Or you can use the DIP Switch Wizard on the Sabertooth 2×25 product page to determine a different configuration: http://www.dimensionengineering.com/datasheets/Sabertoothdipwizard/start.htm.

The Open Source Motor controller has no internal current-limiting, but it offers extreme power for those times when you just need to push your bot to the limit. And because the OSMC is an open-source project, you can use the same tested schematic used for the original to design your own OSMC specific to your project's needs. The OSMC design used in this book is also suitable to use for the drive motors; although, you would need four more of them (one for each motor).

I currently use a set of two Sabertooth 2×25 motor controllers for the drive motors and a home-made OSMC motor controller for the weapon. If you plan on building a monster Battle-bot that weighs several hundred pounds, you might consider upgrading to the Sabertooth 2×50HV (dual 50-amp controller).

In Figure 12-5, you can see my single-sided PCB, through-hole component version of the OSMC motor controller, easily capable of powering a drive motor or weapon. Remember that the OSMC is nothing more than a highly efficient H-bridge, so you must have one for each motor and a microcontroller like the Arduino to send the drive signals to control it.

These three pictures show the various stages of the mini-OSMC board used for the weapon: the Eagle board file (left), the etched and drilled board (center), and the finished mini-OSMC board (right).

Figure 12.5. These three pictures show the various stages of the mini-OSMC board used for the weapon: the Eagle board file (left), the etched and drilled board (center), and the finished mini-OSMC board (right).

To build the mini-OSMC for your weapon motor, download the Eagle files from https://sites.google.com/site/arduinorobotics/home/chapter12_files.

With the Arduino and motor controllers selected and built, you need to build the frame.

The Frame

The frame is the backbone of any robot and should be extremely sturdy while attempting to remain as lightweight as possible (depending on your intended weight class). I made an 18-inch square frame using the 2-inch wide angle iron. I then mounted the motors to the inside of these pieces and the wheel axles to the outer corners. By adding four more braces across the front, back, and middle of the bot, it is strong enough to hold me jumping on top of it (155lbs) without flexing, which is a good start (see Figure 12-6).

The basic frame with motors, wheels, and batteries test-fitted

Figure 12.6. The basic frame with motors, wheels, and batteries test-fitted

I cannot as of yet, inexpensively create my own aluminum parts for each robot, so I chose to build my frame from materials that are easy to obtain at the local hardware store: angle iron, nuts and bolts, a drill and drill bits, and a saw.

Even if you plan to go in a different direction with your Battle-bot for weapons or attack methods, this frame is a solid base for you to start on. The frame without the wheels attached is slim, at only 3-inch thick. After you install the wheels to the frame, the height is increased to the diameter of the wheels used (in this case, 9 inches).

For a fully concealed design, you might use smaller solid-core wheels (3-inch to 5-inch diameter) and place the wheels and drive motors completely inside of the frame; although you might need to increase the frame dimensions to accommodate. Many of the popular Battle-bots used this design, as it leaves little in harm's way.

To Buy or Build?

If you are interested in building a Battle-bot but are not excited about building your own frame, RobotMarketplace.com sells Battle-kits made using machined aluminum pieces, a multilink chain drive system that utilizes two motors for complete four-wheel drive with speed reduction, and space for a speed controller and batteries (see Figure 12-7). The base for this type of bot comes with no motor, motor controllers, or batteries, for a mere $699. Although these kits are well made, they might be relatively expensive for someone just getting into the sport, so you can attempt to make your own frame.

A prebuilt Battle-kit from RobotMarketplace.com

Figure 12.7. A prebuilt Battle-kit from RobotMarketplace.com

If you can afford the price tag, more power to you. If I ever have that much money laying around, I would love to have one of these frames! If not, you can follow my guide to building your own. I know that my design is basic, but it can get you moving in the right direction.

Modifying the Wheels

I found some surplus electric scooter wheels that included the wheel, tire, bearings, and 65-tooth sprocket all for under $16 each including shipping. There is one caveat with this wheel assembly that I did not realize until I received them; they have a free-wheeling hub assembly that enables them to spin freely in one direction. Although that is great for a nonreversing scooter, it is not ideal for a bidirectional Battle-bot. How can you get around this? I had to weld a few spots on each free-wheel mechanism so that it would not freely spin in reverse (see Figure 12-16). This was annoying but well worth the money I saved versus buying the proper wheel and sprockets separately.

The proper wheel and sprocket pair is pictured in Figure 12-8, with a flat-topped tire for more traction and a direct bolt-on sprocket with no free-wheeling mechanism. You can also select how many teeth you want for specific gearing of your bot when buying the sprocket separately. If you are willing to pay the extra money, it can make your installation much easier and more reliable.

A wheel-and-sprocket pair, perfect for the Battle-bot

Figure 12.8. A wheel-and-sprocket pair, perfect for the Battle-bot

With the wheels modified and ready to mount, we must now start making the pieces needed for the main frame.

Building the Frame

To build the frame, you need the metal pieces, nuts and bolts, motors, wheel-assemblies, sprockets, chain, a Dremel tool, and a drill with drill-bits. It also helps to have an angle grinder and a reciprocating saw with a metal blade to quickly cut the metal pieces and smooth any sharp edges. This frame can be easy to measure, in that every metal piece (except the axles) should be exactly 18 inches.

The following five steps guide you through the frame building process:

  1. Cut four main frame pieces. Start by cutting the 2-inch angle iron (6 foot) segment into four equal 18-inch pieces. Two of these pieces will be drilled and cut (in step 2) with a Dremel tool to accommodate the wheel axles, motor-mounting, and tension adjustments. The other two pieces simply bolt to the front and rear of the frame, providing added support and a place to adjust the tension of each chain.

  2. Cut axle mounting grooves. Now you can cut the axle grooves at each end of the left and right frame pieces. They should be the width of the axle itself (5/16-inch), and the length should span about 2 inches to allow for adequate adjustment room. Start by measuring ½ inch away from the end of the angle iron from either side, and drill a 5/16-inch hole centered between the top and bottom of the 2-inch angle iron. (One inch from either the top or bottom is centered.) With the first pilot hole drilled, you can measure approximately 2 inch from the first pilot hole and drill another centered pilot hole. You can now cut out the space between the tops and bottoms of the two pilot holes with a Dremel to reveal the needed axle-groove to adjust the chain tension. This procedure is similar to what you did on the Lawn-bot in Chapter 10 to allow the motor-mounts to slide forward or backward. Figure 12-9 provides a better idea of how to cut the axle grooves and motor-mounting holes.

    The motor-mounting holes and axle grooves are cut into the left frame piece.

    Figure 12.9. The motor-mounting holes and axle grooves are cut into the left frame piece.

    In Figures 12-9 and 12-10, you can see the needed placement of each mounting hole and axle groove. When cut, the two side pieces should look similar to Figure 12-10; they should also be interchangeable, so you don't have to worry about labeling them. The motor output-shaft hole should be approximately 5 inches from each end of the 2-inch angle iron. The motor-mounting holes should be measured (from your motors) and marked after fitting the output-shaft hole. (The mounting holes on my motor are spaced 1 ⅜inch apart.)

    The two finished left and right side frame pieces

    Figure 12.10. The two finished left and right side frame pieces

  3. Cut frame braces. Now cut the two ¾-inch wide angle-iron center frame supports (also 18-inch)–if you bought a 36-inch section for this piece, simply cut it in half. You should then drill two holes, one on each end of both pieces, about ½ inch from each end. The hole should be the size of the bolts you use to mount each piece I used ⅜-inch diameter bolts, nuts, and washers to assemble my frame. At this point, you should have six metal pieces all 18 inches; two of them are ¾-inch angle-iron and the other four are 2-inch angle-iron. Each piece of angle iron used in the frame should have a hole drilled on each end to secure it to the adjacent piece with a bolt/nut. Your side frame rails should also have the appropriate holes drilled for the motors and axle grooves (see Figure 12-11).

    The side and center pieces of the sub frame with motors, ready for assembly

    Figure 12.11. The side and center pieces of the sub frame with motors, ready for assembly

  4. Assemble the pieces together. I first mounted the motors using the two lower bolts to secure each motor to the frame and then lined up the two center frame supports as close to the inside of each motor as would fit. I then marked each hole location with a permanent marker and drilled the mounting holes through the base of the side rails and ends of the center supports. After drilling the mounting holes, you can install the center supports using two bolts on each support (one on each end), as shown in Figure 12-12:

    The assembled subframe

    Figure 12.12. The assembled subframe

  5. With the center supports bolted to the side frame rails, you can now mount the front and rear frame rails, using two more bolts on each piece. If you haven't already, drill a hole on each end of the front and rear frame rails, line them up on top of the left and right frame rails, and drill the remaining holes to bolt the front and rear frame pieces to the left and right frame pieces, completing the square shape (see Figure 12-13).

    A diagram of the pieces used to build the frame

    Figure 12.13. A diagram of the pieces used to build the frame

After you have all six frame pieces bolted together and the motors mounted, the main frame assembly should be completed. You are now ready to add the drive train and get this bot moving.

The Drive Train

The drive train for this bot has a different purpose than the previous bots in this book, focusing on reliability during "battle." This bot will have four wheels, each wheel being driven by its own motor and H-bridge, such that if one wheel is disabled by the opponent, the bot can still move independently of the disabled wheel. As you can imagine, this means that you need 4x of each of the following:

  • Four DC motors

  • Four H-bridges

  • Four sprockets

  • Four wheels

  • Four chains

As an inexpensive option, I decided to go with four ungeared electric scooter motors available from Allelectronics.com for $15 each. The motors are Currie Technologies 135watt 24VDC, 10 Amps with a rated speed of 3000RPM. These electric motors are about the size of a soda can with an 8mm diameter output shaft, flattened on one side. They are usually purchased with a 3mm COG pulley sprocket mounted to the output shaft, intended for use with a COG drive belt commonly found on such scooters.

Because of the nature of this bot, I opted to use steel instead of rubber for the drive components. (Use whatever you want.) The COG pulleys can be removed from the motor output shafts, allowing you to replace them with chain-type sprockets.

Gearing

If you hook wheels directly to the motor output shafts spinning at up to 3000 RPM, the bot would be hard to start but extremely fast once moving. A battle-bot inevitably needs some torque to make sudden direction changes or move another bot in battle, which would be extremely difficult to achieve at 3000RPM with almost no torque. This bot needs to be geared down to provide more torque and less speed.

To reduce the speed of these motors, I used a set of sprockets on each motor/wheel pair to reduce the output speed from the 3000RPM motor speed to an approximate 500RPM wheel speed. This was accomplished using an 11-tooth sprocket on each motor output shaft, and a 65-tooth sprocket on each wheel-hub assembly.

Calculating Gear Ratio

According to Wikipedia, the smaller sprocket attached to the motor output shaft is called the "pinion or driver" and the larger sprocket attached to the drive wheel is called the "gear or driven." To calculate the gear ratio, you divide the number of teeth on the gear by the number of teeth on the pinion–or assuming you are gearing down, the larger number divided by the smaller number. For example:

65-tooth wheel sprocket / 11-tooth motor-drive sprocket = 5.91:1 gear ratio

This means that the pinion (motor gear) must spin 5.91 times before the (wheel) gear makes one complete rotation. Therefore, you can divide the raw motor-speed output (3000RPM) by the gear ratio (5.91) to find the maximum output speed at the wheel:

3000RPM DC Motor speed / 5.91x gear ratio = 509RPM Max wheel speed.

509 max RPM is a much more reasonable wheel speed than 3000RPM, providing 5.91x more torque to give the Battle-bot more power while still providing a good top speed.

Modifications

If you want an even slower output speed with higher torque (recommended for heavier bots), you might try using a 9-tooth pinion with a 90-tooth wheel gear: 90 / 9 = 10x gear ratio, which on 3000 rpm motors yields a wheel output speed of approximately 300RPM, about 60% of the speed that I used but with more torque.

For more information on gear ratios, check out: http://en.wikipedia.org/wiki/Gear_ratio. According to my calculations, our Battle-bot (as shown) with 9-inch tire diameter should be capable of a top speed around 14 mph. How so? Ughh, get out your calculator. You need to know the wheel diameter = 9 inches, and the motor output rotation speed = 509rpm. Here's the formula:

  • Inches per rotation of wheel = circumference = Pi × Diameter = 3.14 × 9″ = 28.26″ / rotation

  • Inches per minute = Inches per rotation × number of RPM = 28.26″ × 509 RPM = 14,384.34″ per minute

  • Feet per minute = Inches per minute / 12″ in one foot = 14,384.34″ / 12″ = 1198.7' per minute

  • Feet per hour = feet per minute × 60 minutes in one hour = 1198.7' × 60 = 71,922' / hour

  • Miles per hour = feet per hour / 5,280 feet in one mile = 71,922' / 5280' = 13.62mph

This formula assumes perfect traction and depends on the specifications of the motors, so you may not actually get a full 14mph from your bot, but it should give you a ballpark figure of the speeds possible.

I wanted this bot to be symmetrical, so there are two identical drive-train sections that need to be added to the frame. You can build them in any order because they will be the same. This consists of making the chain-tensioning nut, threading the nuts onto the axle in the correct sequence, measuring and cutting the chain, and then securing everything into place for a test drive.

Chain Tensioning Nut

Because this bot is chain-driven, each wheel needs to be adjustable to set the proper chain tension after it is fitted on the sprocket. I wanted to keep things simple, so I used one axle to share between the front wheels and one axle to share between the rear wheels. These axles are implemented using a 36-inch, 5/16-inch diameter threaded rod, some specially cut grooves (in the frame rails), and a chain-tensioning nut attached to the axle.

The axle diameter should be the same as the inside diameter of your wheel bearings; in my case that is 5/16-inch (or 8mm). The grooves that should be cut for the each axle should be exactly 5/16-inch wide, and about 2-inch long (or however far you want the axle to travel). Two inches of travel is typically plenty to get the chain easily around both sprockets before tensioning.

There are four tensioning screws, allowing for complete adjustment of all four wheels independently. I made (four) simple nut couplers that allow you to adjust each threaded-rod axle using an adjacent bolt, by welding a 5/16-inch nut (bottom) to a ¼-inch coupling-nut (top), as shown in Figure 12-14.

A C clamp holding the two nuts used to build the chain tensioning nut-assembly

Figure 12.14. A C clamp holding the two nuts used to build the chain tensioning nut-assembly

To make the 5/16-inch nut adapters, you need to have a C clamp or pair of vice grips to clamp the two nuts together. When clamped, you can add a small bead of weld to the spot where the two nuts meet. Welding one side should hold the nuts together for your purposes. If you want to be extra sure, also weld the other side of the nut. Make certain that you do not get any welding on the threads of either nut because this can hinder the threading of the bolts. I used a scrap bolt to barely thread into each nut while welding; this kept the stray molten welding bits from getting on the inner threads. When welded, you should be ready to start the threading process. To get everything installed correctly, you need to place the chain-tensioning nut assemblies, wheel nuts, and washers on in a certain sequence.

Threading Sequence

Start by sliding one of the axles through the axle groove on one side of the frame. Then thread the following parts on to the 5/16-inch threaded-rod axle (from the inside of the frame) in the following order:

  1. 5/16-inch flat washer

  2. 5/16-inch hex nut

  3. One of the chain-tensioning nut assemblies

  4. Another of the chain-tensioning nut assemblies

  5. Another 5/16-inch hex nut

  6. Another 5/16-inch flat washer

For a better illustration of this process, see Figure 12-15.

The axle threading process

Figure 12.15. The axle threading process

After you have the listed pieces onto the axle as shown in Figure 12-15, slide the left end of the threaded-rod into the left axle groove. With the axle through both sides of the frame, you can start making adjustments. Start by threading the two hex nuts (with flat washers in front) all the way to the inside of each axle groove, hand-tight only. Using a 36-inch threaded rod on an 18-inch wide frame yields about 9 inches of excess axle coming out of each side of the frame. You can now add another flat washer to each end of the axle, following a hex nut on each end; hand-tightened to the outside of the frame.

Thread the chain-tension nut assembly to about 2 inches from the axle groove. Now drill a hole in the back (or front) piece of angle iron, lined up with the chain-tension nut assembly. Place the ¼-inch bolt through this hole and thread it into the ¼-inch coupling-nut on the nut assembly, as shown in Figure 12-16.

A close-up view of the chain tensioning system

Figure 12.16. A close-up view of the chain tensioning system

Now measure and cut each chain; then mount the wheels to complete the drive train.

Measuring the Chain

Before you can install the wheels, measure and cut the chains. First, mount the small sprockets onto the motor output shafts securing the set screw on each; then place each wheel onto the axle, sliding the axle toward the center of the frame (about ½ inches from its forward-most position). Now place the uncut length of chain around the wheel sprocket and the motor sprocket to mark the exact length needed for each wheel.

When measured, I mark the chain with a permanent marker to show where to make a cut with my Dremel tool (cutoff wheel). My chains each measured approximately 19 ½-inch (or 50mm) in length. This used about 7 feet of chain, so I have a few feet left over to make some spares–trust me, you want a few spares (see Figure 12-17).

Measuring and cutting the chains

Figure 12.17. Measuring and cutting the chains

Make a mark on the side of a full chain link; then cut one side with a rotary cutoff wheel, and grind down the heads of the two pins. When cut, use a pair of pliers to break each side of the cut segment from the rest of the chain. After the two cut pieces are broken off, the back part of the link will fall out by itself, and you will be left with a clean chain segment, ready to attach to the other end using a Master chain link (see Figure 12-18).

A #25 master chain link used to connect two loose chain ends

Figure 12.18. A #25 master chain link used to connect two loose chain ends

Before securing each wheel into place, check each chain to make sure it is parallel to the frame.

Adding Spacers

Depending on your exact configuration, you may need more than one flat washer (to act as a spacer) between the outside of the frame and the inside of the wheel assembly (for each wheel). You first need to install the chain around both the motor sprocket and the wheel sprocket to determine if it is parallel to the frame.

If the chain is not parallel, you need to add flat washers (one at a time) between the wheel and frame, until the chain travels parallel to the frame. I had to add three flat washers before the chain was parallel, as shown in Figure 12.19.

Drive-train installation

Figure 12.19. Drive-train installation

With your chain parallel, you can adjust the chain-tension adjustment bolt (attached to the axle) until there is proper tension in each chain. I always tighten the chain until it is taut with no slack and then back up one turn to allow a small amount of slack. When using this small #25 chain, more than ¼inch of slack is probably too much.

When you get one wheel spinning smoothly and without resistance, you must do the same for the other three wheels. This process should be the same on each wheel because the Battle-bot is symmetrical.

After each wheel is installed and all four chains tensioned, it is time to select and install some batteries.

Batteries

The batteries for this project can be changed depending on what you want to use. I decided to try and keep this bot relatively lightweight by using Lithium Polymer batteries (Figure 12-20), abbreviated LiPo. LiPo batteries are typically 3.7v per cell and lightweight compared to lead acid for their charge capacity. These batteries must be charged with a LiPo-specific charger and must not be discharged beyond 3.0v per cell or risk catching on fire; so only use these batteries if you understand how to handle them.

A blue Lipo, hobby grade 3-cell lithium polymer battery pack (11.1v)

Figure 12.20. A blue Lipo, hobby grade 3-cell lithium polymer battery pack (11.1v)

Note

In a Battle-bot competition, you are usually required to mark your robot with a yellow sticker or some other colored marker to identify that you are using Lithium batteries.

Many online hobby shops have excellent pricing on LiPo batteries and chargers, making them affordable even on a budget. I found these Blue Lipo 3-cell (3.7v × 3 = 11.1v) 3000mAh (3AH) batteries for only $15 each. They have a 20c discharge rate, meaning that by itself, this battery is capable of discharging approximately 60 Amps continuously (3Ah × 20c = 60 A continuous). If you use two of these packs in parallel, the discharge rate doubles to 120 Amps (6Ah × 20c = 120 A).

To get more power to the motors, I decided to place two packs in series to make 22.2Vdc and 3000mAh. You can buy as many of these as you can afford and place several 22.2V (series packs) in parallel to achieve 6Ah, 9Ah, 12Ah, and so on. The LiPo battery packs weigh only approximately 1 pound per set, whereas a comparable SLA battery weighs approximately 6 pounds. Of course, the LiPo batteries are about twice the price of a comparable SLA battery, but you should buy only as many LiPo batteries as you need Amp Hour capacity to decrease the weight on your robot.

Alternatively, you can use Sealed Lead Acid batteries to get around having to buy a LiPo charger only or worrying about over-discharging. Two standard 12v 7Ah batteries would fit nicely in this frame. As you can see from Figure 12-21, either type of battery has plenty of room in this frame.

Either SLA (left) or LiPo (right) batteries fit in this frame.

Figure 12.21. Either SLA (left) or LiPo (right) batteries fit in this frame.

With the batteries selected, now install the electronics and make connections.

Securing Electronics

Now you need to secure the Arduino and each motor controller to the Battle-bot frame. I chose to again use a plastic project box enclosure from Radio Shack to house the electronics in a central location. By then protecting the project box with metal armor, the electronics are further protected from outside abuse.

Protecting Your Brains

To protect all your valuable electronics from damage, you need to house them somewhere away from your opponent's reach. I chose to house the electronics in a plastic Battle-Box that has a cooling fan mounted to its lid to keep the motor controllers from getting too hot. This box is a standard project-enclosure from Radio Shack with all the electronic components mounted to its base, walls, and lid. The idea is to tuck this box safely away into the center of the bot (see Figure 12-22), with some thick metal plating above it to keep it safe from danger.

The electronics housed inside of the Battle-box with a cooling fan in the lid

Figure 12.22. The electronics housed inside of the Battle-box with a cooling fan in the lid

If this box is damaged, not only would it immobilize your bot during a match, it would also likely destroy some valuable electronics. It is in your best interest as a competitor to... PROTECT THIS BOX! You wear a helmet in a football-game, right? Well, the Battle-box is the brain of your robot and is subjected to saw blades, hammers, and whatever your opponent has come up with. I recommend securing the Battle-box to your frame using several different methods (for example, bolts, straps, and ties). Imagine the feeling of seeing your robot's brains being scattered all over the floor after a good hit from your opponent–better to be safe than sorry!

Making Connections

The wiring in this project can be complex because there are three separate motor controllers to supply with a power supply and input signals. The OSMC board requires a minimum of two PWM signals, whereas the Sabertooth motor controllers in R/C mode each use a single digital pin to supply each drive signal (left and right).

The R/C signals must be read by the Arduino in the correct order (ch1 first, then ch2, and so on) to keep from missing any pulses; this is because the pulses are available to the Arduino one after another (in order). Trying to read the last pulse before the others can cause the Arduino to skip the previous pulses each loop. This caused me a bit of confusion when testing. For this reason, it is best to connect the R/C receiver according to channel number, and then assign each pin number accordingly in the Arduino code.

You can either use the Arduino's +5v regulator to power the R/C receiver or you can use the Sabertooth's onboard voltage regulator; although it has a smaller regulator and provides less current than the Arduino. Because these regulators are both linear, you dissipate a good bit of power if feeding either with a 22.2v to 24v input voltage. The OSMC has a switching 12v regulator, but using that pulls power from the OSMC driver chip and still wastes some heat after dropping from 12v to 5v through the linear regulators. When using a series battery connection, I find it easiest to power the Arduino with a 12v tap in the battery set, to avoid connecting the 5v regulators to a 24v input voltage.

Table 12-3 shows the wiring chart used to connect each signal in the Battle-bot.

Table 12.3. Wiring the Arduino to the Batteries, R/C Receiver, and Motor Controllers

Wire

Arduino

Connection

OSMC – AHI

D8

Connects the OSMC AHI to Arduino D8.

OSMC – ALI

D9

Connects the OSMC AHI to Arduino D9.

OSMC – BLI

D10

Connects the OSMC AHI to Arduino D10.

OSMC – BHI

D11

Connects the OSMC AHI to Arduino D11.

LED 1 – neutral light

D12

LED1 internally connected on Battle-duino board to D12.

LED 2 – neutral light

D13

LED2 internally connected on Battle-duino board to D13.

R/C receiver – channel 1

D14 = Analog pin A0

Connects R/C receiver ch1 to Arduino D14.

R/C receiver – channel 2

D15 = A1

Connects R/C receiver ch2 to Arduino D15.

R/C receiver – channel 3

D16 = A2

Connects R/C receiver ch3 to Arduino D16.

R/C receiver – channel 5

D17 = A3

Connects R/C receiver ch5 to Arduino D17.

Sabertooth 2×25 – Left input

D18 = A4

Connects left Sabertooth S1 and S2 to Arduino D18.

Sabertooth 2×25 – Right input

D19 = A5

Connects right Sabertooth S1 and S2 to Arduino D19.

Battery GND

GND

Connects battery GND wire to both Sabertooth motor controllers and the OSMC weapon controller and the Arduino.

Battery + (22.2v to 24v)

x

Connects the OSMC and Sabertooth controllers to the B+ positive battery supply, through a 40 to 60amp fuse.

Sabertooth +5v

VIN

You can power the Arduino and R/C receiver using the +5v supply from either Sabertooth motor controller.

You probably need some zip ties to tidy up the wiring after you finish to keep any longer wires from catching on debris and being pulled loose. You may also want to use quick-connect (male/female spade terminals) between the motors and motor controllers to allow you to easily make repairs.

It is also a good idea to install an emergency shut-off toggle switch on the bot to disconnect the power supply quickly if needed. I used a standard On/Off SPST switch mounted to the frame connected to the +24v supply. To protect the motor controllers and Arduino, it is always best to install a fuse in series with the 24v power supply in case of a short circuit. To better visualize the Battle-bot wiring chart in Table 12-3, see Figure 12-23.

A visual diagram of the Battle-bot wiring

Figure 12.23. A visual diagram of the Battle-bot wiring

With the electronics securely installed in the Battle-bot frame and the wiring connected according to Table 12-3 and Figure 12-23, you should be ready to load the code to the Arduino and test the frame before adding the weapons and armor.

The Code

The code for the Battle-bot reads the R/C pulses from the receiver and decides what to do with each motor and weapon. As a software failsafe, the code checks to make sure both drive channels have a valid pulse before proceeding; if either channel's pulse signal is lost, the Battle-bot goes into acquiring-signal mode and commands the drive motors and weapon to stop. (LED1 and LED2 also flash to indicate a lost signal.) After the Arduino detects a valid signal on both drive channels, the drive motors engage, and the code begins to check the signal value of the weapon disarm toggle switch (connected to R/C channel 5). If the disarm switch is turned on, the weapon disengages and its signal is not processed. After the weapon disarm switch is turned off, the Arduino can begin processing the weapon control signal, and the weapon engages; this provides an extra layer of security to keep from accidentally activating the weapon before you are ready.

Before testing, double-check all connections per Table 12-2 and Figure 12-23. Listing 12-1 shows the final code.

Example 12.1. The Final Code for the Battle-Bot

// Chapter 12 – The Battle-bot
// Controls 2 Sabertooth motor controllers using R/C pulse signal
// Controls battle-bot weapon using OSMC (open-source motor=controller)
// Decodes 2 R/C servo signals for the Left and Right drive channels (Sabertooth 2×25 in R/C mode)
// Decodes 1 R/C servo signal for weapon (OSMC)
//
//

// Create names for R/C pulse input pins D14 - D17
int RC_1 = 14;
int RC_2 = 15;
int RC_3 = 16;
int RC_4 = 17;

// Create names for R/C pulse output pins D18 and D19
int Left_OUT = 18;
int Right_OUT = 19;

// Name LEDs and attach to pins D12 and D13
int LED_1 = 12;
int LED_2 = 13;

// Name weapon motor controller output pins and attach to D8 - D11
int OSMC_BHI = 8;
int OSMC_BLI = 11;  // PWM pin
int OSMC_ALI = 10;  // PWM pin
int OSMC_AHI = 9;

// create variables for weapon deadband and arming weapon
int deadband = 10;
int weapon_armed = false;
// Variables to store R/C values
// values for R/C channel 1
int servo1_val;
int adj_val1;
int servo1_Ready;
// values for R/C channel 2
int servo2_val;
int adj_val2;
int servo2_Ready;
// values for R/C channel 3
int servo3_val;
int adj_val3;
int servo3_Ready;
// values for R/C channel 4
int servo4_val;
int adj_val4;
int servo4_Ready;


// End of Variables

// Begin Setup() function

void setup() {

 // changes PWM frequency on pins 9 & 10 to 32kHz for weapon
 TCCR1B = TCCR1B & 0b11111000 | 0x01;

 //motor pins
 pinMode(OSMC_ALI, OUTPUT);
 pinMode(OSMC_AHI, OUTPUT);
 pinMode(OSMC_BLI, OUTPUT);
 pinMode(OSMC_BHI, OUTPUT);

 //led's
 pinMode(LED_1, OUTPUT);
 pinMode(LED_2, OUTPUT);

 // R/C signal outputs
 pinMode(Left_OUT, OUTPUT);
 pinMode(Right_OUT, OUTPUT);

 //PPM inputs from RC receiver
 pinMode(RC_1, INPUT);
 pinMode(RC_2, INPUT);
 pinMode(RC_3, INPUT);
 pinMode(RC_4, INPUT);

 // Set all OSMC pins LOW during Setup
 digitalWrite(OSMC_BHI, LOW); // AHI and BHI should be HIGH for electric brake
 digitalWrite(OSMC_ALI, LOW);
digitalWrite(OSMC_AHI, LOW); // AHI and BHI should be HIGH for electric brake
 digitalWrite(OSMC_BLI, LOW);

 // blink LEDs to verify setup
 digitalWrite(LED_1, HIGH);
 digitalWrite(LED_2, LOW);
 delay(1000);
 digitalWrite(LED_2, HIGH);
 digitalWrite(LED_1, LOW);
 delay(1000);
 digitalWrite(LED_2, LOW);

 // Write OSMC Hi-side pins HIGH, enabling electric-brake for weapon motor when not being used
 digitalWrite(OSMC_AHI, HIGH);
 digitalWrite(OSMC_BHI, HIGH);

}

// End of Setup()

// Begin Loop() function


void loop() {

 // Read R/C signals from receiver
 servo1_val = pulseIn(RC_1, HIGH, 20000); // weapon channel
 servo2_val = pulseIn(RC_2, HIGH, 20000); // left drive channel
 servo3_val = pulseIn(RC_3, HIGH, 20000); // right drive channel
 servo4_val = pulseIn(RC_4, HIGH, 20000); // weapon disable switch


 // Failsafe check - Check to see if BOTH drive channels are valid before processing anything else
 if (servo2_val > 0 && servo3_val > 0) {

   // turn on Neutral LEDs for the drive channels if they are centered (individually).
   // LED 1 for left drive channel
   if (servo2_val < 1550 && servo2_val > 1450){
     digitalWrite(LED_1, HIGH);
   }
   else{
    digitalWrite(LED_1, LOW);
   }
   // LED 2 for right drive channel
   if (servo3_val < 1550 && servo3_val > 1450){
     digitalWrite(LED_2, HIGH);
   }
   else{
    digitalWrite(LED_2, LOW);
   }
// Check to see if Toggle switch is engaged (R/C ch5), before enabling Weapon
    if (servo4_val > 1550){
      // arm weapon
      weapon_armed = true;
      // Then, go ahead and process the Weapon value
      if (servo1_val > 800 && servo1_val < 2200){

        // Map bi-directional value from R/C Servo pulse centered at 1500 milliseconds,
        // to a forward/reverse value centered at 0.
        // 255 = full forward, 0 = Neutral, −255 = full reverse
        adj_val1 = map(servo1_val, 1000, 2000, −255, 255);

        // Limit the values to +/− 255
        if (adj_val1 > 255){
          adj_val1 = 255;
        }
        if (adj_val1 < −255){
          adj_val1 = −255;
        }

        // Check signal for direction of motor (positive or negative value)
        if (adj_val1 > deadband){
          // if value is positive, write forward value to motor
          weapon_forward(adj_val1);
        }
        else if (adj_val1 < -deadband){
          // if value is negative, convert to positive (*−1) then write reverse value to motor
          adj_val1 = adj_val1 * −1;
          weapon_reverse(adj_val1);
        }
        else {
          // otherwise, weapon signal is neutral, stop weapon motor.
          weapon_stop();
          adj_val1 = 0;
        }
      }
      else {
        // else, if the weapon toggle switch is disengaged, stop weapon (from above)
        weapon_stop();
      }
    }
    else{
     // else, if Drive signals are not valid disable weapon - extra failsafe
     weapon_armed = false;
     weapon_stop();
    }
  }

  // If drive signals are not valid, stop using Neutral LEDs and make them blink
  // back and forth until the signal is restored - see the acquiring() function.
  else {
servo2_val = 1500;
    servo3_val = 1500;
    weapon_armed = false;
    acquiring();
  }

  // Lastly, send the R/C pulses to the Sabertooth
  Send_Pulses();

  }

  // End Loop

  // Begin extra functions


  void acquiring(){
   // while R/C receiver is searching for a signal, blink LEDs
   digitalWrite(LED_1, HIGH);
   digitalWrite(LED_2, LOW);
   delay(200);
   digitalWrite(LED_2, HIGH);
   digitalWrite(LED_1, LOW);
   delay(200);
   digitalWrite(LED_2, LOW);

  }

  void Send_Pulses(){
   // send Left R/C pulse to left Sabertooth S1 and S2
   digitalWrite(Left_OUT, HIGH);
   delayMicroseconds(servo2_val);
   digitalWrite(Left_OUT, LOW);

   // send Right R/C pulse to right Sabertooth S1 and S2
   digitalWrite(Right_OUT, HIGH);
   delayMicroseconds(servo3_val);
   digitalWrite(Right_OUT, LOW);
  }


  // motor forward function for OSMC
  void weapon_forward(int speed_val1){
   digitalWrite(OSMC_BLI, LOW);
   analogWrite(OSMC_ALI, speed_val1);
  }
  // motor reverse function for OSMC
  void weapon_reverse(int speed_val2){
   digitalWrite(OSMC_ALI, LOW);
   analogWrite(OSMC_BLI, speed_val2);
  }
// motor stop function for OSMC
 void weapon_stop() {
  digitalWrite(OSMC_ALI, LOW);
  digitalWrite(OSMC_BLI, LOW);
 }

 // End of extra functions
 // End of Code

After verifying that the code has loaded properly, you can begin testing your Battle-bot frame. Make sure each motor spins in the correct direction and that the motor sides are not reversed (that is, left stick controls left motors, and vice versa). When everything looks good, you should probably give your new robot frame a spin around the back yard to test for any weak joints or loose bolts before installing the armor and weapon.

Armor

What you choose to clothe your robot in is your business, but I chose a nice pair of sheet-metal knickers and a swinging axe for a top. You can choose from many materials such as steel, titanium, aluminum, carbon fiber, fiberglass, and even weapons that protect the bot like armor. (Look up "Son of Wyachi" on Google.) I chose to use the strongest material for the best price: steel plating in the form of 16 AWG sheet metal (see Figure 12-24). This sheet metal is difficult for me to flex, and when installed and bolted down it is even stronger.

The basic frame fully assembled with armor

Figure 12.24. The basic frame fully assembled with armor

Installation of the armor is much easier if you get pieces the same size as your bot frame. I could not easily find a precut 18-inch × 18-inch piece, but I did find one 12-inch × 18-inch and one 6-inch × 18-inch, which together fit quite nicely without having to cut anything. If you look toward the left side of the bot in the picture, you can see the seam where the two pieces meet. Perhaps a small bead of welding across the seam would make it look more professional, but it is not necessary. Use another piece of sheet metal on the underside of the bot to keep it protected if it happens to get flipped over.

When armored, the Battle-bot should be better suited to take a hit during battle, but until you add some weapons, there isn't much you can do to the opponent.

Weapons

Although the operator of a Battle-bot must know how to effectively drive the bot, having a few good weapons never hurts. For our Battle-bot, I decided to use two types of weapons: an active swinging-arm weapon used for impaling the opponent, and a passive set of bidirectional spears mounted to the front and rear of the bot used for ramming the opponent at high speeds. The spears act as weapons as long as you have at least 2 motors work, whereas the swinging-arm weapon relies on a separate H-bridge to power its motor.

There are many types of active and passive weapons from wedges, spinning blades, lifting arms, clenching jaws, swinging arms, rams, and over-sized drilling bores–to name a few. Though surprising, sometimes the simplest designs can be the most effective. The ever-popular heavyweight champion BioHazard used a sleek 4-inch tall bot frame with a powerful lifting arm mechanism (much like a forklift) to disable almost anyone in his path.

To build the weapons used on this bot, you need the parts listed for the weapon in Table 12-2. The following eight steps guide you through the weapon building process:

  1. Modify the wheel hub for the weapon. I started by looking through my inventory: I stumbled upon a Schwinn S350 electric scooter a few months ago while cleaning up at work. (Someone left it in a dumpster!) I quickly removed it and took it home for a closer inspection; there was a perfectly good 350w, 24vdc, 22Amp electric motor with mounting-bracket, chain, wheels, sprockets, wiring, throttle, and motor controller. I have also found several electric scooters at my local thrift store for under $20, which also included the motor, chain, sprockets, and so on.

    I decided that I would sacrifice the rear wheel/motor/sprocket assembly from this scooter to make a spinning axle for an over-head spike hammer that I had in mind. The first thing I did was cut the actual tire/rim from the spokes connecting to the rim, using a reciprocating saw and a steel-cutting blade (see Figure 12-25). I wanted to use this axle assembly because it includes a 90-tooth sprocket, spokes to mount the weapon, and a spinning axle with threaded shaft, and the motor is easily mounted using the scooter motor-mount bracket.

    Cutting the wheel hub assembly from a rim to use as the weapon axle

    Figure 12.25. Cutting the wheel hub assembly from a rim to use as the weapon axle

    After cutting the wheel hub from the tire/rim, you can drill one hole toward the end of each spoke. You use only two of these to mount the swinging arm. To build the weapons on this bot, you probably need a welder, so if you don't have a one, you either need to invest about $100 in a small welder or make friends with someone who will loan you one–remember to wear eye protection!

  2. Make the weapon mount bracket. You must have something to mount the spinning scooter axle to, so I chose to use two pieces of ¾-inch square steel tube to hold the axle above the frame. I made two identical parallel braces to mount to the frame and also to the weapon axle assembly.

    Start by making two V cuts in the square tube using a reciprocating saw, hacksaw, or angle grinder (see Figure 12-26). I used two 36-inch pieces of steel tubing, cutting 4 inches off of each piece. Measure and mark the V cuts to be 3 inches from one end and 9 inches from the other end. The 9-inch and 3-inch ends should be mounted perpendicular to the frame (at right angles), whereas the 20-inch center section can take the slope between them.

    Cutting V notches in the weapon brackets

    Figure 12.26. Cutting V notches in the weapon brackets

    You will want to test fit the bracket to make sure it mounts to the front and rear of the frame before securing the V cuts. I used a welder to secure the joints after making sure they fit snugly around the frame. For a better illustration of the weapon brackets, see Figure 12-27).

    A diagram of the shape for each weapon bracket

    Figure 12.27. A diagram of the shape for each weapon bracket

  3. Test fit the axle into the weapon brackets. After making both brackets (the same size), drill a hole near the top of the 9-inch piece to mount the weapon axle assembly. You can lay the two weapon brackets flat on top of one another and drill the hole through both at the same spot to make sure they line up for the axle. The weapon axle needs to be mounted as high in the brackets as possible (about 1- inch or 2 inches from the top). Use the two nuts from the axle assembly to mount it to the weapon brackets, making sure the axle spins freely after mounting. Now mount the weapon brackets to the center of the frame by drilling one hole at the bottom of each square tube, and then bolt each weapon bracket to the frame (see Figure 12-28).

    The frame with the weapon brackets and axle test-fitted

    Figure 12.28. The frame with the weapon brackets and axle test-fitted

  4. Mount the DC motor assembly. Using a DC motor assembly from a scooter, mount onto the weapon axle and install into weapon brackets. The square tubes should be parallel to each other when mounted, as shown in Figure 12-29.

    The finished frame with weapon axle and motor installed

    Figure 12.29. The finished frame with weapon axle and motor installed

  5. Cut a small semicircle in the 2-inch wide steel flat bar.

    Cutting a small semi-circle (about 1-inch radius from the edge) near the end of the swinging-arm allows it to contour to the weapon axle shaft. I used an angle-grinder wheel to cut out the area marked with permanent marker (see Figure 12-30).

    Modify the swinging arm to fit around the weapon axle (left, and the swinging-arm test fitted onto the weapon axle assembly (right).

    Figure 12.30. Modify the swinging arm to fit around the weapon axle (left, and the swinging-arm test fitted onto the weapon axle assembly (right).

  6. Mount a steel flat bar arm to the weapon axle assembly. Place the flat bar onto the axle assembly, and mark the holes that you drilled through two of the wheel spokes (from step 1) onto the flat bar. You need to drill holes on these marks and use two bolts to secure the flat bar swing arm to the wheel spokes on the weapon axle (refer to Figure 12-30).

  7. Add whatever kinds of scrap metal you can find to the end of the swinging arm; this is up to you. I used a few pieces of angle iron to fashioned into a spike and mount to the front of the arm to act as a small wedge when the spike is not used. Again, I used a welder to attach these pieces to the end of the arm (see Figures 12-31 and 12-32).

    These two pictures show the scrap pieces I used for the weapon spike.

    Figure 12.31. These two pictures show the scrap pieces I used for the weapon spike.

    These two pictures show how I attached weapon (welding).

    Figure 12.32. These two pictures show how I attached weapon (welding).

  8. If you want ramming spikes, get out the ⅝-inch solid steel round rod and start sharpening with an angle grinder. I spent an hour grinding and cutting on the ends of the steel rod until it had some mean looking points. Get ready for a spark shower though and wear a dust mask; these particles are not good to get in your lungs (see Figure 12-33).

    Grinding the spikes to make sharp points

    Figure 12.33. Grinding the spikes to make sharp points

    By drilling a set of 5/8-inch holes through the frame on both ends, you can slide these ramming spears through the frame to mount them. You can either weld them into place for a permanent fix, or drill a hole through the rod just inside the frame on each end placing a bolt through each hole. The rod cannot slide past the frame, and you can remove the spears easily for transporting/safety.

The spikes protruding from the frame, ready to impale an opponent

Figure 12.34. The spikes protruding from the frame, ready to impale an opponent

With the weapons installed, you should be almost ready for battle. Time to check all your wiring connections, chain tension, tire air pressure, battery levels, and a place to make sure nobody gets hurt while you test out your creature of doom.

Now it is time to start signing up for a Battle-bot competition! Check the following "Additional Information" section to find out where to look for battles in your area.

Additional Information

For additional information regarding Battle-bot rules, regulations, building advice, and upcoming events, you can check the Battle-bots website at http://www.battlebots.com.

For other events go to http://www.robogames.net/.

One of the most complete and detailed guides to building a Battle-bot comes from team RioBotz, which produced a 367-page PDF file jam-packed full of design comparisons, weapon types, building tips, frame construction, and so on. If you are serious about building a competition Battle-bot, you MUST read this, available at http://www.riobotz.com.br/riobotz_combot_tutorial.pdf.

For building information, first check out Team Nightmare and the Robot Marketplace. The Robot Marketplace has nearly any part you can imagine for a Battle-bot and is also an excellent source for most general robotics projects. Go to http://www.robotcombat.com/.

A former Battle-bot judge gives his tips for winning at http://www.robotics-society.org/jds-rules.shtml.

Team Davinci has some excellent tips on building at http://www.teamdavinci.com/.

Summary

This chapter discussed several aspects of building a competitive fighting robot. The concepts were merely suggestions to get you started if you are interested in this growing sport. Because there is no "right" way to build a Battle-bot, I encourage you to use your creativity and try something new!

I designed my Battle-bot to have four independently powered drive wheels, a fifth motor to control the active swinging spike-hammer weapon, and two ramming spikes protruding from the front and rear of the metal frame. Using LiPo batteries helped reduce the weight of the Battle-bot by up to 10 pounds (versus SLA) while maintaining the same charge capacity. For added protection, the electronics were placed in a plastic project box mounted to the frame and covered by a layer of metal armor on each side.

The next chapter revisits a previous robot (the Explorer-bot from Chapter 8) to provide a new method of control. Using a pair of Xbee radios and a custom interface, you create a wireless Serial link between the Explorer-bot and your computer to control the robot using a PC game pad.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset