Professional Documents
Culture Documents
Phase 3, project
evaluation
MARIAM NISAR EAU0815447
EAU0815447
Table of contents
2
EAU0815447
Task 1
The glove consists of the IMU the arduino pro mini microcontroller, the Xbee transmitter
module and tests need to be carried out on the imu and the tranceiever . For this I
require arduino ide software and the Xctu software, the arduino is needed because the
arduino mini board is being used and the reasons for this is(chosing arduinowhy?) ..
the xbee modules need xctu to be configured and is the simplest method to get the
xbees to work , why chose xbees and xctu?
The imu sends data needed for pitch roll and yaw to test if this is working the arduino
ide software is required and its serial monitor is used to test and check whether the
sensor is functioning the way its wanted. Another part of testing is to check if the
transceiver is working and sending data without any errors or delays. For this again the
arduinos serial monitor is used.
The reason to choose this way to test the operation of both the sensor and the
transceiver is because it will show the 3 degrees of freedom (pitch , roll, yaw) and each
can be checked by moving the IMU the way pitch , roll and yaw is . This will be
translated onto the screen as decimal numbers both positive and negative depending
on the position of the IMU.
When testing pitch , the values in the p column will be checked to see its changing with
displacement, the same will be done for roll and yaw by looking at the respective
columns for changes.
Before testing pitch roll and yaw the imu will be placed on a flat surface or held level at
a point to see if it gives the same reading for the amount of time its held in that position.
This is to test whether the imu does not give continuously random numbers at steady
state.
The serial monitor will be able to simplify and show just the values needed , furthermore
when using the transceiver side by side with the IMU , the Xbee receiver receives the
data and the arduino will show the same screen when testing the imu and again the
pitch roll and yaw can be tested with the transceiver and confirm its working correctly.
The glove requires a thick material so when the arduino , Xbee, battery and sensors are
placed on it , the wiring or any sharp edges does not hurt the user. And the components
can be stuck or attached to them securely and easily, for this a list of potential materials
are required and the feel, thickness, cost etc needs to be evaluated and a selection
needs to be made. The glove will be either store bought or custom made, if a suitable
option is not available in stores , the glove will be custom made.
3
EAU0815447
Task 2
Code used to test the IMU on pitch roll and yaw along with the tranceiever.
// I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050 class using DMP (MotionApps
v2.0)
/* ============================================
I2Cdev device library code is placed under the MIT license
Copyright (c) 2012 Jeff Rowberg
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
4
EAU0815447
===============================================
*/
// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
// for both classes must be in the include path of your project
#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"
/* =========================================================================
NOTE: In addition to connection 3.3v, GND, SDA, and SCL, this sketch
depends on the MPU-6050's INT pin being connected to the Arduino's
external interrupt #0 pin. On the Arduino Uno and Mega 2560, this is
digital I/O pin 2.
* ========================================================================= */
/* =========================================================================
NOTE: Arduino v1.0.1 with the Leonardo board generates a compile error
when using Serial.write(buf, len). The Teapot output uses this method.
The solution requires a modification to the Arduino USBAPI.h file, which
is fortunately simple, but annoying. This will be fixed in the next IDE
release. For more info, see these links:
http://arduino.cc/forum/index.php/topic,109987.0.html
http://code.google.com/p/arduino/issues/detail?id=958
* ========================================================================= */
5
EAU0815447
//#define OUTPUT_READABLE_QUATERNION
// orientation/motion vars
Quaternion q; // [w, x, y, z] quaternion container
VectorInt16 aa; // [x, y, z] accel sensor measurements
6
EAU0815447
// ================================================================
// === INTERRUPT DETECTION ROUTINE ===
// ================================================================
volatileboolmpuInterrupt = false; // indicates whether MPU interrupt pin has gone high
voiddmpDataReady() {
mpuInterrupt = true;
}
// ================================================================
// === INITIAL SETUP ===
// ================================================================
void setup() {
// NOTE: 8MHz or slower host processors, like the Teensy @ 3.3v or Ardunio
// Pro Mini running at 3.3v, cannot handle this baud rate reliably due to
// the baud timing being too misaligned with processor ticks. You must use
// 38400 or slower in these cases, or use some kind of external separate
// crystal solution for the UART timer.
7
EAU0815447
// initialize device
Serial.println(F("Initializing I2C devices..."));
mpu.initialize();
// verify connection
Serial.println(F("Testing device connections..."));
Serial.println(mpu.testConnection() ? F("MPU6050 connection successful") : F("MPU6050 connection
failed"));
delay(10);
// wait for ready
Serial.println(F("\nSend any character to begin DMP programming and demo: "));
while (Serial.available() &&Serial.read()); // empty buffer
while (!Serial.available()); // wait for data
while (Serial.available() &&Serial.read()); // empty buffer again
// supply your own gyro offsets here, scaled for min sensitivity
mpu.setXGyroOffset(46);
mpu.setYGyroOffset(145);
mpu.setZGyroOffset(15);
mpu.setZAccelOffset(1622); // 1688 factory default for my test chip
// set our DMP Ready flag so the main loop() function knows it's okay to use it
Serial.println(F("DMP ready! Waiting for first interrupt..."));
dmpReady = true;
8
EAU0815447
Serial.print(devStatus);
Serial.println(F(")"));
}
// ================================================================
// === MAIN PROGRAM LOOP ===
// ================================================================
void loop() {
// if you are really paranoid you can frequently test in between other
// stuff to see if mpuInterrupt is true, and if so, "break;" from the
// while() loop to immediately process the MPU data
// check for overflow (this should never happen unless our code is too inefficient)
if ((mpuIntStatus& 0x10) || fifoCount == 1024) {
// reset so we can continue cleanly
mpu.resetFIFO();
//Serial.println(F("FIFO overflow!"));
// otherwise, check for DMP data ready interrupt (this should happen frequently)
} else if (mpuIntStatus& 0x02) {
// wait for correct available data length, should be a VERY short wait
while (fifoCount<packetSize) fifoCount = mpu.getFIFOCount();
9
EAU0815447
#ifdef OUTPUT_READABLE_QUATERNION
// display quaternion values in easy matrix form: w x y z
mpu.dmpGetQuaternion(&q, fifoBuffer);
Serial.print("quat\t");
Serial.print(q.w);
Serial.print("\t");
Serial.print(q.x);
Serial.print("\t");
Serial.print(q.y);
Serial.print("\t");
Serial.println(q.z);
#endif
#ifdef OUTPUT_READABLE_EULER
// display Euler angles in degrees
mpu.dmpGetQuaternion(&q, fifoBuffer);
mpu.dmpGetEuler(euler, &q);
Serial.print("euler\t");
Serial.print(euler[0] * 180/M_PI);
Serial.print("\t");
Serial.print(euler[1] * 180/M_PI);
Serial.print("\t");
Serial.println(euler[2] * 180/M_PI);
#endif
#ifdef OUTPUT_READABLE_YAWPITCHROLL
// display Euler angles in degrees
mpu.dmpGetQuaternion(&q, fifoBuffer);
mpu.dmpGetGravity(&gravity, &q);
mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
//Serial.print("ypr\t");
//Serial.print(ypr[0] * 180/M_PI);
yaw=ypr[0] * 180/M_PI;
//Serial.print("\t");
//Serial.print(ypr[1] * 180/M_PI);
pitch=ypr[1] * 180/M_PI;
//Serial.print("\t");
//Serial.println(ypr[2] * 180/M_PI);
roll=ypr[2] * 180/M_PI;
intval=ypr[2] * 180/M_PI;
#endif
10
EAU0815447
#ifdef OUTPUT_READABLE_REALACCEL
// display real acceleration, adjusted to remove gravity
mpu.dmpGetQuaternion(&q, fifoBuffer);
mpu.dmpGetAccel(&aa, fifoBuffer);
mpu.dmpGetGravity(&gravity, &q);
mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
Serial.print("areal\t");
Serial.print(aaReal.x);
Serial.print("\t");
Serial.print(aaReal.y);
Serial.print("\t");
Serial.println(aaReal.z);
#endif
#ifdef OUTPUT_READABLE_WORLDACCEL
// display initial world-frame acceleration, adjusted to remove gravity
// and rotated based on known orientation from quaternion
mpu.dmpGetQuaternion(&q, fifoBuffer);
mpu.dmpGetAccel(&aa, fifoBuffer);
mpu.dmpGetGravity(&gravity, &q);
mpu.dmpGetLinearAccel(&aaReal, &aa, &gravity);
mpu.dmpGetLinearAccelInWorld(&aaWorld, &aaReal, &q);
Serial.print("aworld\t");
Serial.print(aaWorld.x);
Serial.print("\t");
Serial.print(aaWorld.y);
Serial.print("\t");
Serial.println(aaWorld.z);
#endif
#ifdef OUTPUT_TEAPOT
// display quaternion values in InvenSense Teapot demo format:
teapotPacket[2] = fifoBuffer[0];
teapotPacket[3] = fifoBuffer[1];
teapotPacket[4] = fifoBuffer[4];
teapotPacket[5] = fifoBuffer[5];
teapotPacket[6] = fifoBuffer[8];
teapotPacket[7] = fifoBuffer[9];
teapotPacket[8] = fifoBuffer[12];
teapotPacket[9] = fifoBuffer[13];
Serial.write(teapotPacket, 14);
teapotPacket[11]++; // packetCount, loops at 0xFF on purpose
#endif
Serial.print(yaw);
Serial.print(",");
Serial.print(pitch);
11
EAU0815447
Serial.print(",");
Serial.print(roll);
Serial.print("\n");
delay(10);
}
}
Results : this is the data displayed on the serial monitor which uses the IMU along with the Xbee
transmitter and receiver module , pitch roll and yaw testing is shown on the receiving end:
12
EAU0815447
7.48,61.60,-12.01
7.48,61.85,-11.54
5.14,57.28,-12.59
4.16,51.50,-11.15 The red box contains data I was testing for pitch. when not pitching
4.34,47.67,-10.69 up or down the imu pitch column (middle) should be as closest to 0
2.09,41.41,-10.68 as possible , as the imu was made to pitch up the decimal numbers
-0.34,34.22,-11.22
are positive and increase to 61.85 and then I proceeded to pitch
-0.99,26.42,-7.06
-0.35,18.18,-4.83 down and the values reduce to zero and become negative down to
-0.54,10.50,-5.66 -46.03. These results were not unexpected and meant that pitch
-0.36,3.18,-6.72 was working properly.
-0.58,-1.39,-5.68
-1.28,-10.12,-4.92
-1.55,-18.49,-6.06
-3.77,-27.77,-7.89
-4.96,-33.93,-8.87
-7.44,-40.53,-10.62
-10.23,-44.64,-11.70
-10.71,-46.03,-11.88
-9.48,-33.19,-9.73
-10.34,-11.32,-4.67
-7.77,-2.36,-2.42
-5.81,-5.11,-1.68
-6.91,-6.07,-1.75 The blue box contains the test values for roll (3 rd column) and it
-7.34,-2.10,-0.53
starts with approximately 0 and increases to positive 45.30 when
-6.55,-3.75,9.34
-5.84,-4.11,18.88 rolling to the right and the
-4.37,-4.66,25.75
-3.53,-4.90,29.22
-3.32,-4.97,31.83
-2.01,-6.46,34.25
-0.68,-7.25,38.00
1.80,-8.61,41.50
1.46,-8.07,45.30
-0.29,-7.85,41.07
-8.74,-6.03,20.69
-16.78,-6.46,-1.69
-19.64,-7.49,-12.66
-22.48,-8.58,-23.50
-25.60,-11.65,-34.41
-28.75,-15.82,-42.90
-30.69,-18.57,-47.74
-28.34,-14.33,-48.78
-25.73,-10.08, -26.20
-17.01,-6.81 ,-11.26
-26.15,-7.92, -17.29
-15.58, 1.78, -2.48
13
EAU0815447
https://diyhacking.com/arduino-mpu-6050-imu-sensor-tutorial/
14
EAU0815447
Task 3
Custom glove
Magnetometer
9 degrees of freedom
15
EAU0815447
Task 4 D3
In the beginning the aim was to keep the flight simulator simple and through research
through websites and blogs as well as old reports from students of previous semesters
in the library and based on what I learnt in the previous semester as well as consulting a
teacher, I assumed that by using an ultrasonic sensor for moving the platform up and
down and an accelerometer for pitch roll and yaw the four degrees of freedom would be
achieved. However later on as the testing (using arduino software) and experiments
began I found out that although the accelerometer was triple axis supposed to move in
x y and z axes the yaw wasnt working as I thought it would and by doing more research
I discovered that it wouldnt no matter changes in the code or a different accelerometer,
the yaw wouldnt work.
I had found an ultrasonic sensor in the avionics workshop and tested to check if it was
still working, the result from testing it showed it worked for large distances and had an
error for distances less than 12 inches and worked normally for distances larger than
that, and since our project is small scale it was decided that another ultrasonic sensor
will be used. However if the platform were to be made to full scale the long range
ultrasonic would be a more suitable choice.
After more research and through various websites and discussions with group
members, the IMU would replace the accelerometer. This setback was due to not
enough research and the time period set as I was trying to get solutions as fast as I
couldand even though the accelerometer was cheap it would have saved up some
money since it is not needed anymore. When the IMU was tested it worked very well
although I needed some drivers I quickly realized were not present and needed to be
downloaded which didnt take long and gave data for yaw pitch and roll and it was more
sensitive and much more accurate which meant about 50% of my part was done.
The next step was to send data from the ultrasonic sensor and imu combined using the
Xbee transmitter and receiving modules , this is an important part of the projects
operation as the main idea behind it is to use a glove with the sensors and transmitter
attached to send data wirelessly to control servomotors in the platform, the Xbee
modules required Xctu software and needed to be configured, it seemed straightforward
at first based on video tutorials I had gone through on YouTube and websites like spark
fun, when the transmission of data began I was receiving garbage data and the receiver
seemed to stop operating after about 5 seconds of useless data receiving, i then went
through the steps again and found out that there are 2 different places where the baud
rate needs to be set, and there was a mismatch between 15200 and 9600 baud rate,
once all the baud rates were set to 9600 the transceiver was working flawlessly.
16
EAU0815447
When it came to servomotor testing and discussion with group members another
problem came up about the ultrasonic sensor, apparently as the imu pitch or rolls there
is also change in the height since the ultrasonic sensor was going to be placed on the
glove at the bottom, this meant that for example when the imu pitches up there will be
change in height and the platform will not only pitch but also rise up, I had assumed that
when the platform will be made to pitch roll and yaw the ultrasonic sensor will not be
operational.
Deciding that we focus currently on the 3 most important degrees of freedom yaw
pitch and roll , the ultrasonic sensor was discarded, this didnt make a huge difference in
the programming and code I used , the transmitter and receiver send data for the 3
degrees of freedom which is supposed to be received and translated to the servomotors
, by looking more into the IMU I found out that I could still make the other movement up
and down to be possible if there is enough time and maybe even go for six degrees of
freedom in the end.
Overall I think my research methods should have been more detailed and it resulted in
incomplete solutions like the accelerometer and ultrasonic sensor which also cost some
amount of money which in the end was a waste as I could have just bought the imu in
the first place and saved time and possibly even finish of the project sooner. On the
other hand I learned quite a lot maybe more than some of the subjects I have studied.
This project made me use my time management and organization skills which I consider
my strengths, I learnt a lot more than I thought I would , and applying topics in learnt in
classes to an actual project by me and my group members is a whole new experience
and tested at my practical skills.
The remaining portion of the project thats left is to make the servomotors move the
platform to pitch roll and yaw which is currently under works. The transmitter and the
imu along with the arduino mini will be fixed onto the glove by either sewing or
adhesives but only once the platform is functioning as its expected to, once that portion
is complete I will be able to then place the components onto the glove , which will be the
final part in this project.
17
EAU0815447
18