Thursday, June 23, 2011

At last! Productivity!

Well I most certainly did not get anything done that week! However, the semester is over, I survived finals, I have a job at home, and I finally have a bit of time to work on the robot. Actually, I managed to get the drive motors working when I got out of school 3 weeks ago. I copped out on using the MOSFETs, though. I figured I'd try a quick and dirty solution to get it working first, and then work out a much nicer and more efficient motor controller later. The following schematic is the one I used, and the one that was suggested to me on the All About Circuits forums.

As you may or may not be able to tell, the above circuit uses relays, rather than MOSFETs. A relay works using the principle that current generates a magnetic field around a wire. A wire can be coiled in order to increase the strength of this created magnetic field. A relay has a coil of wire inside that creates a magnetic field when activated, and this magnetic field attracts a magnetic switch towards it, closing a circuit. The schematic symbol for relays pretty accurately depicts this concept. The relays I used are called Single Pole Double Throw (SPDT) meaning that there is only one switch, but it can close two different circuits. These relays have a normally open (NO) side and a normally close (NC) side that describes which way is a closed switch and which is an open if there is no current activating the relay.

The circuit above has the NC part of the switch bringing both motor leads to ground. This way, when the motor is running, and suddenly told to stop, the current generated by the magnetic field of the motor not wanting to collapse can be sent to ground, allowing the magnetic field to collapse in a much more gentle fashion. Then, when the left relay is activated, the left side of the motor is set to the positive voltage, and the motor runs one way, and if the right one is activated, with the left side being inactivated, the motor runs the other way. And due to the nature of SPDT relays, it is impossible to activate the high and low of one side of the H bridge and create a short circuit.

All in all, the relay h bridge is a quick and dirty solution to the motor controller problem. However, this design does have the following cons:

  • Relays take more energy - The activation coil requires current to turn the relay on so it requires a small amount of current to keep the motors going. This small amount adds up over time and drains the batteries quicker.
  • Relays don't allow for PWM and speed adjustment - Relays are either on or off and so don't have the capacity for scaling and speed control like MOSFETs do.
  • Relays are bulky - As you see in the picture above, relays are fairly sizable beasts and take up a lot of room. MOSFETs, on the other hand, are much more compact and can fit in smaller spaces.
  • Relays are less durable - They are only rated for a certain number of on and off cycles. The contacts inside break down over time due to the sparks that inevitably occur when current is abruptly allowed or stopped.
So basically while relays are nice and convenient, they're not an efficient or elegant way to make a motor controller. Sometime in the future when I actually have time I'll have to work on remaking the motor controller. In the mean time, however, this will certainly work well enough to make the robot move. I'd include some videos of it in action, but the robot isn't actually capable of movement at the moment for reasons I'll disclose in the next blog post. Once it's up and running, however, I'll be sure to throw a video in here!