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
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,
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.
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
- Popular Resources
- Popular amplifiers
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Arduino Nano collects temperature and humidity data through LabVIEW and DHT11
- Modern Testing Technology and System Integration (Liu Junhua)
- Computer Control System Analysis, Design and Implementation Technology (Edited by Li Dongsheng, Zhu Wenxing, Gao Rui)
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- I still don't understand the problem of using PNP npn as a switch. 8050 is used as a switch and it keeps turning on and off.
- Msp430 learning notes interrupt processing function
- "It's OK as long as it works, what else do you need?" ST Industry Summit 2019 answer sheet completed and sent a mouse disassembly diagram
- Smart electric car seesaw
- Ultrasonic drive circuit
- Help: How many lines are needed for SWD debugging of stm32f407?
- How to use STM32 to read Windows vector fonts
- Recruiting part-time DSP and other related professional lecturers or technical support personnel
- [CC1352P Review] TI-RTOS uartecho test
- [Erha Image Recognition Artificial Intelligence Vision Sensor] Use serial communication to conduct in-depth communication and data analysis with Erha Dog