mechanical engineering

profilebo_na9ir
lab_-5_.pdf

ME-4543 Laboratory #6

Debugging Practice

1 Physical Systems

1.1 Case of the Non-Spinning Motor

You’re an engineer at MechatronicsInc and your boss has contacted you to fix a problem their team is having. They have a precise velocity controlled blower fan that suddenly stopped working. What steps would you take to figure out why it isn’t working and what actions you would take to fix the problem. For example if the cord wasn’t plugged in, you would check to see if was plugged in, then you would plug it in.

1.2 Case of False Tracking

You were walking by the machine vision department of MechatronicsInc and you overhear they are having troubles, so you pop in to help. The describe their stereo-vision tracking system and how awesome it is, but that they are also having a very odd problem. Every since they moved it into the Optics and Laser division room, their systems have very intermittent periods where they are unable to track any objects. What might be causing this and how would you fix it? List at least 2 problems and solutions.

1.3 Case of Fire!

An intern at MechatronicsInc was building a new smaller precice velocity con- trolled blower fan and you are his mentor. His project was coming along nicely and he wanted to show you. You sit down to watch and he turns it on, very shortly though you start to smell and see smoke from the device. The intern panics and unplugs the device, and the smoke starts to lessen, but the intern is puzzled as to what may have caused this. What do you think caused this? List at least 2 possible problems that may have caused this.

2 Code Practice

These should be done using the arduino! Use the serial terminal to print debug statements (HINT HINT).

1

2.1 What is my average?

You want to know your average in the class and you have all your grades, so you developed some code, but don’t know why its failing. Find out why and correct the following pseudo-code:

int[] mygrades = [98, 89, 94, 85, 76, 94, 68, 97, 87, 88, 91, 94]; int i = 0; int average = 0; while i ≤ length(mygrades) do

average = average + mygrades[i]; i = i + 1;

end while average = average / length(mygrades); return average

2.2 Which way am I facing?

You just bought a brand new accelerometer and want to use it to determine which way your device is oriented. So you know that the first thing you need is a unit vector describing your gravity vector. So you made this program, but it doesn’t work. Fix it! Remember the square root sum of the squares on a unit vector should equal 1.0!

int AccelXValue = 0; int AccelYValue = 0; int AccelZValue = 0; float[3] Vector = [0.0, 0.0, 0.0]; function getAccelXValue

return float acceldevice.xReading; . for testing you can simply return the value 1.1 here end function function getAccelYValue

return float acceldevice.yReading; . for testing you can simply return the value 2.2 here end function function getAccelZValue

return float acceldevice.zReading; . for testing you can simply return the value 3.3 here end function loop . Get values from Accelerometer

AccelXValue = getAccelXValue(); AccelYValue = getAccelYValue(); AccelZValue = getAccelZValue(); . Determine Vector int magnitude = AccelXV alue2 + AccelY V alue2 + AccelZV alue2; Vector = [ AccelXV alue/magnitude, AccelY V alue/magnitude, AccelZV alue/magnitude

]; println(Vector); . for testing you’ll have to use multiple prints

2

end loop

3