Implementing a two-axis robot arm controller without an MCU - Embedded.com

2023-03-23 15:47:41 By : Ms. Joy XU

Robot arms are widely used in robotic applications. They can make movements similar to a human hand. A robot arm could be an independent application or a part of a bigger robotic system. Robot arms are mainly used in the industry for pick-and-place applications. They are also found in mobile security cameras and toys.

A robot arm usually consists of several links connected by joints that can rotate. In this project, we will build a robot arm including two joints of rotation, one for the x-axis and the other for the y-axis. These will be controlled by an analog signal from a joystick. The circuit will be designed with the GreenPAK SLG46620 chip, two Tower Pro SG90 servo motors, and an analog joystick (Figures 1 and 2).

click for full size image Figure 1. System block diagram. (Source: Renesas Electronics)

click for full size image Figure 2. Circuit Schematic. (Source: Renesas Electronics)

The project does not require a microcontroller, since the GreenPAK chip includes all the elements needed to build a static IC capable of controlling the servo motors independently.

The GreenPAK chip will carry out all of the system’s functions. It receives an analog signal from the x-output of the joystick, which is internally digitized and used as a PWM signal for the servo motor. The input channel is then changed to read from the joystick’s y-output, and the process is repeated. The analog signals will be read every 10 ms, alternating between x- and y-outputs. Therefore, each signal is read every 20 ms, so the output frequency is 50 Hz. This is suitable for the operation of the servo motor.

Two Tower Pro SG90 servo motors (Figure 3) will be used to build the robot arm. The motor needs a PWM signal to control its angle of rotation, which varies from 0° to 180°. When a 0.5 ms pulse width is introduced, the motor rotates to 0°. When the pulse width equals 2.5 ms, the motor rotates to 180°. The pulse width consequently must be between 0.5 – 2.5 ms every 20 ms to get an angle between 0° and 180°.

Figure 3. Tower Pro SG90 Servo Motor. (Source: Renesas Electronics)

Analog joysticks are widely used in robot applications due to their low price and easy connection. The joystick consists of two potentiometers positioned crisscross (Figure 4). It provides three outputs: x, y, and a push-button in the middle. The joystick in our application will offer manual control of the servos.

To get a range suiting the GreenPAK’s ADC specifications, the joystick will use the chip’s VREF rather than connecting an external voltage divider. This will reduce the number of external parts.

Figure 4. Analog Joystick Module. (Source: Renesas Electronics)

The GreenPAK design was created in the free GUI-based GreenPAK Designer software, a part of Go Configure™ Software Hub, (link to the design file). This design comprises of several parts (Figure 5).

click for full size image Figure 5. GreenPAK Design – Matrix 0. (Source: Renesas Electronics)

An analog MUX receives the signal from two different outputs according to a defined time interval. A pulse generator of 100 Hz gives a pulse every 10 ms. The x-signal is received in the first 10 ms and the y-signal in the next 10 ms.

Pin8 and Pin9 are configured as analog inputs connected to a PGA configured as an analog multiplexer. The signal from Pin16 switches between its two channels. When the signal CH Selector is set HIGH, the reading comes from Pin8, and when it is set to LOW, the reading comes from Pin9. After the analog signal is transformed to a digital one, it is read from FSM0. FSM0 gets its input from the output of the ADC block (ADC data). FSM0 is configured as Falling Edge DLY.

delay time = (counter value+1)/clock.

FSM0’s CLK Pin is connected to the CNT5 output via EXT CLK0 to get 128 kHz so that the pulse width of the output is 2 ms when the value of 255 is received from the ADC. The output period of CNT5, therefore, is 7.8125 µs and CNT5 data is 210.

The 2-L0 inverter and CNT6 define the 100 Hz generator, which gives a pulse every 10 ms in order to output the PWM signal to both servo motors every 20 ms. The generator’s output triggers CNT9, which is configured to work as Falling Edge DLY with a delay time of 0.5 ms. The CNT9 output triggers FSM0 to output a signal whose width is FSM data + 0.5, which will be between 0.5 and 2.5 ms. This is passed through LUTs to the suitable servo.

CNT0 is used to give a 2.5 ms pulse width every work cycle as the maximum allowed time frame to output the signal to the servo motors (each one in turn) to prevent any errors.

DFF0, 2-L1, 3-L2 are used to control the input channel, where switching is periodically done between channels 1 and 2 of the PGA every 10 ms. Pin6 is externally connected to Pin16, which is linked to PGA’s CH Selector pin.

The 4-bit LUT0, 3-bit LUT0, 3-bit LUT1, and 2-L2 form the demultiplexer to pass the PWM signal to the requested servo motor (Figure 6).

click for full size image Figure 6. LUT Configuration. (Source: Renesas Electronics)

When the CH Selector signal is HIGH, the reading comes from channel 1 through Pin8 and the modified PWM signal passes to the x – servo motor through Pin4. When the CH Selector is set to LOW, the reading comes from channel 2 and the signal is passed to Pin5 and then to the y – servo motor.

The channel is changed with the falling edge of the CNT0 output after 2.5 ms has elapsed from the start of the cycle to output the pulse with the start of the next cycle (see Figure 7). This provides sufficient time for signal reading and stability.

click for full size image Figure 7. Timing Diagram. (Source: Renesas Electronics)

To prevent any error in the ADC when the signal is small (less than 40 mV), DCMP0 is used to compare the ADC value with register 0. If the value is smaller than 9, the angle will be regarded as 0° and the output of CNT9 will be directly passed to the requested servo motor.

The joystick is sourced from VREF0 inside the GreenPAK chip so that the signal read by the joystick is within the ADC’s operation range. VREF0 is connected to Pin19 where the source selector is set to be ACMP0, which was adjusted to be 1200 mV. The joystick contains a push-button that can be leveraged for additional functionality. A debouncer was constructed using CNT8 and the improved signal is output through Pin20. Pin12 is configured as a low voltage digital input because the joystick voltage is 1200 mV (Figure 8).

click for full size image Figure 8. GreenPAK Design – Matrix 1. (Source: Renesas Electronics)

To test the design, GreenPAK Designer’s Signal Wizard was used to apply different signals to the inputs (Figure 9) and monitor the outputs (Figure 10).

click for full size image Figure 9. Generating Sawtooth Wave. (Source: Renesas Electronics)

click for full size image Figure 10. Pin8 (Yellow), Pin9 (Blue), Pin5 (Red), and Pin6 (Green). (Source: Renesas Electronics)

The following video shows the working project and is also available here.

In this article, we used a GreenPAK SLG46620 chip to build a circuit controlling a robot arm of two joints, x and y, using two servo motors operated with an analog joystick. The chip was highly efficient for incorporating all of the circuit’s important elements within a small space. There was no need for an external microcontroller and few external elements were required.

This design may be expanded to build a robot arm of larger degrees of freedom by connecting more than one chip. Such a system could be applied to many different industrial applications.

For more Embedded, subscribe to Embedded’s weekly email newsletter.

You must Sign in or Register to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.