How to create an FPGA controlled robotic arm?

Publisher:meilidaowlLatest update time:2023-10-24 Source: OpenFPGAAuthor: Lemontree Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Technology is at the forefront of the 4.0, IoT, and edge revolutions. Let's see how to create a controlled robotic arm.

introduce

Robotics, along with artificial intelligence and artificial intelligence, are at the forefront of Industry 4.0 and the edge revolution.

So I thought it would be fun to create a basic robot arm project that we can work our way back to and add a few features to, such as:

  • Inverse Kinematics - Determine the position of the end effector.
  • /ML – Object classification during operation.
  • Control - Enable remote control at the edge.

This example will use a robotic arm that controls six servos on a Zynq SoC. You can use a simple software interface or use two for direct control.

Servo control

The first thing we need to do is figure out how to control the servo position. Servos are one of the simplest motors to drive and are ideal for robotics because they maintain relative position as long as we keep the drive the same.

So what is the driving signal for the servo? Most of the servos we use use a 60Hz PWM waveform. In the 16.66 ms period of the 60Hz waveform, the signal will be high between 0.5 ms and 2.5 ms. The duration of the signal will drive the servo between 0 and 180 degrees.

A 0.5 ms pulse drives the 0 degree position, while a 2.5 ms pulse will drive the 180 degree position. Therefore, 90 degrees can be maintained by driving the signal as a 1.5 ms pulse.

Therefore, increasing or decreasing the pulse width by 13.9 us will move the servo by 1 degree.

The next thing to solve is how to generate the drive signal. The PWM expansion board (above) uses four 8-bits to drive each PWM signal.

The on register defines the count of times the signal goes high, and the off register defines the count of times the signal goes low.

Therefore, we can set the on time to 0 and then define the count of the off signal to get the desired signal width.

Vivo Build

  • Zynq PS - This is the Zynq Processing System
  • AXI I - implemented in PL

Once the PL design is completed, we can build the design and export it to the software.

Software Design

We will be developing most of our application in software. Since we want to use it in multiple modes and make future upgrades to it, we need a modular approach.

Therefore, a function was developed for each joint that could be called and used as needed. Each joint is able to receive an unsigned 8-bit value and then add or subtract that 8-bit value from a 90 degree (1.5 ms) pulse width to obtain the desired angle.

I do this for several reasons:

  • A single byte can contain the desired position.
  • The value read from the joystick is also 8 bits.

Therefore, we need to ensure that the movement between the joystick and the arm is aligned.

Of the two joysticks, the first one is connected to JA and the second one is connected to JB (JA and JB are PMOD interfaces, which are ordinary GPIO).

JA When moved in the X direction, it moves the arm forward or backward; when moved in the Y direction, it moves the arm up or down.

JB rotates the wrist when it moves in the X direction, and moves the wrist up and down when it moves in the Y direction.

The code for each move function is very similar and can be found in the code provided later, however, the up and down functions are provided below for reference.

void up_dwn(u8 YData){  
 SendBuffer[0] = 0x0A;  
 SendBuffer[1] = 0x00;  
 XIic_Send(iic.BaseAddress,IIC_SLAVE_ADDR,(u8 *)&SendBuffer, sizeof(SendBuffer),XIIC_STOP);  
 SendBuffer[0] = 0x0B;  
 SendBuffer[1] = 0x00;  
 XIic_Send(iic.BaseAddress,IIC_SLAVE_ADDR,(u8 *)&SendBuffer, sizeof(SendBuffer),XIIC_STOP);  
 SendBuffer[0] = 0x0C;  
 u16 signal;  
 if( YData < 128 ){  
  signal = 122 + (YData * 1.91);  
 }  
 else if (YData == 128){  
  signal = 369;  
 }  
 else{  
  signal = 369 + ((YData - 128) * 1.91);  
 }  
 u8 cent_l_off, cent_h_off;  
 cent_l_off = (u8)signal;  
 cent_h_off = (u8) (signal >>8);  
 SendBuffer[1] = cent_l_off;  
 XIic_Send(iic.BaseAddress,IIC_SLAVE_ADDR,(u8 *)&SendBuffer, sizeof(SendBuffer),XIIC_STOP);  
 SendBuffer[0] = 0x0D;  
 SendBuffer[1] = cent_h_off;  
 XIic_Send(iic.BaseAddress,IIC_SLAVE_ADDR,(u8 *)&SendBuffer, sizeof(SendBuffer),XIIC_STOP);  
 }

The rest of the software application structure is:

  • Initialize the PWM expansion board and Pmod joystick.
  • Perform a self-test on the arm and position all servos at 90 degrees.
  • Receives commands via 232 or from a joystick.

Of course, if we want to hard code in commands to perform repetitive tasks, we can.

Preliminary testing

Once Vivado is built and the initial software is available, the next step is to ensure the software can move the servos correctly.

When the joystick is moved, the PWM signal can be measured.

As the joystick is moved, the pulse width gradually changes from 0.5 ms to 2.5 ms.

Reference address:How to create an FPGA controlled robotic arm?

Previous article:Components of an industrial robot
Next article:iTR Robot iScrubbot series cleaning robots realize digital management

Latest robot Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号