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:58] – 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. | ||
+ | \\ | ||
+ | Please download the MATLAB model of the 4-bar mechanism [[https:// | ||
\\ | \\ | ||
This is divided so that the readers won't have to scroll up and down constantly due to the large amount of information on this page. | This is divided so that the readers won't have to scroll up and down constantly due to the large amount of information on this page. | ||
Line 96: | Line 100: | ||
===== Modeling in Solidworks ===== | ===== Modeling in Solidworks ===== | ||
Please see [[4bSW|this]] page. | Please see [[4bSW|this]] page. | ||
+ | \\ | ||
+ | Please download the Solidworks assembly [[https:// | ||
+ | \\ | ||
+ | Please download the excel file that contains all of the Solidworks data [[https:// | ||
\\ | \\ | ||
\\ | \\ | ||
Line 185: | 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 216: | 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 504: | 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 569: | 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.1501898288.txt.gz · Last modified: 2017/08/04 18:58 by rebeccacao