All Articles / Application Notes

Using Arduino Microcontrollers With Zaber Devices

By Albert David, Applications Engineering Team

Published on Jan. 10, 2019

Most users operate Zaber devices by connecting them to a computer and controlling them through software. While this gives the user a lot of options and flexibility in how the devices can be controlled, there are very low cost, simple alternatives that do not necessarily require complex software or a constant computer connection. One viable alternative may be to use a single-board microcontroller, like an Arduino. This article will outline using microcontrollers with Zaber's devices.

Zaber Arduino shield with linear stage

Consider an application that requires sensors or other devices that do not plug directly into a USB or serial port. In some cases, a costly DAQ (Data Acquisition) or I/O (Input / Output) module is a good solution, whereas, in other cases, the large number of channels and high resolutions, which are typical in dedicated DAQ modules, may exceed the requirements of such an application and add unnecessary cost. In the latter case, the user could consider using a microcontroller, which provides I/O ports for sensors or other devices in a much more compact and cost effective solution than a PC and DAQ combination.

A single-board microcontroller is a general purpose circuit board that contains all of the necessary electronics that can be programmed to perform a dedicated task. This includes a processor, on-board memory, and a variety of I/O and DAQ options. In many cases, single-board microcontrollers allow users to get started without having to develop hardware specific to the application. Because they are general purpose, single-board microcontrollers are often mass-produced and can be sold at a lower cost. Due to their versatility and low cost, single-board microcontrollers are favored by the hobbyist market but the components and functions can be suitable for professional use.

Arduino is one of the most popular platforms for single-board microcontrollers. While there are other platforms available, we'll focus on Arduino for the remainder of this article because of its ease of programming and ubiquity among introductory technical users. The general ideas outlined in this article apply to other platforms, and we're happy to try to support and assist any single-board microcontroller.

Both the hardware and the software of Arduino boards are considered open source. This allows third party developers to design specialty boards as well as hardware add-ons (called shields) to extend the utility of a board. Being open source encourages contributions from users to the available software, and it allows for community support. Zaber has contributed to this community by creating a library for Arduino software and a shield for Arduino Uno/Mega that both make it easy to interface with Zaber devices.

The Arduino Uno is a popular introductory board, which can be bought at the Arduino Store. It is widely available, powerful, and inexpensive. The Arduino Uno offers flexible digital and analog I/O ports, and it is able to receive and transmit information to other devices using serial communication. It has both volatile and non-volatile memory for storing programs as well as the capability of logging data, filling the role of a computer, software, and DAQ hardware when working with a Zaber device.

When space is critical, a computer isn't accessible, or you have to integrate multiple components, consider using a single-board microcontroller such as the Arduino Uno. We'll take a look at one application example below, and then we'll describe in more detail the necessary parts to connect an Arduino Uno to a Zaber device.

Application Example

A customer needed to automate a process in which parts were coated by being lowered into a series of chemical baths. The system required long, precise, linear motion in one axis to span several different chemical baths and shorter, simpler motion in the second axis to lower or raise the part. The user had to be able to select a routine from several stored sequences quickly and easily, with new routines being added infrequently.

A Zaber linear stage was proposed for the long, linear motion. The sample would be moved to several positions over the travel range, for which Zaber devices are well suited. The second axis needed to move between two positions with low precision, so a secondary Zaber stage was determined to exceed the system's requirements. A solution with a simpler, lower cost electric actuator that only moved between extended and retracted positions was a better fit.

An Arduino Uno was connected to the integrated controller/driver on the Zaber stage using an RS-232 shield (Zaber's version of the shield is described in detail below). This allowed the Arduino Uno to control the position of the stage and confirm when it reached a position. Digital I/O on the Arduino controlled and monitored the two-position actuator. This combination allowed the motion to be controlled and synchronized within several milliseconds, which was determined to be adequate for this application.

The Arduino Uno was also connected to a shield with a touchscreen display. Different routines were programmed onto the single board microcontroller using the Zaber Library for Arduino, and the touchscreen allowed an operator to choose between them. The screen indicated when a routine was occurring, and allowed the user to stop it if needed.

All of this functionality could have been accomplished using a computer instead of the Arduino Uno, but the total cost of the Arduino hardware with shields was under $100, much less than a computer. Additionally, computers are, by default, not equipped to directly control digital I/O which the two-position actuator required, so an additional hardware I/O module would have been required. Finally, the user interface for selecting the program on a computer would have been more complex than with the Arduino Uno.

Connecting an Arduino to Your Zaber Device

Zaber devices use RS-232 serial communication, while Arduino boards typically use TTL serial communication. TTL voltage levels are typically 0-5 V, while modern RS-232 levels are typically +/- 5-12 V. Zaber devices typically use an M8 type connector to communicate directly with a computer. Zaber's X-AS01 (X-Series Shield for Arduino) accessory also uses an M8 connector to communicate with Zaber devices. To connect the two, you will need an X-DC02 or X-DC06 cable that comes with your Zaber device.

X-Series Shield

Zaber's X-Series Shield will fit onto an Arduino Uno or Mega board, communicate with the Arduino over the I2C protocol, and convert the Arduino's messages to the RS-232 signals required for communication with Zaber devices. The advantage of this over a typical RS-232 shield is that the Arduino's serial port remains free for debugging. Additionally, the shield breaks out six I/O pins on the Arduino board to a push-in terminal block type connector and connects two more digital pins to push-button switches that can be useful for starting or pausing programs. The shield also lets you power your Arduino from a daisy-chained X-Series device.

To get started with the X-Series Shield or with some example programs, see the Zaber Library for Arduino. While the Library for Arduino is designed to be easy-to-use, Zaber's customer support team is available and happy to help if you have any questions, suggestions, or need any kind of assistance with your solution.

Zaber Arduino shield

Exceptions to Using an Arduino - PLCs

There are limitations to where single-board microcontrollers are useful. When an application requires connectivity with several devices, instruments, sensors, and controls, or if very high robustness is required, a PLC (Programmable Logic Controller) may be the best solution. Zaber devices can work with PLCs if they have suitable communication, but please contact Zaber customer support with information on your PLC to discuss in detail.

Please contact Zaber to speak with the applications engineering team if you are interested in a custom system.