Show Posts
Pages: 1 2 [3] 4 5 ... 7
31  Using Arduino / Sensors / Re: Sensor & Servo interfering [PROBLEM] on: October 12, 2012, 08:16:55 pm
32  Using Arduino / Sensors / Re: Sensor & Servo interfering [PROBLEM] on: October 09, 2012, 06:32:22 pm
I followed your advice but I still have the same issue as before.
But I will continue with using external battery to supply the servo, so thanks!

This is an answer I had from an other site but I dont know how to go any further.
Well, yeah, if you are getting FIFO overflow, you are not emptying it out in time so something must be using too much time. If you are generating PWM signals for the servo with the same processor that reads the MPU then you could easily overflow the FIFO. I mean if THAT’S your configuration. It also means your sensor is set for free running reads.

Please help me go further!

PS. DuaneB, nice projects uve done!
33  Using Arduino / Sensors / Re: Sensor & Servo interfering [PROBLEM] on: October 08, 2012, 07:43:02 am
34  Using Arduino / Sensors / Sensor & Servo interfering [PROBLEM] on: October 07, 2012, 08:27:36 am
Hello peeps,

Maybe I should start by telling you what I am doing so you can get a perspective of my problem and maybe give me a helping hand.

I have a sensor called Triple Axis Accelerometer & Gyro Breakout - MPU-6050 , and Ive managed to get it working. I can get the information I want from it.
And to get the information I want from it Im using the interrupt function.  So the interrupt part is a big factor of the problem I will tell you about.

So Ive tried to expand the code further, by adding servos.
What Im trying to do is to control the servos depending on the values the sensor is generating. It works out, for a couple of seconds.

The problem is now that, after these couple of seconds the values from the sensor gets screwd up. Getting values that I shouldnt get.

The servo and the sensor are overflowing the fifobuffer.

Help appreciated, cheers!

Link for the code im using
35  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: September 14, 2012, 01:40:42 pm

I'm sorry .. I use the same sensor.

How did you find these values?

double zeroValue[5] = {950, -400, 13500, -100, -500};

you can edit your skecth?

Hello! I dont have the sketch no more, I partly gave up on this sensos hehe.
However, if you look at Lazarus sketch it is basically the same

But Id recommend you to use this sketch instead as it is made for your sensor

When I used the later mentioned sketch I got it to work with the yaw,pitch,roll values but when I try to combine it to work with a servo I get fifo overflow and the code gets screwd up.

36  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: August 16, 2012, 04:00:58 pm

First of all, thank you !

I took a look into ur  code (for I2C) u provided in a reply and put it together with another code.

ZeroValues > I did not take these values from the datasheet, I just ran a script with raw values and took the average values when the sensor was lying on the floor.
GyroSensitivity > I actually dont know which one I should take from the datasheet, but Ive tried everyone (there are 4 levels).

These are the values I get when the sensor is lying on the floor
343.26   136.31   
344.40   126.77   
345.49   117.89   
346.50   109.65   
347.41   101.99   
348.27   94.83   
349.07   113.36   
349.82   105.43   
350.48   98.05   
351.12   91.18   
351.71   84.80   
352.27   104.04   
352.78   96.76   
353.25   89.98   
353.69   83.68   
354.12   77.82   
354.51   72.36   
354.87   67.28   
355.23   87.76   
330.36   106.78   
332.41   99.32   
334.33   92.38   
336.12   85.92   
337.78   79.92   
339.31   74.32   
340.73   69.13   
342.06   64.28   
343.30   59.78   
344.46   55.58   
345.50   76.87   
346.49   96.67   
322.25   115.07   
324.85   107.02   
327.25   124.71   
329.51   115.98   
331.62   107.86   
333.54   100.32      

And here is the code

// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#include "Wire.h"

// 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.h"

// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for InvenSense evaluation board)
// AD0 high = 0x69
MPU6050 accelgyro;

int16_t ax, ay, az;
int16_t gx, gy, gz;

bool blinkState = false;

unsigned long timer;

double zeroValue[5] = {950, -400, 13500, -100, -500};

/* All the angles start at 180 degrees */
double gyroXangle = 180;
double gyroYangle = 180;

double compAngleX = 180;
double compAngleY = 180;

void setup() {

    // join I2C bus (I2Cdev library doesn't do this automatically)

    // initialize device
    Serial.println("Initializing I2C devices...");

    // verify connection
    Serial.println("Testing device connections...");
    Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");

   timer = micros();

void loop() {
    // read raw accel/gyro measurements from device
    //accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

    accelgyro.getRotation(&gx, &gy, &gz);
    double gyroXrate = -((gx-zeroValue[3])/131); //Change the sensitivity after your sensor
    gyroXangle += gyroXrate*((double)(micros()-timer)/1000000); // Without any filter
    double gyroYrate = ((gy-zeroValue[4])/131);
    gyroYangle += gyroYrate*((double)(micros()-timer)/1000000); // Without any filter
    //The acc X and Y angle///
    accelgyro.getAcceleration(&ax, &ay, &az);
    double accXval = ax-zeroValue[0];
    double accZval = ay-zeroValue[2];    
    double accXangle = (atan2(accXval,accZval)+PI)*RAD_TO_DEG;
    double accYval = ay-zeroValue[1];
    accZval = ay-zeroValue[2];    
    double accYangle = (atan2(accYval,accZval)+PI)*RAD_TO_DEG;
    compAngleX = (0.93*(compAngleX+(gyroXrate*(double)(micros()-timer)/1000000)))+(0.07*accXangle);
    compAngleY = (0.93*(compAngleY+(gyroYrate*(double)(micros()-timer)/1000000)))+(0.07*accYangle);

    timer = micros();
  Serial.print(compAngleY); Serial.print("\t");
  //Serial.print(timer); Serial.print("\t");


Im using a sensor called MPU6050.
Datasheet can be found here:

When I move it like one mm to another direction it seems to be stable, I guess there is a point where everything gets screwd up..
2.51   1.53   
2.49   1.50   
2.48   1.49   
2.48   1.49   
2.47   1.49   
2.47   1.48   
2.46   1.46   
2.47   1.44   
2.49   1.41   
2.51   1.37   
2.52   1.38   
2.54   1.38   
2.51   1.38   
2.51   1.39   
2.50   1.41   
2.48   1.40   
2.46   1.38   
2.48   1.39   
2.49   1.38   
2.51   1.39   
2.50   1.38   
2.51   1.39   
2.50   1.40   
2.49   1.39   
2.50   1.40   
2.49   1.42   
2.46   1.43   
2.45   1.41   
2.44   1.41   
2.47   1.40   
2.44   1.42   
2.46   1.43   
2.47   1.46   
2.44   1.45   
2.44   1.46
37  Using Arduino / Sensors / Re: simulate MPU-6050. on: August 12, 2012, 10:46:49 am
Oh Ive saw this kind of sensitivity but thats not what Im after (once again sorry for borrowing ur thread).

But what Im really looking for is sensitivity in mV/g for the accelerometer and mV/(deg / s) for the gyro.
38  Using Arduino / Sensors / Re: stop reading from sensor when a value is reached? on: August 12, 2012, 09:00:21 am
What if you make a simple "switch"?

x = 0 > read from sensor
x = 1 > do not read from sensor
39  Using Arduino / Sensors / Re: simulate MPU-6050. on: August 12, 2012, 08:25:11 am
I think he is talking about this software

And I believe you can use this code to make the teapot work

What are the sensitivity values for the mpu6050? (for both the gyro and acc, sry for hijacking this thread now).
I cant find them in the datasheet, or Im blind hehe
40  Using Arduino / Project Guidance / Re: Saw this on youtube, could it be done with multiple arduinos? on: August 12, 2012, 07:51:55 am
Ah, I've seen the monome many times before.

I've started conceptualizing my own version and I'm curious how I would output the sounds?  Would I just store the mp3's in an EEPROM or Flash memory and then if this button is on, retrieve the associated music file from the memory and shoot it out?  What kind of IC would be able to handle being sent so many music files and still be able to output them. Would it just mash em together?

When you press a specific button you want to send a specific midi value to the computer, and you will have a software that will (Ableton works great) recieve these values and from there you decide what kind of sound you want to produce.

To send over the midi values to the computer, you want to use a usb-midi cable which is connected to the computer and a DIN contact (the DIN is connected to the arduino somehow).
OR you could use a software that converts the values, and all you need is a USB connected to the arduino itself and the computer (LINK HERE:
41  Using Arduino / Sensors / Re: MPU 6050 Breakout board [HELP] on: August 02, 2012, 04:06:17 am
Thanks for the link provided, Ill take a deeper look at it when Im back from work.

However, about the servos. I made it very unclear what I actually meant. The degrees from the sensor is jumping, and then the script totally stops.

42  Using Arduino / Sensors / Re: MPU 6050 Breakout board [HELP] on: August 01, 2012, 03:42:08 pm
I see, well it seems to be working out. I just have to let it for like 10 seconds and the values goes to the way they are supposed to be.

However, I tried to add this line (just for testing) but god damn it freaks out.
The value jumps up and down, and then getting stuck at last. From like 60 degrees to 30, then to 0 and so on.
Im using Jeffs sketch, just took the parts I was interrested in.
Any clue why this is happening? Is it cause its using interrupts?
if(yaw > 1){

Could I use your sketch to convert the values into degrees?

43  Using Arduino / Sensors / Re: MPU 6050 Breakout board [HELP] on: August 01, 2012, 12:43:24 pm
There is absolutely something wrong!

Krodals sketch (RAW VALUES):

Jeff Rowbers sketch (degrees, YAW PITCH ROLL):
44  Using Arduino / Sensors / Re: MPU 6050 Breakout board [HELP] on: August 01, 2012, 09:39:40 am

Yesterday I took my time to make some readings from the sensor. I made a notice, the x value increases or decreases (one of them only). It keeps changing by decimal only, but it doesnt stop. Why? (raw values, sketch from Krodal).

I also tried out a sketch from Jeff Rowberg, getting the values in degrees instead (yaw, pitch,roll).
The yaw value doesnt even start at zero, and also does the same as described above (and yes, i use the interrupt pin with this sketch).

Also the pitch and roll isnt at zero degrees even its laid to be like that.

45  Using Arduino / Sensors / Re: MPU 6050 Breakout board [HELP] on: July 28, 2012, 06:58:58 am
What could happen if Id skip that part?

Do you mean that one 10k pullup res for the VI0 and one for VDD ?

-And do you know any page I can read about the values that it outputs?
- Are these 6 axis enough to stabilize a rc plane, or do you need all the 9 axis with the magnetometer?

Pages: 1 2 [3] 4 5 ... 7