Measures in materials with US-Wave in matlab
You need the US-Wave code which is NOT provided in this file.
This MATLAB script is designed to control an ultrasonic wave motor using an Arduino Uno. The system operates in pulse mode and allows the user to perform various operations, including moving the motor to a specific position, finding the incidence angle, and running measurements with real-time plotting. The setup is controlled via a user-friendly menu interface.
In this section, the script initializes the ultrasonic wave setup by configuring various parameters, including the operating mode, input impedance, transmitter type, pulse width, sampling frequency, and other settings. These parameters are essential for ensuring the correct operation of the ultrasonic wave motor in pulse mode.
This part establishes communication with the Arduino Uno board. It defines the number of motor steps, the pins to which the motor is connected, and the delay between steps. This setup is necessary for precise control of the stepper motor connected to the Arduino.
The main loop of the script presents a menu to the user with four options:
- Move to a position
- Find incidence angle
- Run and plot
- Exit Depending on the user's choice, the script will call different functions to execute the corresponding operation.
This function sends commands to the Arduino to control the stepper motor. It sets the state of the motor pins to achieve the desired movement.
This function calculates the steps required to move the motor to a target position and then sends the appropriate commands to the Arduino to achieve this movement. It uses predefined states for forward and backward movement to ensure accurate positioning.
This function moves the motor over a specified range of angles, collects ultrasonic data at each step, and determines the angle with the maximum signal response. It plots the real-time data and the median of maximum values versus the angle. The user can then return the motor to the optimal angle if desired.
This function performs a complete run over a specified angle range, taking multiple measurements and plotting the results in real-time. It updates the data matrix with the collected measurements and visualizes the results both in a 2D plot and a polar plot to show the shape of the piece being analyzed.
- Initialize the script by ensuring all connections are properly set up and running the script in MATLAB.
- Select an option from the main menu:
- Move to a position to set the motor to a specific angle.
- Find incidence angle to sweep the motor over a range of angles and find the optimal incidence angle.
- Run and plot to perform a detailed scan and visualize the data in real-time.
- Exit to terminate the script.
- Follow the prompts to input the required parameters for each operation.
- View the results in the plots generated by the script to analyze the ultrasonic data.