Step 16: Electronics time

Picture of Electronics time
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
sir please send microcontroler circuit
rpantaleo (author)  manojkumar60274 years ago
I'm afraid the only circuit/schematic I have is the one in Step 16. Sorry.
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
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)  banksviolette4 years ago

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.
Don.Jambo6 years ago
The automotive relays are have 4 pins or more?
Don.Jambo6 years ago
And about the joystick: any joystick is good (PC gaming, alarm systems, toys, machinery) or you have to use a wheel chair joystick? Thx
Don.Jambo6 years ago
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