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 18:58] 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 65: Line 67:
 \\ \\
  
-===== Analyzing the 4-Bar Mechanism By Hand =====+===== 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://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 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 ** 
-\\ 
-{{:xinke:4b:s1.jpg?200 |}} 
-{{:xinke:4b:s2.jpg?200 |}} 
-{{:xinke:4b:s3.jpg?200 |}} 
-{{:xinke:4b:s4.jpg?200 |}} 
-{{:xinke:4b:s5.jpg?200 |}} 
-{{:xinke:4b:s6.jpg?200 |}} 
-{{:xinke:4b:s7.jpg?200 |}} 
-{{:xinke:4b:s8.jpg?200 |}} 
-{{:xinke:4b:s9.jpg?200 |}} 
-{{:xinke:4b:s10.jpg?200 |}} 
-{{:xinke:4b:s11.jpg?200 |}} 
-{{:xinke:4b:s12.jpg?200 |}} 
-{{:xinke:4b:s13.jpg?200 |}} 
-{{:xinke:4b:s14.jpg?200 |}} 
-{{:xinke:4b:s15.jpg?200 |}} 
-{{:xinke:4b:s16.jpg?200 |}} 
-{{:xinke:4b:s17.jpg?200 |}} 
-{{:xinke:4b:s18.jpg?200 |}} 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
  
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-** Attaching the 4 Bar to the NXT Motor ** 
-\\ 
-{{:xinke:w1.jpg?200 |}} 
-{{:xinke:w2.jpg?200 |}} 
-{{:xinke:w3.jpg?200 |}} 
-{{:xinke:w4.jpg?200 |}} 
-{{:xinke:w5.jpg?200 |}} 
-{{:xinke:w6.jpg?200 |}} 
-{{:xinke:w7.jpg?200 |}} 
-{{:xinke:w8.jpg?200 |}} 
-{{:xinke:w9.jpg?200 |}} 
-{{:xinke:w10.jpg?200 |}} 
-{{:xinke:w12.jpg?200 |}} 
-{{:xinke:w13.jpg?200 |}} 
-{{:xinke:w14.jpg?200 |}} 
-{{:xinke:w15.jpg?200 |}} 
-{{:xinke:w16.jpg?200 |}} 
-{{:xinke:w17.jpg?200 |}} 
-{{:xinke:w18.jpg?200 |}} 
-{{:xinke:w19.jpg?200 |}} 
-{{:xinke:w20.jpg?200 |}} 
-{{:xinke:w21.jpg?200 |}} 
-{{:xinke:w22.jpg?200 |}} 
-{{:xinke:w23.jpg?200 |}} 
-{{:xinke:w24.jpg?200 |}} 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
  
-\\ +==== 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 "W" ** 
-\\ 
-The purpose of attaching to bar "W" is to measure the state values of node "a1." 
-\\ 
-{{:xinke:4b:r1.jpg?200 |}} 
-{{:xinke:4b:r2.jpg?200 |}} 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
- 
-** Attaching the Sensors to Bar "U" ** 
-\\ 
-The purpose of attaching to bar "U" is to measure the state values of node "b1." 
-\\ 
-{{:xinke:4b:l1.jpg?200 |}} 
-{{:xinke:4b:l2.jpg?200 |}} 
-{{:xinke:4b:l3.jpg?200 |}} 
-\\ 
-\\ 
- 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
-\\ 
- 
- 
-==== 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.  
- 
-{{ :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 504: 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 569: 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.1501898288.txt.gz · Last modified: 2017/08/04 18:58 by rebeccacao