Microcontroller Implementation of a Small Robot Arm Controller

Our senior project aims to design and develop assembly language for a small robot arm assembly controller, utilizing an enhanced 8051 microcontroller (80535). In addition to the controller’s software, we will design and construct the microcontroller interface circuitry. Our investigation will focus on incorporating safety features, such as motor current limit protection and motor disable hardware/software, to prevent excessive position displacements.

To provide a user-friendly interface for controller input and status information, we will utilize an add-on keypad and LCD (Liquid Crystal Display). Figure 1 illustrates a block diagram showcasing the external input and output signals of the system. The external input signals include the position sensor signal, the signal from the joystick, the motor current limit protection signal, and the keypad. On the other hand, the external output signals encompass the actuation signal to drive the system, the kill relay, and the LCD.

FIGURE 1: External Input and Output Signals

Figure 2 presents a more detailed block diagram of the system, encompassing several components and their interactions. The core components include the microcontroller board, DC motor assembly, external gears, a position sensor (potentiometer), and an antialiasing filter.

The microcontroller board, developed by EMAC Inc. in Carbondale, IL, comprises a keypad, an LCD display, A/D and D/A converters, and the 80535 microcontroller. It offers 24 bits of digital I/O, 4 counters/timers, and 10 external interrupts.

The D/A converter output drives an external power amplifier, which operates in a voltage-follower configuration. This amplifier can deliver a maximum of 3 Amps to the DC motor. The DC motor, in turn, transforms the control voltage into mechanical position and velocity, facilitating movement in the robot arm.

To reduce the motor rotor velocity and increase torque, external gears with a 70.5 reduction are employed. This setup allows the motor to encounter a smaller load, providing torque advantages.

A potentiometer serves as the position sensor, with its pot arm connected to the robot arm via a 1:1 gear. The potentiometer is supplied with +/- 5 volts, where the arm’s zero-degree position corresponds to zero volts. An antialiasing filter, represented by a capacitor, is employed to filter the feedback voltage from the potentiometer, removing power supply noise. The combination of the potentiometer resistance and the capacitor forms a low-pass filter.

The power amplifier, DC motor, gear train, potentiometer, and antialiasing filter are part of a system manufactured by Quanser Consulting. The company also provides test software and simple controller software for their system, enabling seamless integration and operation.

Complete System Level Block Diagram

We also need to assess and examine some internal signals that play a crucial role in the evaluation and testing process. The D/A converter output channels will provide access to the following signals, as depicted in the control block diagram shown in Figure 3:

1. Command signal: Represents the desired position of the robot arm, acting as a reference for the control system.

2. Feed-forward signal: Signifies the output signal generated by the feed-forward compensator, contributing to the overall control strategy.

3. PID-type controller signal: Reflects the output signal produced by the PID (proportional+integral+derivative)-type controller, a key component of the control system.

4. Filtered position signal: Corresponds to the actual position sensor signal after undergoing filtering for noise reduction and accuracy improvement.

5. Actuating signal: This signal is responsible for driving the robot arm system and is directly connected to the power amplifier, enabling effective actuation and control of the system.

FIGURE 3: Control Block Diagram

The software flowchart, as depicted in Figure 4, encompasses both an interrupt service routine and the main program. The software includes mechanisms to deactivate the motor in case of excessive position displacement or when the current surpasses its designated limit. Additionally, it checks for the presence of the joystick. Timer 2 of the 80535 microcontroller will be utilized to generate interrupts for performing PID controller calculations. Initially, the timer will be configured for a 5-millisecond interrupt, resulting in a 200 Hz sampling rate. This rapid sampling interval will make the overall system behave as if it were a continuous-time system rather than a discrete-time system. In the future, the interrupt time will be further reduced, but this aspect will not be addressed until the second semester of senior year during the course “EE432 Control Theory II”. Based on previous research, Dr. Dempsey recommended the 200 Hz sampling rate.

FIGURE 4: Software Flowchart

For our project, rather than conducting a patent search, we decided to explore various microcontroller boards suitable for the control system. The minimum requirements for the microcontroller board included an INTEL microcontroller, 4 channels of analog-to-digital converters, 4 channels of digital-to-analog converters, external RAM for user programs, the ability to download programs from a personal computer (PC), a keypad, and an LCD for displaying status information. After careful evaluation, the EMAC board was deemed suitable for our senior project, and it was selected by our advisor, Dr. Dempsey. Other manufacturers, such as Advanced Education Systems (AES) and Rigel Corporation, were also considered during the evaluation process. Extensive web research, which took over twenty hours, was conducted to find the appropriate vendor, and the EMAC board stood out due to its hardware features, such as an external keypad and a 2-line LCD. While the debugging software system provided with the EMAC board was found to be lacking, the same was true for the other vendors’ offerings. To address this, part of our senior project time will be devoted to exploring a professional debugging package that can work seamlessly with the EMAC board.

Regarding standards, since the EMAC board will be used in a standalone manner, there are no specific standards that directly apply to the project. However, during the development phase, the EMAC board will connect to an IBM compatible computer. The relevant standards for the computer are listed in Table 1:

1. IBM 486 compatible computer or higher with a math co-processor.
2. DOS version 6.2.
3. Windows 3.11 or WIN95.
4. At least 1 COM port compliant with RS232 standards.


The input signal to the control system is depicted in Figure 5. The set points, represented by +CMD and -CMD, indicate the desired final positions. The slope of the waveform represents the velocity. In this case, a velocity command of 100 degrees per second (?/sec) is illustrated in the figure.

FIGURE 5: Input Signal to Control System

The numerical specifications for the input signal shown above are listed in Table 2.

Numerical Specifications for Step Input
1.  | CMD | <= 90 degree
2.  Velocity(max) = 45%/sec.

The control system’s outputs consist of the robot arm’s position and velocity. To measure the numerical specifications listed in Table 3, we will use a Tektronix TDS 340A Oscilloscope. However, due to the low frequencies involved (under 1 Hz), measuring these specifications can be time-consuming, taking hours.

To reduce measurement time, we will focus on the less time-consuming measurements such as % O.S. (percent overshoot), Ts (settling time), and tp (peak time). The remaining measurements will require finding the Bode plot of the system, which can also be a time-consuming process taking hours.

Measured Outputs of Control System

Approximate value of Position

% O.S. – Percent overshoot = 5(%).
tp – Time to first peak = 6(s).
Ts – Settling time =9(s).
Mp – Resonant peak = 1.1.
Wp – Resonant frequency =0.16(rad/sec).
BWc.l. – Closed loop bandwidth = 0.5(rad/sec).
PM – Phase margin =69.
GM – Gain margin =4.
ess < 2 degree.


Tracking error < 2 degree.

The user interface for this project comprises the keypad and the LCD. Since the LCD has only two lines available for displaying information, two modes will be used. The first mode will be for user input, which will be entered through the keypad. Table 4 provides a list of possible inputs from the user. To enter these parameters, a help menu will guide the user. For instance, pressing the keypad’s “1” button will turn the motor on, while pressing “0” will turn the motor off.

User Inputs

1.  Motor ON/OFF.
2.  kp gain.
3.  Command set point.
4.  Ramp velocity.
5.  Command frequency.

The LCD’s second mode will display the signals illustrated in Figure 3. The user can choose which signal to display in real-time from a help menu, providing a valuable tool for system evaluation and analysis.

 Senior Project Demonstration

For the demonstration, we will measure and compare the percent overshoot, time to the first peak, and settling time with the simulation results obtained from MATLAB. This approach will efficiently validate the functionality of our controller. Additionally, we will employ prediction equations to calculate parameter values in the frequency domain, allowing further comparison with simulation results. The necessary equipment for conducting this demonstration is outlined in Table 5.

Equipment List

1.  Tektronix TDS 340A Oscilloscope
2.  Hewlett Packard 33120A Waveform Generator

About The Author