4bar
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
4bar [2017/08/04 18:54] – [MATLAB Program] rebeccacao | 4bar [2017/08/23 08:17] (current) – [Coding in NXC to Read Sensor Data] rebeccacao | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== How to Analyze a 4 Bar Linkage with LEGOs, Solidworks, MATLAB, Gyroscope, and Accelerometer ====== | ====== How to Analyze a 4 Bar Linkage with LEGOs, Solidworks, MATLAB, Gyroscope, and Accelerometer ====== | ||
- | **Author:** <Xinke (Rebecca) Cao> Email: < | + | **Author:** <Xinke (Rebecca) Cao> |
+ | \\ | ||
+ | **Email:** < | ||
\\ | \\ | ||
**Date:** Last modified on < | **Date:** Last modified on < | ||
Line 65: | Line 67: | ||
\\ | \\ | ||
- | ===== Analyzing the 4-Bar Mechanism | + | ===== Analyzing the 4-Bar Mechanism ===== |
See the picture below for a 4-bar mechanism: | See the picture below for a 4-bar mechanism: | ||
\\ | \\ | ||
Line 90: | Line 92: | ||
===== MATLAB Program ===== | ===== MATLAB Program ===== | ||
Please see [[4bMATLAB|this]] page. | Please see [[4bMATLAB|this]] page. | ||
- | |||
- | ===== Modeling in Solidworks ===== | ||
- | Since all of the parts can be found in [[http:// | ||
\\ | \\ | ||
- | The instructions can be found in [[https:// | + | Please download |
- | + | ||
- | + | ||
- | ==== Sec 1: Motion Analysis in Solidworks ==== | + | |
- | After you have successfully assembled | + | |
\\ | \\ | ||
- | + | This is divided so that the readers won't have to scroll up and down constantly due to the large amount | |
- | ==== Sec 2: Results from Solidworks ==== | + | |
- | The results for the linear motion | + | |
- | {{ : | + | |
\\ | \\ | ||
- | The results for the linear motion of node " | ||
- | {{ : | ||
\\ | \\ | ||
- | The results for the angular motion of bar " | + | ===== Modeling in Solidworks ===== |
- | {{ : | + | Please see [[4bSW|this]] page. |
\\ | \\ | ||
- | The results for the angular motion of bar " | + | Please download |
- | {{ : | + | |
- | \\ | + | |
- | \\ | + | |
- | + | ||
- | Although the results from Solidworks and MATLAB has the same trend and the same overall shape, there is an apparent vertical shrink in the results from Solidworks. In addition, the first derivative terms are worse than the original terms, and the second derivative terms are the worst out of the three. | + | |
- | \\ | + | |
- | \\ | + | |
- | + | ||
- | Since the MATLAB code is based on numerical methods, where there isn't as many decimal places saved in the file compared to Solidworks, rounding and error propagation can present itself as the MATLAB code runs on. For example, in the MATLAB code, there is a zero tolerance, meaning, the two displacement equations derived above doesn' | + | |
- | \\ | + | |
- | \\ | + | |
- | + | ||
- | Furthermore, | + | |
\\ | \\ | ||
+ | Please download the excel file that contains all of the Solidworks data [[https:// | ||
\\ | \\ | ||
\\ | \\ | ||
Line 215: | Line 193: | ||
\\ | \\ | ||
--> | --> | ||
- | ====== Coding in NXC to Read Sensor Data ====== | + | ===== Coding in NXC to Read Sensor Data ===== |
+ | Please download the [[https:// | ||
+ | \\ | ||
First, the mechanism with the sensors are placed on a flat surface, a function is run, as seen from [[https:// | First, the mechanism with the sensors are placed on a flat surface, a function is run, as seen from [[https:// | ||
\\ | \\ | ||
Line 246: | Line 226: | ||
\\ | \\ | ||
===== Accelerometer and Gyroscope for the 4 Bar Mechanism ===== | ===== Accelerometer and Gyroscope for the 4 Bar Mechanism ===== | ||
- | ==== Sec 1: Connecting Accelerometer to the LEGO Bars ==== | ||
- | ** Constructing the Sensors Mounts ** | ||
- | \\ | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | ** Attaching the 4 Bar to the NXT Motor ** | ||
- | \\ | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | + | ==== Sec 1: Connecting Sensors to the LEGO Bars ==== |
- | \\ | + | The hardware construction guide can be found on [[4bConstru|this]] page. |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
\\ | \\ | ||
\\ | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
+ | ==== Sec 2: Realistic Motor Data ==== | ||
+ | The results for measuring the motor speed can be found on [[4bmotor|this]] page. | ||
\\ | \\ | ||
\\ | \\ | ||
\\ | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | |||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | ** Attaching the Sensors to Bar " | ||
- | \\ | ||
- | The purpose of attaching to bar " | ||
- | \\ | ||
- | {{: | ||
- | {{: | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | |||
- | ** Attaching the Sensors to Bar " | ||
- | \\ | ||
- | The purpose of attaching to bar " | ||
- | \\ | ||
- | {{: | ||
- | {{: | ||
- | {{: | ||
- | \\ | ||
- | \\ | ||
- | |||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | \\ | ||
- | |||
- | |||
- | ==== Sec 2: Realistic Motor Data ==== | ||
- | To ensure that the model in MATLAB matches the realistic model, the motor data from the NXT are collected such that the steady state rotational speed of the NXT motor will be known and will be used as an input to the MATLAB code. | ||
- | |||
- | {{ : | ||
- | \\ | ||
- | As shown on the figure above, the steady state rotational speed of the NXT motor with the brick used for the experiment is roughly 89 RPM. | ||
- | |||
\\ | \\ | ||
==== Sec 3: Data Processing in MATLAB ==== | ==== Sec 3: Data Processing in MATLAB ==== | ||
Line 534: | Line 305: | ||
\\ | \\ | ||
\\ | \\ | ||
- | ==== Sec 5: MATLAB Program ==== | + | ==== Sec 4: MATLAB Program ==== |
+ | Please download the data and the filtering program for node " | ||
+ | \\ | ||
+ | Please download the data and the filtering program for node " | ||
+ | \\ | ||
First, I need to read data from a .csv file and store it in MATLAB. | First, I need to read data from a .csv file and store it in MATLAB. | ||
M = csvread(' | M = csvread(' | ||
Line 599: | Line 374: | ||
\\ | \\ | ||
\\ | \\ | ||
- | ==== Sec 4: Results from MATLAB | + | ==== Sec 5: Filtered Data ==== |
- | + | The resultant filtered | |
- | + | ||
- | ** For Node a1 ** | + | |
- | {{ : | + | |
- | \\ | + | |
- | {{ : | + | |
- | \\ | + | |
- | {{ : | + | |
- | \\ | + | |
- | {{ : | + | |
- | \\ | + | |
- | {{ : | + | |
- | \\ | + | |
- | \\ | + | |
- | ** For Node b1 ** | + | |
- | \\ | + | |
- | {{ : | + | |
- | \\ | + | |
- | {{ : | + | |
- | \\ | + | |
- | {{ : | + | |
- | \\ | + | |
- | {{ : | + | |
- | \\ | + | |
- | {{ : | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | ** Causes for Error ** | + | |
- | \\ | + | |
- | Hardware wise, the errors are caused by the oscillation of the sensors when the 4 bar linkage is moving to obtain data. The frictions in the pins will also prevent the experimental results to deviate from the theoretical results from MATLAB, where MATLAB is based purely on kinematics (which doesn' | + | |
- | Software wise, the errors are from the error propagation in rounding and smoothing of the data from the sensor. The sensor themselves have a lot of noise (especially accelerometer) and the gyroscope sensor is known to drift. Although all of these problems was corrected to a certain extend in the MATLAB | + | |
\\ | \\ | ||
\\ | \\ | ||
\\ | \\ | ||
\\ | \\ | ||
+ | |||
===== Final Words ===== | ===== Final Words ===== | ||
4bar.1501898070.txt.gz · Last modified: 2017/08/04 18:54 by rebeccacao