Tutorials/Arduino Projects/RC car Hacking Project/Controlling the motors

From ROBOTC API Guide
Jump to: navigation, search
ArduinoArduino Tutorials and Guided Projects → Tutorials/Arduino Projects/RC car Hacking Project/Controlling the motors


Interfacing the Arduino

The first thing we need to do before we can connect the motors is power the Arduino. To power the Arduino from the RC car power supply using the wires we soldered earlier, we will use the Arduino's 'Vin' pin which allows it to be powered from an external source without using the power plug.

Set the circuit up like the diagram below. We use the breadboard as we will need the raw battery power supply later to power the motors.

Treat the AAA battery holder as a stand-in for the vehicle's battery pack.

Turn the car on and you should see the Arduino power up.

Connecting the motors

DC motors cannot be directly controlled by the Arduino - we will need an external motor controller to allow speed regulation as well as forwards/backwards control. These controllers all use the same fundamental concept - the H-bridge. This will use the PWM signal and convert it into useful DC motor commands.

Thankfully, VEX robotics has recently released the Motor Controller 29 - a nifty, compact motor controller to use with their new line of 2-wire motors. Fortunately for us, this is a controller that will work perfectly with our DC motors.

Another option for a motor controller is an Arduino Shield such as the Ardumoto from Sparkfun. This acts as a shield for the Arduino which lets you control up to 2 DC motors - perfect for our purposes.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox