Chapter 4. Controlling DC Motors

In Chapter 3, Adding Display Functionality, you learned how to connect to the outside world using jumper wires and specially designed hardware called shields. In this chapter, you'll learn the following:

  • How to use the Galileo to control small DC motors
  • How to take this to the next level, learning how to add more functionality using a shield to control the speed and direction of more powerful DC motors

DC motor basics

Before we get started with connecting everything and making it all move, let's spend some time understanding some of the basics of DC motor control. Whether you choose a two or four wheeled mobile platform, or a tracked platform, the basic movement control is the same. The unit moves by engaging the motors. If the desired direction is straight, the motors are run at the same speed. If you want to turn the unit, the motors are run at different speeds. The unit can actually turn in a circle if you run one motor forward and one backwards.

DC motors are fairly straightforward devices. The speed and direction of the motor is controlled by the magnitude and polarity of the voltage applied to its terminals. The higher the voltage, the faster the motor will turn. If you reverse the polarity of the voltage, you can reverse the direction the motor is turning in.

However, the magnitude and polarity of the voltage are not the only factor that is important when it comes to controlling your motors. The power that your motor can apply to moving your platform is also determined by the voltage and the current supplied at its terminals.

Now, there are actually GPIO pins on the Galileo that you could use to create the control voltage and drive your motors directly. The challenge with this method is that the Galileo cannot normally source enough current and voltage and thus your motors would not be able to generate enough power to move a mobile platform.

There are several solutions to this problem. The first is to use a simple transistor circuit and an external voltage source. You'll use this solution in the first example of this chapter. Another solution is to use an H-bridge, a chip that the Galileo can control but that is connected to a power source and can provide enough current. The second example in this chapter will show you how to use this sort of chip. The third solution to the problem is to use a shield that contains all the circuitry and can connect to an external power source input. Then your Galileo can provide both voltage and current so that your platform can move reliably. The last example in this chapter will use a motor controller shield designed for the Arduino to make DC motor control simple.

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

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