LabVIEW, 32-channel servo control board and multi-degree-of-freedom robotic arm

Publisher:PeacefulSoulLatest update time:2017-05-25 Source: eefocusKeywords:LabVIEW Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

   From the title, this article involves LabVIEW programming, the use of 32-channel servo control board and the action demonstration of multi-DOF robotic arm, and should also include Bluetooth communication. The latter three parts have been described in the previous article, titled "32-channel servo control board and multi-DOF robotic arm", URL: http://www.eefocus.com/zhang700309/blog/12-09/286479_a1c80.html. This article mainly talks about how to program LabVIEW to communicate with the serial port of the servo control board, and then control the servos on the robotic arm.

    The 32-channel servo control board is produced by the domestic company DFRobot. The previous article described how to use the servo control software that comes with the control board to set the servo action. This article hopes to use the LabVIEW program to replace part of the functions of the manufacturer's servo control software to make a human-machine interface tailored for this experimental project.

Experimental video:

 

 Click on the URL to watch the video in full screen.

http://www.tudou.com/v/anpCVbq0ZDI/&rpid=96368873&resourceId=96368873_04_05_99/v.swf.  

   The six servos of the multi-DOF robotic arm control the gripping and releasing of the claws, wrist rotation, wrist up and down, elbow up and down, arm up and down, and arm rotation. The servos in these parts are connected to the channels of the servo control board through control lines in the order from the claws to the tower. The channels are numbered 3, 4, 5, 13, 14, and 15, as shown in the figure below.

6-DOF robotic arm: (Double-click on all images to enlarge them!)

 32-channel servo control board:

 

   The six servos on the multi-DOF robotic arm all support 180-degree rotation. The rotation angle of the servos is achieved by adjusting the duty cycle of the PWM (pulse width modulation) signal. The period of the standard PWM signal is fixed at 20ms (50Hz), and the pulse width is between 500us and 2500us. The pulse width corresponds to the rotation angle of the servo of 0°~180°.

       Starting from the human-computer dialogue front panel, we begin to explain LabVIEW programming. Look at the LabVIEW front panel in the figure below. There are six sliding bar controls. Use the mouse to move the cursor on the sliding bar with a travel range from 500 to 2500 to control the rotation angle of the six servos on the robotic arm respectively.

     The current values ​​of the six sliding rods will be immediately fed back to the background program, that is, the LabVIEW block diagram program, which will combine these data into a line of string commands and send them to the 32-way servo control board through the serial port to control the servos on the robot arm. So there are two key points in LabVIEW programming this time: 1. How to write a LabVIEW serial communication program so that the servo control board can receive the string commands issued by the host computer; 2. How to combine the six servo PWM pulse width data of integer data type into a string, and this string must meet the format requirements of the control board for string commands.

Block diagram program: (For all pictures, double-click to enlarge!)

   The graphical programming design in the figure above uses the NI_VISA serial port Serial function to access and control the serial port. The Serial function library in VISA contains sub-functions such as VISA configure serial port, VISA write, VISA read, and VISA close. The extraction path of these sub-functions is: function library → instrument I/O → serial port. The three VISA serial port sub-functions used in this design are: VISA Configure Serial Port, VISA Write, and VISA Close. Their icons are shown in the figure below:

    The function of VISA serial port configuration function is to complete the initialization setting of serial port parameters, including serial port resource name, baud rate, parity check, data bit, whether to enable terminator, etc. In the figure above, the function is connected to two input variables, the variable names are "Please select serial port name" and "Baud rate", which are connected to the serial port resource name and baud rate parameter terminals respectively. The variable values ​​are set by the corresponding controls on the front panel, and the other input parameters use the default values. In the figure, the VISA serial port configuration function has two output terminals. The output terminal above the icon outputs the serial port resource name, and the output terminal below outputs the error code. The output terminal transmits information to the downstream function.
       The VISA write function has three input terminals. The upper input terminal is the serial port resource name passed by the previous VISA serial port configuration function, and the lower input terminal is the error code passed. This means that if the previous function fails, an error code will be entered here and then continued to be passed down. The program will not work when an error code appears. The middle input terminal is the write buffer entry, and the data format supported by the write buffer is string.

     The function of VISA Close is to close the serial port device before the program stops. If it is not closed, other programs cannot use the device.

    After understanding the serial communication functions of LabVIEW, the next question is how to combine six integer data into a string, and this string must meet the format requirements, and then send it to the write buffer of the VISA write function.

   DF-USBSSC32 control board manual URL: http://wiki.dfrobot.com.cn/index.php?title=USB%E7%89%8832%E8%B7%AF%E8%88%B5%E6%9C%BA%E6%8E%A7%E5%88%B6%E6%9D%BF(SKU:DRI0005)

, take a look at the instructions inside to see how the format of the multi-servo string command is explained.

Instruction Abstract:

  Servo group movement example: #5 P1600 #10 P750 T2500

 

Channel 5 moves to the 1600us position, channel 10 moves to the 750us position, and both are completed within 2500us. This command can coordinate the speeds of multiple servos.

   There are six servos on the robot arm. Their control lines are connected to the control channels 3, 4, 5, 13, 14, and 15 of the servo control board. Regardless of the moving speed, if all servos are turned to 90 degrees, how should this string command be written? The answer is:

#3 P1500 #4 P1500 #5 P1500 #13 P1500 #14 P1500 #15 P1500, the integer data after the letter P is the servo PWM pulse width value of the 6 servo channels. I used the "format write string" command, which has a "format character" input terminal. I wrote the format string accordingly: #3 P%d #4 P%d #5 P%d #13 P%d #14 P%d #15 P%d, %d means signed integer data, the data input into the six input terminals on the left side of this function are the real-time servo pulse width values ​​corresponding to the six %d in the format string, and the servo pulse width values ​​are set by the cursors on the six sliding bars on the front panel.

    Since the servos are installed in different positions, the formula "3000-current value of the slider" in the program means to adjust the moving direction of the slider cursor to the same direction as the rotation direction of the servo. For example, if you want the slider cursor to move left and the servo to rotate clockwise, but find that the actual situation is that the servo rotates counterclockwise, you need to use this formula.

     Let’s take a look at the parts of the LabVIEW block diagram program that are related to generating string commands. I have taken separate screenshots of them.

 

   According to the DF-USBSSC32 control board manual, should be added after this string command. is a carriage return character. I use the "connect string" function to add the carriage return character. As shown in the figure above.

    In the block diagram program, the program below the VISA configuration serial port function is: 1. The serial port baud rate is set to 115200b/s; 2. The initial value of the sliding rod that controls the rotation angle of each servo is set to 1500us, that is, the servo angle is set to 90 degrees, so that when the program starts running, the robotic arm reaches the initial working position. When I installed the servos on the robotic arm, I adjusted the rotation angles of all the servos to 90 degrees before installing them.

 

   Through the above programming, the string commands that meet the format requirements are generated step by step. This string is sent to the VISA write function "One Send", and it is OK. It is written to the lower computer DF-USBSSC32 control board through the serial port. The control board does not need to write a line of program. It will automatically understand the commands issued, respond to the movement of the cursor of the sliding rod control on the front panel, and drive each servo to rotate the angle, so that the robotic arm can complete the various actions that the mouse operator wants to achieve.


Keywords:LabVIEW Reference address:LabVIEW, 32-channel servo control board and multi-degree-of-freedom robotic arm

Previous article:How do I create a DLL in a LabVIEW project?
Next article:LabVIEW Bluetooth Control of Lego Hexapod Robot

Recommended ReadingLatest update time:2024-11-16 22:30

Research on Driver of Common Data Acquisition Card Based on LabVIEW
Introduction Virtual instrument technology is a new technology developed in the 1990s. It integrates computer and bus technology, microelectronics technology, and measurement technology. It is a major breakthrough in traditional instruments and a product of the combination of computer technology and instrument t
[Test Measurement]
Research on Driver of Common Data Acquisition Card Based on LabVIEW
LabVIEW Nugget: Several ways to get the current time in milliseconds
  When using system time, millisecond accuracy is required only in certain cases. Since there are few applicable occasions, it is difficult to solve.    There are two ways to represent time in Labview :   1. Time cluster-----This is the earliest method used by LABVIEW to represent time.   2. Time stamp--This is
[Test Measurement]
LabVIEW Nugget: Several ways to get the current time in milliseconds
Energy Storage Potentiostat Based on LabVIEW Software and PXI Instruments
  Challenge: Develop a potentiostat/galvanostat/impedance analyzer system (potentiostat system) with easy-to-use software, user-friendly interface, high accuracy and resolution, multi-frequency mode, low current option, and email/text notification capabilities   Solution: Use a potentiostat based on LabVIEW software
[Test Measurement]
LabVIEW Learning Notes - The Third Program: Subroutine Calls
The first step      is to edit the subVI: the subVI is a formula; X1+sqrt(X1)+ln(X1)   Below is the input and output settings of the subVI   Because it takes time to review videos uploaded to Sina Blog, here is the Baidu Cloud link of this video: http://pan.baidu.com/s/1eQuFw4a The last step   is to
[Test Measurement]
Learning LabVIEW (IV) - MATLAB script node
       It is well known that LabVIEW can realize mixed programming of G language and MATLAB language through MATLAB script nodes in the program. Everyone likes it because it is not very convenient to drag and drop the operation nodes provided by LabVIEW in the block diagram for some complex formulas.        After the
[Test Measurement]
Research on Satellite Interference Monitoring Technology Based on LabVIEW
0Introduction Satellite applications have provided all-weather, all-day, high-precision positioning and monitoring services for various military and civilian carriers on land, sea and air in my country, and have become increasingly important in national defense construction and the national economy.
[Industrial Control]
Research on Satellite Interference Monitoring Technology Based on LabVIEW
[LabVIEW] About getting the number of rows in a Multicolumns List
Encountered such a problem: In LabVIEW, you need to use a for loop to read the data in the list, but the number of rows of data needs to match the number of for loops, so you need to get the number of rows of data displayed in the list. Here is the method. IndexArray is used to read the value of the Index colu
[Test Measurement]
A brief analysis of the design of temperature and humidity monitoring system based on virtual instrument
1 Introduction Virtual instrument, abbreviated as VI, is a PC instrument with a virtual panel, which consists of hardware devices and interfaces, PC, device driver software and virtual instrument panel. Among them, hardware devices and interfaces can be various built-in function cards based on PC, such as DAQ,
[Test Measurement]
Latest Test Measurement 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号