Penguin Compass Calibration
Calibrating Penguin's Compass
Tips n Techniques for Penguin's HM55b
Penguin's HM55b compass is on pins 13, 14, and 15.
There's 2 compass calibration programs. You can do some calibrating or checking with both. Print out the compass calibration sheet to do the calibrations. This has nothing to do with the computer screen other than following the debug suggestions for moving the Penguin incremental degrees during the calibration process.
Penguin uses the Hitachi HM55B IC
http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/ProductID/98/List/1/Default.aspx?SortField=UnitCost,ProductName
Calibration Documentation
Hitachi HM55B Compass Documentation (.pdf)
Hitachi HM55B Compass Module Source Code (.zip)
Penguin Documentation
http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/penguin/List/0/SortField/4/ProductID/435/Default.aspx
PenguinDoc-v1.4 (.pdf)
Avoid Magnetic Fields
Make certain Penguin is not by any magnetic fields that may affect its compass during calibration. This includes the computer, large motors, various machines, magnets, electrical and metal objects..Extend Penguin on its USB cord away from the computer to a maximum distance.
Plumb your Penguin
To get good compass values, please realize the compass is not at the center of the Penguin. So all your moving around Penguin is probably off to begin with. You need to locate the compass on the board, drop a plumb bob down and note that gravity will take it to the center point on the desk (must be leveled first) upon which all calibration movement is based upon. Otherwise, all those compass calibration efforts are in naught.
http://en.wikipedia.org/wiki/Plumb-bob
A plumb-bob or a plummet is a weight, usually with a pointed tip on the bottom, that is suspended from a string and used as a vertical reference line, ...
Penguin Compass Programs
Finally, after a good calibration, you need some compass programs. Try these:
http://www.p-robot.com/index.php/navigation-and-movements.html
http://www.p-robot.com/sources/Directions.zip
Penguin Scout Compass
Penguin Screen Compass
Penguin Sound Compass
Penguin Scouting Feet *
*Programs may require servo calibration
using the Penguin Humanoido Suite of programs..
and my favorite program
Penguin Radio
http://www.p-robot.com/index.php/sounds-and-music.html
http://www.p-robot.com/sources/SoundsMusic.zip
and check Parallax Penguin Demos
PenguinCode-v1.3 (.zip)
New RevB Penguins
(According to Parallax) 3.5. OPTIONAL COMPASS CALIBRATION
To improve the accuracy of the compass, the calibration routines for the Hitachi HM55B Compass Module have been ported to the Penguin. With the calibrated compass routines added to the Penguin's control code, extra RAM and code space is required. Separate versions of the following programs have been created to allow for either more available resources or a more accurate compass.
Code Incorporating a Calibrated Compass
Penguin-CompassTest.bpx Penguin-CalibratedCompassTest.bpx
Penguin-AutonomousNavigation.bpx Penguin-AutonomousNavigation-CalibratedCompass.bpx
Penguin-MigrateNorth.bpx Penguin-MigrateNorth-CalibratedCompass.bpx
Before the calibrated compass routines can be used, Penguin-CompassCalibration.bpx must be run to record the compass calibration data. For more information about compass calibration, please read the product documentation and the associated code available from the #29123 product page at www.parallax.com.
3.6. OTHER HELPFUL DOCUMENTATION
The following materials are helpful documents for programming the Penguin; each can be downloaded from its associated product page:
BASIC Stamp PBASIC Syntax Guide (on-line version of help file installed with the BASIC Stamp
Windows Editor)
HM55B Compass Documentation (#29123)
HM55B Graphical Viewer for the HM55B (#29123)
Smart Sensors and Applications (a Stamps in Class Text) (#28029)
IR Remote for the Boe-Bot Text (a Stamps in Class Text) (#70016)
Ping))) Ultrasonic Sensor Documentation (#28014)
Compass Test Code from Parallax
Tips n Techniques for Penguin's HM55b
Penguin's HM55b compass is on pins 13, 14, and 15.
There's 2 compass calibration programs. You can do some calibrating or checking with both. Print out the compass calibration sheet to do the calibrations. This has nothing to do with the computer screen other than following the debug suggestions for moving the Penguin incremental degrees during the calibration process.
Penguin uses the Hitachi HM55B IC
http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/ProductID/98/List/1/Default.aspx?SortField=UnitCost,ProductName
Calibration Documentation
Hitachi HM55B Compass Documentation (.pdf)
Hitachi HM55B Compass Module Source Code (.zip)
Penguin Documentation
http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/penguin/List/0/SortField/4/ProductID/435/Default.aspx
PenguinDoc-v1.4 (.pdf)
Avoid Magnetic Fields
Make certain Penguin is not by any magnetic fields that may affect its compass during calibration. This includes the computer, large motors, various machines, magnets, electrical and metal objects..Extend Penguin on its USB cord away from the computer to a maximum distance.
Plumb your Penguin
To get good compass values, please realize the compass is not at the center of the Penguin. So all your moving around Penguin is probably off to begin with. You need to locate the compass on the board, drop a plumb bob down and note that gravity will take it to the center point on the desk (must be leveled first) upon which all calibration movement is based upon. Otherwise, all those compass calibration efforts are in naught.
http://en.wikipedia.org/wiki/Plumb-bob
A plumb-bob or a plummet is a weight, usually with a pointed tip on the bottom, that is suspended from a string and used as a vertical reference line, ...
Penguin Compass Programs
Finally, after a good calibration, you need some compass programs. Try these:
http://www.p-robot.com/index.php/navigation-and-movements.html
http://www.p-robot.com/sources/Directions.zip
Penguin Scout Compass
Penguin Screen Compass
Penguin Sound Compass
Penguin Scouting Feet *
*Programs may require servo calibration
using the Penguin Humanoido Suite of programs..
and my favorite program
Penguin Radio
http://www.p-robot.com/index.php/sounds-and-music.html
http://www.p-robot.com/sources/SoundsMusic.zip
and check Parallax Penguin Demos
PenguinCode-v1.3 (.zip)
New RevB Penguins
(According to Parallax) 3.5. OPTIONAL COMPASS CALIBRATION
To improve the accuracy of the compass, the calibration routines for the Hitachi HM55B Compass Module have been ported to the Penguin. With the calibrated compass routines added to the Penguin's control code, extra RAM and code space is required. Separate versions of the following programs have been created to allow for either more available resources or a more accurate compass.
Code Incorporating a Calibrated Compass
Penguin-CompassTest.bpx Penguin-CalibratedCompassTest.bpx
Penguin-AutonomousNavigation.bpx Penguin-AutonomousNavigation-CalibratedCompass.bpx
Penguin-MigrateNorth.bpx Penguin-MigrateNorth-CalibratedCompass.bpx
Before the calibrated compass routines can be used, Penguin-CompassCalibration.bpx must be run to record the compass calibration data. For more information about compass calibration, please read the product documentation and the associated code available from the #29123 product page at www.parallax.com.
3.6. OTHER HELPFUL DOCUMENTATION
The following materials are helpful documents for programming the Penguin; each can be downloaded from its associated product page:
BASIC Stamp PBASIC Syntax Guide (on-line version of help file installed with the BASIC Stamp
Windows Editor)
HM55B Compass Documentation (#29123)
HM55B Graphical Viewer for the HM55B (#29123)
Smart Sensors and Applications (a Stamps in Class Text) (#28029)
IR Remote for the Boe-Bot Text (a Stamps in Class Text) (#70016)
Ping))) Ultrasonic Sensor Documentation (#28014)
Compass Test Code from Parallax
' Parallax Penguin Robot ' Penguin-CompassTest.bpx ' {$STAMP BS2px} ' {$PBASIC 2.5} Compass PIN 15 ' Transceives to/from Din/Dout Clock PIN 13 ' Sends pulses to HM55B's Clock Enable PIN 14 ' Controls HM55B's /Enable Reset CON %0000 ' Reset command for HM55B Measure CON %1000 ' Start measurement command Report CON %1100 ' Get status/axis values command Ready CON %1100 ' 11 -> Done, 00 -> no errors NegMask CON %1111100000000000 ' For 11-bit negative to 16-bits x VAR Word ' x-axis data y VAR Word ' y-axis data Heading VAR x ' Store Heading measurement status VAR x ' Status flags DEBUG CLS, "Heading:" DO GOSUB ReadCompass DEBUG CRSRXY, 9, 0, DEC Heading, "° " PAUSE 150 LOOP ReadCompass: ' Compass module subroutine HIGH Enable ' Send reset command to HM55B LOW Enable SHIFTOUT Compass, Clock, MSBFIRST, [Reset\4] HIGH Enable ' HM55B start measurement command LOW Enable SHIFTOUT Compass, Clock, MSBFIRST, [Measure\4] status = 0 ' Clear previous status flags DO ' Status flag checking loop HIGH Enable: LOW Enable ' Measurement status command SHIFTOUT Compass, Clock, MSBFIRST, [Report\4] SHIFTIN Compass, Clock, MSBPOST, [Status\4]' Get Status LOOP UNTIL status = Ready ' Exit loop when status is ready SHIFTIN Compass,Clock,MSBPOST,[x\11,y\11] ' Get x & y axis values HIGH Enable ' Disable module IF (y.BIT10 = 1) THEN y = y | NegMask ' Store 11-bits as signed word IF (x.BIT10 = 1) THEN x = x | NegMask ' Repeat for other axis Heading = x ATN -y ' Convert x and y to brads Heading = Heading */ 360 ' Convert brads to degrees RETURN
Comments
On another note, whilst I am not worthy to contradict you on anything Penguin I would have to question the necessity of using a plumb bob to get the onboard compass directly over the compass rose on the desktop before calibrating. If you were walking along with a compass in your hand it wouldn't matter whether it was in your right hand, left hand or on a stick 20 feet behind you, the magnetic force on the compass and therefore its reference to you would be exactly the same. I have "swung" many a ships magnetic compass by traveling in a huge circle (and using a portable mechanical gyro compass as reference). However maybe this does not translate to micro electronics?
The compass is only on pins 4, 5, and 6 as an example in the compass manual, if you only have the Hitachi compass separately. However, since the compass is built in to the Penguin, the pins are already predetermined. I just successfully calibrated my compass tonight and the only thing I used from compass manual was page 3 in the Quick Start section (it is the page with the huge compass on it). Once you have that page printed out you need to line the paper up with magnetic north based on your location. Then take your penguin and place it on the paper.
The two programs I used to calibrate the penguin's compass were from the Penguin Parallax page
http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/penguin/List/0/SortField/4/ProductID/435/Default.aspx
Download the PenguinCode-v1.3.zip file
Run: Penguin-CompassCalibration-v1.3 - follow the prompts in the program (I used the IR Detector and the USB connection to line up the penguin to the printed out compass and got great results, then
Run: Penguin-CalibratedCompassTest-v1.3 - you should see that your penguin give fairly accurate compass directions +/- a degree or two.
I notice from the "Review your Calibration Settings" option on the calibrate program that the "Actual" degrees varies from about 303 to 243 with no correlation to the "Ideal" heading. Is there any way to manually enter the "actual" degrees and fudge the compass into giving correct values or is that not going to help?
The compass has worked well in all my Penguins - the many programs written for it have comments regarding accuracy. The 18-Band Radio was written for 20 degree channels which worked best for this application and you can read comments here:
http://forums.parallax.com/showthread.php?100136-PENGUIN-ROBOT-18-Band-Radio!!!!-the-Code
Prep the calibration area
A good tip is to use a simple analog compass to "explore"
the surrounding region and note any deviations in the
needle direction readings.
http://forums.parallax.com/showthread.php?130432-Penguin-Servo-Twitch&p=985446#post985446