Hi and welcome to another TekTips video.
Today we're showing you how to
wire an Arduino to a ClearPath servo motor.
Using one of ClearPath's many operating modes
along with an Arduino
there's virtually no limit to the types
of applications you can create and
accomplish.
As just one example:
Here I've configured ClearPath to use the
operating mode called, "Move to Absolute Position"
along with a simple Arduino
sketch I wrote to index this load to multiple locations.
Here's another example:
by switching ClearPath's operating mode
to ramp up down to selected velocity and
using essentially the same Arduino
sketch,
we can smoothly ramp between multiple velocities.
It's actually quite
straightforward, let's get started.
Currently, ClearPath supports 11 unique
operating modes
using just four general purpose I/O lines.
General purpose I/O is found on most everything.
PLCs such as this one from Velocio,
single board computers like the Raspberry Pi
and the BeagleBone Black
and almost all microcontrollers like the popular Arduino.
Since the Arduino
supports a wide range of general purpose I/O,
it's a great microcontroller to
quickly develop applications with ClearPath servos.
Today we'll be accessing the
digital I/O header on this Arduino Uno.
We'll save analog inputs and PWM outputs
for a future video.
Here I'm using a NEMA 23 ClearPath motor configured
to use "Ramp Up/Down Velocity" mode.
On my Arduino I've mounted a shield which is just a
breakout board that converts the native
digital I/O header into a screw terminal
block making it easier to wire.
I started with Teknic's standard 10 foot controller
cable.
First I cut it down to about 2 feet in length to make it easier to handle,
and then I stripped back the wire end so it could be screwed into the shield's terminal block.
Then I added a pull-up resistor and an external LED to
watch for an output state.
Here's the color codes for the internal conductors
of this controller cable.
There are eight conductors for the four ClearPath IO points.
Enable, Input A, and Input B are the three ClearPath inputs,
and are all optically isolated for noise immunity.
The input circuit is easy, it
consists of two pins, high and low,
for the internal light emitting diode.
With a proper amount of current about 10 milliamps
an internal LED turns on and
transmits light to a photoreceptor that
is wired to ClearPath's internal
processor.
Each input has over current protection
and you have the flexibility
to apply a wide voltage range from 4-28 volts DC.
Just make sure you don't wire inductive loads like a coil or a relay in conjunction with these inputs
because the induced voltage spikes caused by interrupting these
inductive loads can greatly exceed the voltage rating of these inputs.
As a result, there are several ways to wire to the ClearPath inputs.
For example, you can directly
drive these inputs either sinking or sourcing.
You can also use open collector
or you can check the manual for further examples.
Today I'm going to take
advantage of the Arduino's outputs.
These are driven outputs that can sink or
source up to 40 milliamps so they are
ideal for these type of ClearPath
inputs. I've identically wired my three
ClearPath inputs: Enable, Input A, and Input B to the Arduino pins 6, 8 and 9 respectively.
These pins are configured
as digital outputs in the Arduino so
they are just a straightforward as +5 volts
DC driven signal.
There's also a configurable status output from ClearPath called HLFB or "high level feedback."
The internal circuit for HLFB is an
uncommitted NPN transistor which can
either pull high or low and turns on or
off depending on the logic state of HLFB.
Internally like ClearPath's other three I/O
points, HLFB is also optically isolated
for noise immunity. The transistor is
rated for 9 milliamps with a max voltage
rating across the HLFB pins of 30 volts
DC.
This circuit also has over current protection built in
and like the inputs, we don't recommend using inductive loads in conjunction with this HLFB output.
So a recommended way of wiring to HLFB is
to use a voltage source 5-24 volts
nominally with a pull-up resistor so
you can read the voltage drop across
that resistor. With our Arduino wiring to
HLFB I started with one of the Arduino's
plus 5 volt DC pins and wired this in
series with an LED and an 866 ohm
pull-up resistor.
Alternatively, you could simply configure the Arduino input to
use its own internal pull-up resistor.
This is rated at 22-50 kilohms.
In the end, here's the wiring table showing all the
pertinent pin numbers and grounds.
What about some of the relevant Arduino commands to
make our ClearPath mode or
execute these velocity moves?
Let's look briefly at the Arduino
variable declarations section in the code.
Here we define the pin numbers we
just wired as well as Pin 13 which is
Arduino's on-board-LED. The variable
names Enable, Input A and Input B are all
configured as Arduino outputs going to
their respective ClearPath inputs.
HLFB on the other hand is configured as a
standard input. You can also configure it
to use Arduino's internal pull up.
Let's now use the MSP software to highlight
and show the setup portion of this code running.
Here's the O-scope and strip chart within MSP.
I've set the
time base to 500 milliseconds per division.
I've also captured a single trigger on the scope
showing the execution of the setup portion of our code.
After enabling the motor we read the HLFB input
and when true, turn on the LED and then wait for one second.
Finally we disable the motor, read the
HLFB input again and if false turn off
the LED and wait for 1.5 seconds.
For HLFB remember that the electrical logic is
reversed due to the pull-up. When HLFB
is true the internal opto-coupler
transmits light turning on the NPN
transistor.
This causes current to flow and the Uno sees the
voltage drop across the pull-up resistor.
The opposite naturally
happens when HLFB is false.
After running through the setup portion
of the code the software drops down into
the main loop. Here the motor is enabled
followed by a 500 millisecond dwell
before executing a new velocity move.
The strip chart on the bottom shows the
on/off states of the inputs and outputs
as the code runs.
Finally let's look at the inputs and commands section of MSP itself.
Here we can see the various input bits turning on and off
as well as the status of HLFB as the code executes.
So that's about it, in summary it's very
easy to wire and configure an Arduino
with ClearPath to develop applications
like these.
I hope this TekTips video on wiring an
Arduino to ClearPath has been helpful,
if so please click the thumbs up like
button.
Click the Teknic logo to subscribe and you'll be notified
whenever we release a new video.
And please feel free to comment and ask
questions, we love getting feedback.
It's often very helpful for everyone.
Thanks for watching!
