View Full Version : Free graphical viewer for the Hitachi HM55B Compass Module

Ken Gracey
05-26-2005, 05:01 AM

Doug and Andy have really put the new Hitachi HM55B Compass Module (http://www.parallax.com/detail.asp?product_id=29123) to good use in our office. Andy is preparing some educational documentation,·and Doug just·designed a neat·viewer utility for the·sensor using Delphi. It works like this:
Program the BASIC Stamp with the HM55B Demo Software.bs2. Or, if you prefer, run the version to calibrate the module as described in the product documentation. Close the DEBUG window to free the serial port. Run HM55B Demo.exe, configure the serial port and click "Run".

We hope you enjoy this neat software. This compass is providing six bits of calibrated resolution.

Ken Gracey
Parallax, Inc.

08-30-2006, 01:09 AM
Hi Everyone,

The graphic tool below is awesome.· I would like to write my own version of the tool in C# and was hoping that someone could point me to the source code (if its available anywhere)...so I can model my new tool similar to this one.· Was this tool written in Delphi ? Just curious...

Also, i'm not sure if this is the right forum to submit a question concerning the Compass chip, but figure I would try in the hopes that someone might be able to help me (or point me in the right direction).

When I use the demo source for the Basic Stamp 2 chip, the compass readings fluxuation and never stay still. I can place my breadboard flat on a table (and not touch it) but yet the compass readings are rather jumpy.

How can I stabilize this ? I'd love to be able to leave it flat and have the readings only jump 1 or 2 degrees in either direction. Right now,· it jumps +/-10 degrees.· Is there any supporting circuitry I can add to minimize this ?

Thanks in advance for any tips.



10-09-2006, 04:24 AM
Hi Ken,

That's a nice piece of software, thank you.

Is there·ANY way (notice I didn't say easy) to keep the debug window open while using the·viewer utility?·I have the USB BS2.

I'm using the debug window to control a few things as well as for other sensor output·values.·I could just use the normal HM55B degree outputs in the debug window but I'd love to be able to use the debug window·AND your viewing utility.


Ken Gracey
10-09-2006, 05:10 AM

If you could connect a second serial port to the BASIC Stamp, and you replace add SEROUT n9600 commands after each DEBUG command to send the same data to a serial port as you did to the blue DEBUG window, then yes. The USB2SER would be an easy way to achieve this without wiring up a second serial port on the BOE. Another way would be to use our RS-232 AppMod, but your PC will need a second serial port (or you need a USB to serial adapter). I think that some of our boards (like the Professional Development Board) have an extra serial port for this purpose, which could be yet a third solution.

Hope this helps.

Ken Gracey
Parallax, Inc.

10-09-2006, 05:52 AM
Thanks Ken,

I'll use one of your suggestions, it will be worth it, accurate and easy to read heading data is pretty important to my project.

I notice you and chris are posting this afternoon. the boss has everyone working on a Sunday during football season.....bummer. :)

Ken Gracey
10-09-2006, 10:20 AM
Well, he is one of our heros at Parallax you know!

If Chris and I find free time we're likely to do the same thing with it: pursue our hobbies! And they're all closely related to what we do at Parallax.·I·don't watch football and I don't think Chris does either.

Or you could say that Chris and I have the same disorder. . .

Ken Gracey
Parallax, Inc.

Chris Savage
10-09-2006, 10:25 AM
Ken is correct…I do not watch sports…I spend my free time programming Parallax Microcontrollers and interfacing them to everything.· It so happens I promised our oldest a customized Digital Alarm Clock with dual crescendo alarms, and I intend to deliver.· So I have been sitting at the bench all day working on this and helping others who are working on their projects as well…

Chris Savage
Parallax Tech Support

Roger Ray
01-25-2007, 11:32 PM
Are there any C/C++ source code examples for PC programs to display data recieved from a BS2 using serial communications? For example, the source code from the application mentioned above?

Ken Gracey
01-25-2007, 11:42 PM
The above example was written in Delphi. I suppose we could open source it, but I'm not sure it would achieve your objectives.

I'm sure others will point out more useful C/C++ resources for serial port interfacing.

Ken Gracey

09-07-2007, 03:19 PM
Could you show the source code for the above example even though its in Delphi?... And is there another way to display data similar to the examlpe other then using Delphi?..... like visual basic?... Thanx in advance

09-08-2007, 11:58 PM
Hi aaron87, I have an add in for the Visual Basic Express serial template which is at this link.


If VB express is what you are using·and you would like some help PM your email and Ill help set it up.

You would need to design your own graphics. The screen shot has a Trackbar that rotates the needle through 360 deg to verify the markings on the graphics, this would be removed once you are satisfied with the layout.

Jeff T.

12-16-2008, 08:32 AM
Mr. Ken or Chris;

Is there any way to connect the Hitachi HM55B with the uOLED-96-Pro or uOLED-128-G1;
and have it display the compass direction as the programs above?

Fernando Gomez

Never compare yourself with anyone else, there will always be someone bigger·or·smaller·than you.

12-16-2008, 10:50 AM
The compass object in the OBEX has a GUI that displays on a TV screen. You could probably get some good ideas from that...

Chris Savage
12-18-2008, 12:23 AM
Sure there is…of course, with the uOLED128-G1 the simplest method I can think of would be to create multiple images of the dial with the needle facing in all possible directions and then write some code to display the image that matches the current direction. You’re not going to get 360 degrees of resolution from the module, however, to simplify what I am saying, let’s assume you could.

Step 1 would be to create an image in a paint program of the unit facing 0 degrees (North). Create 359 more images moving the needle 1 degree each time.

Step 2 would be to download these images to the on-board micro-SD card using the Graphics Composer software.

Step 3 would be to write your own code (maybe based off the demo code) to send the uOLED-128-G1 a command to display the picture corresponding to the current heading in degrees.

Now, myself, I would probably focus on 8 or 16 headings and write the code to call up those images. This is a better option from say, a BASIC Stamp module. Trying to redraw the arrow in real-time from a BASIC Stamp Module would be too slow. If you were using a Propeller chip you could do that, though I might still be inclined to simply use pre-designed images. Of course, the real-time updated image would be more fluid.

Chris Savage
Parallax Engineering