Skip to content

MattRct/Matthieu-Rochet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Matthieu-Rochet

Measures in materials with US-Wave in matlab

You need the US-Wave code which is NOT provided in this file.

Ultrasonic Wave Motor Control System

Overview

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.

Script Structure

Pulse Mode Initialization

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.

Arduino Setup

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.

Main Options Loop

The main loop of the script presents a menu to the user with four options:

  1. Move to a position
  2. Find incidence angle
  3. Run and plot
  4. Exit Depending on the user's choice, the script will call different functions to execute the corresponding operation.

Motor Command Function

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.

Move to Position Function

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.

Find Incidence Angle Function

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.

Complete Run Function

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.

How to Use

  1. Initialize the script by ensuring all connections are properly set up and running the script in MATLAB.
  2. 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.
  3. Follow the prompts to input the required parameters for each operation.
  4. View the results in the plots generated by the script to analyze the ultrasonic data.

About

Measures in materials with US-Wave in matlab

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages