Step 16Electronics time
Since I didn't have budget for a motor controller, I decided to use relays to control the motors. Relays only allow for the motor to run at one speed, but that's the price you pay for a cheap controller circuit (no pun intended).
For the robot's brain, I used an Arduino mircocontroller, which is a cheap, open source microcontroller. Tons of documentation exists for this controller, and it is very easy to use (speaking as a mechanical engineering student who had no microcontroller experience prior to this past semester).
Since the relays being used are 12 V, they can't just be controlled with a direct output from the Arduino (which has a max voltage output of 5 V). Transistors connected to pins on the Arduino must be used to send the 12 V (which will be pulled from the lead acid batteries) to the relays.
You can download the motor control schematic below. The schematic was made using CadSoft's EAGLE layout program. It is available as freeware. The wiring for the joystick and switches/buttons is not included because it is very basic (the joystick just triggers four switches; a very simple design). There's a tutorial here if you're interested in learning how to properly wire a switch or push button into a microcontroller.
You'll notice there are resistors connected to the base of each transistor. You'll need to do some calculations to determine what value this resistor should be. This website is a good resource for determining this resistor value.
*Disclaimer* I'm no electrical engineer. I have a somewhat cursory understanding of electronics, so I'm going to have to gloss over the details in this step. I did learn a lot from my class, Making Things Interactive, as well as tutorials like this one from the Arduino Website. The motor schematic, which I drew, was actually designed by CMU Robotics Club Vice President Austin Buchan, who assisted me a great deal with all of the electrical aspects of this project.
motor_schematic.pdf(792x612) 13 KB| « Previous Step | Download PDFView All Steps | Next Step » |































































In light of that, here is a forum thread on connecting relays to an Arduino: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1196698219
Keep in mind that you really don't need to use a very complicated circuit to control the hexabot. I used a microcontroller and more complicated circuit because it was required for the class I was taking, but realistically all you need is a couple high-current rated switches to turn power on and off to each motor.
Ok, let's see if I can explain this (electronics are certainly not my forte!)
I'll make it simpler and explain a circuit that will just turn one motor on or off. One of these motors could draw a lot of current, in this case we are limited to 30 amps due to the fuse between the battery and the motor. 30 amps is a lot of current and is far too much for any component of the Arduino to handle. So, we need an intermediate device between the Arduino and the motor.
For this, we want a relay, which is essentially an electronically controlled switch. A simple relay would have pins for connecting the high current lines, as well as a pin or pins for connecting to the Arduino. The switching of the relay is done electromagnetically; the Arduino sends a signal to the relay and this signal energizes a coil, which switches the relay on or off.
For hexabot, the relays I chose required 12V to switch. However, the output pins on the Arduino can only put out a maximum of 5V. So, we need another intermediate device to switch the relays. For this, you could use another set of relays (that only need 5V to switch) or a transistor (which can be used as a switch).
I chose a transistor because they take up less space on a circuit board than a relay and are a little easier to wire up. I would use a TIP120 NPN transistor. Here's a simple wiring diagram showing a TIP120 controlling a low current motor with and Arduino.
The 12V running through the transistor is sourced from the same battery that powers the motors, but the circuit is separate so it will only pull a small amount of current through the transistor (whatever the coil draws in the relay).
Hope this helps.
A motor controller is a something like this: www.robotmarketplace.com/products/IFI-V883.html. Basically it is a more complicated circuit that allows the motor to turn at variable speeds. By definition, my circuit is a motor controller too, but it is far simpler and is only able to make the motors spin at one speed.