i am looking forward to buy a compass for my Robot that is avaialable on Compass Module - HMC6352 - SEN-07915 - SparkFun Electronics
can i connected it to arduino easily
i am looking forward to buy a compass for my Robot that is avaialable on Compass Module - HMC6352 - SEN-07915 - SparkFun Electronics
can i connected it to arduino easily
Connecting to Arduino is just about as easy. The I2C pins on the Arduino are A4 and A5.
actually i have heard that it works on initial Point and what is that for a comapass
Nope, again, I don't understand what you're asking
I mean to say that how compass HMC6352 works
cutebuddy6:
I mean to say that how compass HMC6352 works
It works like this: http://www.sparkfun.com/datasheets/Components/HMC6352.pdf
I'm guessing Hall Effect and some serious amplification
how to use it for navigation or what are the possible cases that i have to deal when using a compass
i mean to say that what are the difficulties that i am going to face in using the this model of the compass.
Magnets (like those found in motors) and big lumps of ferrous metal are the main difficulties, I'd say.
Well i want to buy it but i am afraid if it does not work with my navigation code
Well i want to buy it but i am afraid if it does not work with my navigation code
Have you posted your navigation code?
not yet but i am using the following code for My navigated Power wheels here is the Code that i am using
#include <nmea.h>
#include <LiquidCrystal.h>
// create connection to GPRMC sentences from my GPS
NMEA myGPS(GPRMC);
// create LCD object (I use a 2x16 character display)
LiquidCrystal myLCD = LiquidCrystal(13,14,15,2);
// my destination coordinates in signed degrees-decimal
float dest_latitude = 52.090649;
float dest_longitude = 5.121322;
void setup() {
Serial1.begin(4800); // my GPS is connected to port Serial1, at 4800bps
pinMode(48, OUTPUT); // diagnostic led on Wiring-board
myLCD.clear();
myLCD.home();
myLCD.print("GPS-NAV TEST 001");
delay(1000);
}
void loop() {
// check if data from GPS available on Serial1 port
if (Serial1.available() > 0 ) {
// check if full sentence recieved from GPS
if (myGPS.decode(Serial1.read())) {
// if so, set status led on
digitalWrite(48, HIGH);
// calculate direction to destination, relative to my own direction of movement
float dir = myGPS.gprmc_course_to(dest_latitude, dest_longitude) - myGPS.gprmc_course();
if (dir < 0) { dir += 360; }
if (dir > 180) { dir -= 360; }
// display relative direction to destination
myLCD.clear();
myLCD.home();
if (dir < 0) {
myLCD.print('<'); // destination is to your left
} else {
myLCD.print('>'); // destination is to your right
}
myLCD.print(abs(dir), DEC);
myLCD.print(223, BYTE); // print °-character
// display distance to destination in meters
myLCD.setCursor(6, 0);
myLCD.print("DIST:");
myLCD.print(round(myGPS.gprmc_distance_to(dest_latitude, dest_longitude, MTR)),DEC);
myLCD.print("m");
// display my speed in kilometers per hour
myLCD.setCursor(0, 1);
myLCD.print("SPEED:");
myLCD.print(round(myGPS.gprmc_speed(KMPH)),DEC);
myLCD.print("Km/h");
// display GPS positioning status ('A'=active, 'V'=void)
myLCD.setCursor(15, 1);
myLCD.print(myGPS.gprmc_status());
// set status led off
digitalWrite(48, LOW);
}
}
}
but it shows varying in Direction through GPS EM406a i am afraid if it does the same in Compass
The compass should work with your navigation code if you put the compass heading in place of myGPS.gprmc_course().
but the problem is that i am getting the variation in my output direction is continuously varying because of the change in lat\long from my GPS
cutebuddy6:
but the problem is that i am getting the variation in my output direction is continuously varying because of the change in lat\long from my GPS
Please explain.
the output of the GPS on the LCD is continuously varying
--->the direction is varying
the output of the GPS on the LCD is continuously varying
By how much? Apparently you still don't have your GPS working right.
well its the three last digits are varying using NMEA library
and direction can't be Judged it some time shows 270 and some 8 degree using GPRMC.course() so thats why left right cant be judged
well its the three last digits are varying using NMEA library
Which means that the actual position is varying no more than a few feet.
and direction can't be Judged it some time shows 270 and some 8 degree using GPRMC.course()
Then, you are doing something wrong, or there is a bug in the course() function. A few feet variation in position is to be expected. That should not, though, cause massive changes in direction, unless you are (nearly) on top of your destination.
If you are, then course() will bounce around. Of course, if you are (nearly) on top of your destination, you should stop.