NASA-Threads Work and Mechanics Lesson 41: Accelerometers Review Computing g-force using the Memsic 2125 The Memsic 2125 sends square waves every 10 milliseconds through its x-out and y-out pins. T1 T1 T1 5V 0V 10 ms 10 ms 10 ms time The time period T1 (where the output is 5V or high) varies depending on the acceleration; a shorter T1 corresponds to a smaller acceleration, and a longer T1 corresponds to a larger acceleration. The accelerometer is designed so that g-force is computed using the equation below. 𝑇 𝑔 𝑓𝑜𝑟𝑐𝑒 = ( 1 − 0.5) ∙ 8 10 𝑚𝑠 (1) NASA-Threads Work and Mechanics Lesson 41: Accelerometers The PBASIC command PULSIN measures T1 in 2-microsecond time increments: PULSIN 6, 1, x 6 = pin number 1 = the command measures the time that pin 6 is HIGH x = time that pin 6 is high (measured in 2ms time increments) Thus, if the command returns a value of x = 2500, then . . . 2500 ∙ 2𝜇𝑠 ∙ 𝑇1 𝑔 𝑓𝑜𝑟𝑐𝑒 = ( − 0.5) ∙ 8 = ( 10 𝑚𝑠 1 𝑚𝑠 1000𝜇𝑠 10 𝑚𝑠 − 0.5) ∙ 8 5 𝑚𝑠 = ( − 0.5) ∙ 8 = 0g 10 𝑚𝑠 Simplifying equation 1 provides us with an easy way to measure acceleration with our BoeBots!!! (2) 𝑔 𝑓𝑜𝑟𝑐𝑒 = 0.0016 ∙ (𝑝𝑟𝑜𝑔𝑟𝑎𝑚 𝑜𝑢𝑡𝑝𝑢𝑡) − 4 Applying this equation from -2g to 2g yields . . . output of PULSIN 2.0 acceleration 1.5 (x or y) (g) 1250 -2.0 1500 -1.6 1750 -1.2 2000 -0.8 2250 -0.4 2500 0.0 2750 0.4 -1.5 3000 0.8 -2.0 3250 1.2 3500 1.6 3750 2.0 acceleration in g's = 0.0016(output of PULSIN) - 4 acceleration (g) 1.0 0.5 0.0 1250 -0.5 1750 2250 2750 -1.0 output of PULSIN command 3250 3750 NASA-Threads Work and Mechanics Lesson 41: Accelerometers CLASS PROBLEM: The Memsic 2125 accelerometer outputs y=1000 from the PBASIC program presented earlier. What is the g-force in the y-direction? Computing Tilt Angles When the accelerometer is oriented so that +x points upward, the “x” variable from the program should be around 3125 which corresponds to an acceleration of 1g (see the Table above). Since the acceleration ranges from 0g (output = 2500) to 1g (output = 3125) when rotating the robot from horizontal to vertical, the acceleration sensed by the device must be related to the tilt angle. We can use simple trigonometry to relate the tilt angle to acceleration. +x x Using trigonometry, a 𝜃𝑥 = asin ( gx ) (3) Likewise, ax ay 𝜃𝑦 = asin ( g ) x 1g (perceived vertical acceleration) (4) NASA-Threads Work and Mechanics Lesson 41: Accelerometers CLASS PROBLEM: The Memsic 2125 accelerometer is tilted to an angle so that the output of the x-acceleration from the PBASIC program above is 2800. Use equations 2 and 3 above to determine the tilt angle x.