Pendulum servo one.

1.  The task defined

1.1 Overview.

In previous courses and modules, you have been introduced to using the Arduino for controlling servo loops.  You have also met some fundamentals of machine vision.  This is the first in a sequence of three modules that will build up to the aim of controlling systems with video feedback.

This first module will build the ability to share a control task between a PC and an Arduino, reading an incremental encoder with high speed software that includes Atmel assembly code.

Video input will be introduced in the second and third modules, so that you can demonstrate the ability to control a system in which two motors control the 2D position of an object, while a camera provides the feedback signal to command its movement.

1.2  Apparatus

An aim is to minimise your spending on components, to be able to work on the experimental exercises at home.  You should already have completed MTR2302, where the module “Applied State Space Control” required you to buy the components for a balancing trolley.  This means that you already possess an Arduino and a dual-motor driver board, plus two geared motors that have no sensors.

If you wish to economise, you can cannibalise that trolley.

But since an important part of the first module is to interpret the signals from high-speed incremental encoders, it will be necessary to purchase at least one motor that has such encoders.

A low-cost option is a Pololu motor, intended for a trolley kit.  See details at https://www.pololu.com/product/3675.  It is available from

Gearmotor and Encoder Assembly for Romi/TI-RSLK MAX | Buy in Australia | POLOLU-3675 | Pololu | Core Electronics

Since we will be later concerned with positioning, the rotation must be turned into linear motion.  For simplicity, no more construction is needed than to attach a bobbin to the shaft, a cotton reel will do, and to suspend a brightly coloured ‘target’ to be viewed later by a camera.  

This can be a ball, or small square of plastic.  In the second module, machine vision will track its coordinates in the field of view, while the motor winds the string to control the vertical position.

1.3  The first experiment

This first module will concentrate on the ability to share the control of motors between a PC and an Arduino.  Connections to brushed DC motors using an Arduino motor shield will the first step.  Updates to security matters have added complication to the use of the USB port for communication, so this step will be to send simple drive commands to a single motor.

Although the reaction to a change of drive will be a change of motor velocity, this will follow a lag.  The motor has incremental encoders which measure movement to a fine precision, so closed-loop feedback can now be applied that includes measured velocity.  This should obtain a much swifter and better defined response.

The next stage will therefore look at the software to monitor the encoder signals and communicate with the PC, to perform and report position control.  Experiments will be needed to optimise the loop gains.

This will give you a sound basis for adding servo actuators to a wide range of tasks.