User Tools

Site Tools


4bar

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
4bar [2017/08/04 19:01] – [Sec 1: Connecting Accelerometer to the LEGO Bars] rebeccacao4bar [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: <[email protected]+**Author:** <Xinke (Rebecca) Cao>  
 +\\ 
 +**Email:** <[email protected]
 \\ \\
 **Date:** Last modified on <07/27/2017> **Date:** Last modified on <07/27/2017>
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://drive.google.com/open?id=0B4prKwfGK8d2Z0FIN2Nwb3NjZ1U|here]].
 \\ \\
 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://drive.google.com/open?id=0B4prKwfGK8d2Nm56al8yc0Y0MTQ|here]].
 +\\
 +Please download the excel file that contains all of the Solidworks data [[https://drive.google.com/open?id=0B4prKwfGK8d2TTBmdElwMExRNHM|here]].
 \\ \\
 \\ \\
Line 185: Line 193:
 \\ \\
 --> -->
-====== Coding in NXC to Read Sensor Data ======+===== Coding in NXC to Read Sensor Data ===== 
 +Please download the [[https://drive.google.com/open?id=0B4prKwfGK8d2SkRGZ3JIMGZqUjA|code]]. 
 +\\
 First, the mechanism with the sensors are placed on a flat surface, a function is run, as seen from [[https://www.youtube.com/watch?v=WCTdTN7qPOg|this]] video that will calibrate the gyrosensor to read zero on the chosen surface.  First, the mechanism with the sensors are placed on a flat surface, a function is run, as seen from [[https://www.youtube.com/watch?v=WCTdTN7qPOg|this]] video that will calibrate the gyrosensor to read zero on the chosen surface. 
 \\ \\
Line 225: Line 235:
  
 ==== Sec 2: Realistic Motor Data ==== ==== 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.  +The results for measuring the motor speed can be found on [[4bmotor|this]] page
- +\\ 
-{{ :xinke:4b:screen_shot_2017-07-26_at_1.12.38_pm.png?300 }}+\\
 \\ \\
-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 297: Line 305:
 \\ \\
 \\ \\
-==== Sec 5: MATLAB Program ====+==== Sec 4: MATLAB Program ==== 
 +Please download the data and the filtering program for node "a1" [[https://drive.google.com/open?id=0B4prKwfGK8d2RURFSjNEOFNfQ1U|here]]. 
 +\\ 
 +Please download the data and the filtering program for node "b1" [[https://drive.google.com/open?id=0B4prKwfGK8d2VjJ5Tk95N3lnX1k|here]]. 
 +\\
 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('Acc.csv',1,0);   M = csvread('Acc.csv',1,0);
Line 362: Line 374:
 \\ \\
 \\ \\
-==== Sec 4Results from MATLAB ==== +==== Sec 5Filtered Data ==== 
- +The resultant filtered data from MATLAB can be found on [[4bdata|this]] page.
- +
-** For Node a1 ** +
-{{ :xinke:a1.png?500 |}} +
-\\ +
-{{ :xinke:a2.png?500 |}} +
-\\ +
-{{ :xinke:a3.png?500 |}} +
-\\ +
-{{ :xinke:a4.png?500 |}} +
-\\ +
-{{ :xinke:a5.png?500 |}} +
-\\ +
-\\ +
-** For Node b1 **    +
-\\ +
-{{ :xinke:4b:b1.png?500 |}} +
-\\ +
-{{ :xinke:4b:b2.png?500 |}} +
-\\ +
-{{ :xinke:4b:b3.png?500 |}} +
-\\ +
-{{ :xinke:4b:b4.png?500 |}} +
-\\ +
-{{ :xinke:4b:b5.png?500 |}} +
-\\ +
-\\ +
-\\ +
-\\ +
-** 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't consider forces, or how things started to move).  +
-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 code when I processed the data. But without prior knowledge on data processing, the filters are definitely not perfect+
 \\ \\
 \\ \\
 \\ \\
 \\ \\
 +
 ===== Final Words ===== ===== Final Words =====
  
4bar.1501898509.txt.gz · Last modified: 2017/08/04 19:01 by rebeccacao