DS3:008 – Motors and Other Actuators

So far, our physical output has been limited to controlling LEDs and small servo motors. With the Arduino we can control other devices also.

Artists working with robotics, Mechanics AND Kinetic sculptures

Simple movements can make objects seem very alive.

This is a project by a contractor working with the US military. A huge drunken animal-robot that sounds like a chainsaw.

How to move things with the Arduino?

The Arduino outputs themselves are limited to only 5 volts and about 40 mA of current. That is really only enough to turn on some LEDs or very small motors. Even the 5V power pin can only provide 500mA of current. In order to control devices that require bigger voltage or current we have a couple of options.

How to Choose the Right Motor or Actuator?

DC Motors

  • Usually just 2 wires
  • You can control the speed and direction. The direction depends on which terminal of the motor you connect to + and – of your power supply
  • Use a transistor or an H-Bridge circuit to control. The motor shield below has four H-Bridge circuits

Servo Motors

  • Servo motors usually have 3 wires (VCC,GND,DATA)
  • No need for special controlling circuits if you have an Arduino
  • Needs a PWM signal for controlling it
  • In Arduino you can use the Servo library
  • Small servo motors will be ok to power from the Arduino 5V (max 500 mA), but it is recommended to always use an external power supply

Stepper Motors

Bipolar stepper motors can also be controlled with the H-Bridge circuit. You will need both sides of the L293D chip to control.

  • You can use the motor shield for small motors that need less than 1.3A
  • A better way to control stepper motors is to use a controller chip that controls the current for the motor. These controllers from Pololu work well.

Solenoids

Air & Water Pumps

Muscle Wire (Flexinol, Nitinol)

How to Control Them?

We have two different controllers for the motors in the course equipment:

Adafruit Motor Shield

Features:

  • 2 connectors for servo motors
  • 4 connectors for DC motors (M1,M2,M3,M4)
    • Use either 4 DC motors or…
    • 2 stepper motors
  • 4.5VDC to 13.5VDC voltage for the motors
  • 1.3A current per bridge

Read the tutorial for instructions how to use it.

Transistors

Transistors can be used as electronic switches that we can turn on and off with the Arduino.

We will be using Darlington NPN transistors. A good basic one is TIP120 or TIP122. Or you might want to consider using a MOSFET if your device requires a lot of current, they don’t heat up as much as the Darlingtons.

With the TIP120 you could control any device that works with DC voltage up to 60V. We will stick with devices that are maximum 12V just to keep things little bit safer. Please consult Matti, if you are planning on working with transistors and higher voltage devices. Especially if you are not 100% sure in what you are doing.

This is how you connect the TIP120 transistor to your Arduino. You could replace the motor with any 12 V device. (a solenoid, small radio, LED strip etc.). The max current for the transistor is about 5 A, but I would recommend sticking with something smaller. Of course you also need to make sure your power supply can provide this much current.

In this example, you can use digitalWrite() or analogWrite() to control the motor. With the analogWrite() you can actually control the speed of the motor.

Screenshot 2013-10-17 10.42.16Screenshot 2013-10-17 10.42.05

H-Bridges

The transistor only allows you to control a DC motor in one direction. If you want to change the direction, you could use an H-Bridge circuit. The motor shield has H-Bridges built in, but you could also just use the chip itself. A popular choice is the L293D.

The enable pin that is connected to pin 7 on the Arduino controls the H-Bridge on/off. The pins 5 and 6 on the Arduino control the motor direction. This table will help you figure out how to control the motor.

PIN 7 (ENABLE) PIN 6 PIN 5 FUNCTION
HIGH HIGH LOW Motor turns left
HIGH LOW HIGH Motor turns right
HIGH HIGH HIGH Motor stops
HIGH LOW LOW Motor stops
LOW HIGH/LOW HIGH/LOW Motor stops

Screenshot 2013-10-16 21.53.28

Screenshot 2013-10-16 21.56.51

With the H-Bridge you can also control bipolar stepper motors.

Relays

Relays are electrically operated switches. A lot of them use electromagnets to activate a mechanical switch. When you turn the coil (electromagnet) on with a low-voltage signal, like from the output pin of an Arduino, the switch connects and the high-voltage signal has a path to travel.

relay

Relays are useful in cases where you want to make sure that the low-voltage signal (Arduino) and the high-voltage (your load – lights, AC motors, etc.) are completely electronically separated.

NOTE! 230V IS POTENTIALLY LETHAL! DO NOT USE MAINS VOLTAGE IN YOUR PROJECTS UNLESS YOU KNOW 100% WHAT YOU ARE DOING. RELAYS CAN BE USED TO SWITCH MUCH SMALLER VOLTAGES ALSO.