Show Posts
Pages: [1] 2
1  Products / Arduino Due / Re: mpu6050 on: November 10, 2013, 12:01:40 pm
I have exactly the same problem when using Due with i2cdevlib,
Sean can you pleasse shrae your f inding and if you sahre some snipets of code I woul be very appreciated ! Tank you.
I can collaborate to help us run it on Due.
2  Using Arduino / Sensors / Re: Sensor & Servo interfering [PROBLEM] on: November 01, 2013, 10:03:30 pm
The servo and the sensor are overflowing the fifobuffer.

I have exactly the same problem! Did you figure out ? Also Im using same piece of code.
3  Using Arduino / Sensors / Re: Arduino Leonardo + MPU6050 ( i2cdevlib ) + Servo.h ( 2 Servos) = messed up PWM on: November 01, 2013, 09:02:17 pm
Hey guys, any ideas, just curious if I messing something up?
4  Using Arduino / Sensors / Arduino Leonardo + MPU6050 ( i2cdevlib ) + Servo.h ( 2 Servos) = messed up PWM on: October 31, 2013, 09:03:19 pm
Guys, please help to understand something:

Im trying to get data from i2cdevlib running MPU6050 to control servos, but strange stuff happening, it seems like when i2cdevlib library start getting data from Sensor my PWM signals  are totally messed up....
I using pins 10, 11 on Leonardo.

In same time  my other very simple MPU6050 test  code with plain calculation works ok, ( but signals from sensor and not as nice and smooth  as from i2cdevlib )

Is it possible that i2cdevlib for MPU6050 prevent Servo library from work properly ?
5  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: October 29, 2013, 01:58:05 pm
You program seems to be a two dimensional implementation,   what is that ?     I am not sure how quaternions would be useful there.
This is piece of code from original post, this is not my program, I've tried it, and yes, it works for 2D, and I using it for 2D stabilization. I want to have 3D stabilization, so I want to handle z axis as well, just want to add Z axis to listed code.
Lets forget about arcsin(2(q0q2-q1q3)) , this was something I did not know what I was talking about....

Question is simple: So what would be formula to convert Z values from accelerometer output to get angle, similar to
Code:
double accYangle = (atan2(accYval,accZval)+PI)*RAD_TO_DEG;
...in this particular piece of code??

6  Using Arduino / Sensors / Re: Guide to gyro and accelerometer with Arduino including Kalman filtering on: October 27, 2013, 01:28:07 am
Hi guys, please advise how to calculate Z angle within listed code below:

I've tried to play with

arcsin(2(q0q2-q1q3))

but what is q0q1q2q3 within the current given code snippet?


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)
    Wire.begin();
    Serial.begin(115200);

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

    // 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(compAngleX);Serial.print("\t");  
  Serial.print(compAngleY); Serial.print("\t");
  //Serial.print(timer); Serial.print("\t");
  Serial.print("\n");
    
   delay(10);


    
}
7  Using Arduino / Programming Questions / Re: Can I set pins 27, 28 to digital INPUT OUTPUT ? on: April 06, 2013, 10:43:44 pm
Never mind, it was not obvious that physical pins 28,27 are actually IDE pins 19, 18
8  Using Arduino / Programming Questions / Can I set pins 27, 28 to digital INPUT OUTPUT ? on: April 06, 2013, 10:22:56 pm
Having troubles settings 27, 28 to digital INPUT OUTPUT. I want to attach ultrasound sensor, but it just doesnt work.

Code:

int dypOutputPin = 28; // TRIG
int dypInputPin = 27;  // ECHO

....

void setup() {
  pinMode(dypOutputPin, OUTPUT);
  pinMode(dypInputPin, INPUT);
}

void loop() {

  //scan forward USS (ultrasonic sensor)
  digitalWrite(dypOutputPin, LOW);
  delayMicroseconds(2);
  digitalWrite(dypOutputPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(dypOutputPin, LOW);  
  // the distance is proportional to the time interval
  // between HIGH and LOW
  distance = pulseIn(dypInputPin, HIGH,50);
  cm = distance/58;  
  
  Serial.println(cm);
  delay(50);
}



Arduino UNO R3
9  Topics / Robotics / Re: Dagu Rover 5 chassis robot demo on: February 27, 2013, 08:06:08 pm
Thank Nick you for the sample sketch!

I've manage to put together a small rover based on same motor control board and Leonardo.
Only one difference I have 4WD, so I will modify it in order to handle all 4 wheels, if you don't mind.

I solve my problem with JST by just wrapping bare wire around prongs, no pretty by will work for now.
10  Topics / Robotics / Re: Dagu Rover 5 chassis robot demo on: February 27, 2013, 01:00:56 am
Another question:

Any idea what is the type of 4 white JST connectors  for motors? Got the board, trying to connect motors.
11  Using Arduino / Programming Questions / Re: Arduino Leonardo troubles reading from Serial1 on: February 25, 2013, 10:27:36 pm
Finally!!! I got it, apparently Prolific modules doesn't work properly with Leonardo, the very first one on the picture is Prolific as well, not FTDI.
So luckily I had one actual FTDI attached to my MultiWii controller, when I've used that one - now all works!

They actually partially working , writing data from Arduino to PC was fine! But not reading! Crazy... I have no idea why it was so messy with Prolific chip based Ser/USB breakout boards, any ideas?
12  Using Arduino / Programming Questions / Re: Arduino Leonardo troubles reading from Serial1 on: February 25, 2013, 09:27:15 pm
Nope... still messy, now I get something over serial, but what I send not what I receive over Serial1 (COM3), instead of 1 I receive g and so on....
When I switch Putty to work with Serial (COM8) it works perfect....(same settings just different COM port) WTH !? smiley-sad
13  Using Arduino / Programming Questions / Re: Arduino Leonardo troubles reading from Serial1 on: February 25, 2013, 08:46:06 pm
I think I have some breakthrough ! Apparently FTDI module I have doesn't work properly, even It use to work with other setup before ! smiley-sad
I've connected it to Prolic USB/COM adapter and data is coming through.... I was so positive module is ok
14  Using Arduino / Programming Questions / Re: Arduino Leonardo troubles reading from Serial1 on: February 25, 2013, 07:58:56 pm
Tried, still doesn't work here is my sketch:

Code:

int incomingByte = 0;

void setup(){
  Serial1.begin(57600);
  Serial.begin(57600);
  while (!Serial1) {  }
}

void loop()
{
  //Serial1.println(100,DEC);
    // send data only when you receive data:
    while (Serial1.available()) {
      Serial.print("Available");
      if (Serial1.available() > 0) {
              // read the incoming byte:
              incomingByte = Serial1.read();
              // say what you got:
              Serial.print("I received: ");
              Serial.println(incomingByte, DEC);
      }
    }
}

15  Using Arduino / Programming Questions / Re: Arduino Leonardo troubles reading from Serial1 on: February 25, 2013, 07:40:08 pm
Sure, here is my current sketch:

Code:
int incomingByte = 0;

void setup(){
  Serial1.begin(57600);
  Serial.begin(57600);
}

void loop()
{
  //Serial1.println(100,DEC);
    // send data only when you receive data:
    while (Serial1.available()) {
      Serial.print("Available");
      if (Serial1.available() > 0) {
              // read the incoming byte:
              incomingByte = Serial1.read();
              // say what you got:
              Serial.print("I received: ");
              Serial.println(incomingByte, DEC);
      }
    }
}


Swapping RX-TX on Leonardo (0<->1) doesn't help
But when I detach RX-TX  and send characters over to COM9 (FTDI) I see it blinks, if I attach them to Leonardo, and reboot, nothing blinks when I send characters.
Pages: [1] 2