Hexabot: Build a heavy duty six-legged robot! by rpantaleo
Contest WinnerFeatured

Step 16: Electronics time

electronics_housing.JPG
With the heavy-duty construction out of the way, it's time to focus on electronics.

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
 
Remove these adsRemove these ads by Signing Up
manojkumar6027 says: May 6, 2011. 6:11 AM
sir please send microcontroler circuit
rpantaleo (author) says: May 9, 2011. 3:58 PM
I'm afraid the only circuit/schematic I have is the one in Step 16. Sorry.
karankochhar13 says: Nov 13, 2010. 9:34 PM
can u upload a pdf file of microcontroler and relays because i am not good in electronics and it is confusing and i am new in robotics
rpantaleo (author) says: Nov 23, 2010. 6:45 PM
I'm afraid the schematic on Step 13 is the best I'm going to be able to provide.

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.
banksviolette says: Jul 12, 2010. 9:04 PM
I loved your project, and your presentation/explanation was very clear and well laid out, so thanks. I'm just starting to use arduino, and learning about motor control. One question I have about how you handled wiring the controller has to do with the amperage and how you bridge the low current of the arduino and the high current of the motor/battery? I get the general idea, but maybe you could give some specifics on the transistors used, the amp rating on the motor, etc? I'm following you thru most of this but get lost on that point (sorry: I'm only just learning this stuff). Thanks for any help you can give
rpantaleo (author) says: Jul 13, 2010. 4:31 PM
Thanks!

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.
banksviolette says: Jul 14, 2010. 5:19 AM
Thanks so much - I've been scanning through a number of different sites/forums/etc, trying to figure out out how to increase the amperage btwn the arduino and the motor. I'm pretty sure I pieced it together, but your explanation is (again) really helpful. My apologies if any of my question felt remedial or anything. Again, I'm really new to this, so thanks for being patient and explaining this so clearly. Again: great project.
mushroomdude says: Feb 27, 2010. 9:20 PM
(removed by author or community request)
rpantaleo (author) says: Feb 28, 2010. 6:34 AM
 The Arduino is programmed to turn the relays on and off in certain patterns to control the motors. Check out the Arduino homepage for more info on Arduinos in general: www.arduino.cc/

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.

Don.Jambo says: May 28, 2009. 11:10 PM
The automotive relays are have 4 pins or more?
rpantaleo (author) says: Jun 1, 2009. 1:28 PM
5 pins
Don.Jambo says: Apr 6, 2009. 4:58 AM
And about the joystick: any joystick is good (PC gaming, alarm systems, toys, machinery) or you have to use a wheel chair joystick? Thx
rpantaleo (author) says: Apr 6, 2009. 7:17 AM
Any joystick is fine, provided you know how to wire it to the Arduino to get it to do what you want. I used one that is commonly found in arcade gaming machines http://www.allelectronics.com/make-a-store/item/JS-5/JOYSTICK/-/1.html.
Don.Jambo says: Apr 6, 2009. 4:52 AM
Which Arduino mircocontroller did you use?! the Arduino Mega or the Arduino Duemilanove? I cannot see that in the pics, and you didn't specify what model! Please let me know as soon as possible, cause I want to order it! Thanks, and Great Project! DonJambo
rpantaleo (author) says: Apr 6, 2009. 7:10 AM
I used the Arduino Diecimilia (the Duemilanove and Mega weren't out yet when I started the project), but the Duemilanove would work just fine since it is the next generation Diecimilia.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!