arduino mega and gyroscope (idg500)

Talk about Arduino board, sheilds. Sharing Arduino projects, program, problems, solutions, suggestions..... many more, all are welcome.

arduino mega and gyroscope (idg500)

Postby errieyz » Wed Jun 13, 2012 9:26 pm

How can I get absolute angle from rate gyroscope idg500?already try many option of programming using arduino mega but until now still can't get an angle.anybody please help me if got the solution.
errieyz
Greenhorn
 
Posts: 2
Joined: Wed Jun 13, 2012 9:17 pm

Re: arduino mega and gyroscope (idg500)

Postby robosang » Thu Jun 14, 2012 7:30 am

Really? What is the option you tried?
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: arduino mega and gyroscope (idg500)

Postby errieyz » Thu Jun 14, 2012 10:53 am

1 of the way I used milis() to sample time..this my code

const int analogInPin = A8;
int gout;
float ang_rate;
float gzero = 280;
float sensativity = 0.002;
long abs_ang = 0;
float prev_time = 0.0;
float timer;
float delta_time;

void setup()
{
Serial.begin(9600);
analogReference(EXTERNAL);
//gzero = ((1023/5)*1.36);

}

void loop()
{
timer = millis();
gout = analogRead(analogInPin);
ang_rate = ((gout-gzero)/sensativity);
delta_time = (timer-prev_time)/1000;
abs_ang = ((long)(abs_ang + (ang_rate*delta_time)));
Serial.println(abs_ang);
prev_time = timer;
}
errieyz
Greenhorn
 
Posts: 2
Joined: Wed Jun 13, 2012 9:17 pm

Re: arduino mega and gyroscope (idg500)

Postby waiweng83 » Tue Jun 19, 2012 8:54 am

What is the result you get then?

FYI, using gyro alone will not give you an absolute angle. For this, you will need to combine together with an accelerometer.
Please read this tutorial for more information: http://tutorial.cytron.com.my/2012/01/1 ... lerometer/
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 205
Joined: Wed Apr 15, 2009 2:17 pm


Return to Arduino Based

Who is online

Users browsing this forum: No registered users and 13 guests