Introduction
Last year I saw an article on Engadget on the Haptic Compass Belt, since then I have wanted to make one. Finally a year after having half the components, I decided to design and build one.
For those intersted in what this project is, and more importantly what the point of it is, see these links:
http://www.engadget.com/2009/02/09/haptic-compass-gives-you-sense-of-direction-not-style/
This is the original Wired article which goes into more detail:
http://www.wired.com/wired/archive/15.04/esp.html
Features
All of the Compass Belts I have seen build so far have been quite large and intrusive, normally with separate battery, I wanted to design one which was as small as possible, internal power and easy to charge.
I decided to build around the AT90USB162 AVR from Atmel, this allows code update via USB, which I can also use for charging.
- Small size (45mm x 35mm x 10mm)
- Light weight (electronics + battery) – 30 grams
- AT90USB162 AVR @ 16MHz (clocked to 2MHz)
- 960 mah Lithium Ion Battery
- Li-Ion charging through USB
- HM55B Compass module
- 2 LEDS
- RS232 connection
- Support for 8 motors
Design
Below is the circuit design. I decided to use the ‘1.5 layers’ technique, this means all the traces are on one layer, with only Ground on the bottom layer – this make it much easier to etch as you don’t have to worry about printing/developing/aligning 2 sides.
Notes: The values of components on the schematic may not be accurate. The Data+/- for the USB are not routed, these were wired up.
These are the main components:
- AT90USB162
- HM55B compass module
- MAX1551 – Li-Ion charger
- ULN2803 – NPN transistor array
- 16 MHz chrystal
- TPS73033DBVT 3.3 regulator
- Switch
- Pager Motors
I produced the board using Photo Etching FR4, briefly the steps involved are:
- Print onto translucent paper using a laser printer (print inverted!)
- Exposed the PCB using UV light
- Develope the PCB using special solution
- Etching in acid
I used a 2 layer board, but as mentioned above the bottom layer is only a ground layer, so does not need to be etched (leave protective plastic on).
Above shows the components soldered to the board. I removed the pins to the compass module and attached it to the pads on the board.
The HM55B is supposed to be powered by 5v, the circuit is 3.3v so I bypassed the onboard regulator.
Software
The software is written in assemblyon the AVR. It needs to read data from the HM55B, perform calibration, calculate the angle, control motors.
In order to calculate the heading arctan needs to be calculated, to do this on the AVR I made a lookup table. The table only needs to cover 0 to 45 degrees.
I created the table so the heading would be calculated 0 – 255, instead of 0 – 360. This make its much easier to perform calculations on an 8bit micro.
For n = 0 to 255 ARCTAN_LOOKUP[n] = arc-tan(n/255) * (180/pi) * (255/360) Next
This makes a lookup table of 256 elements covering 0 to 45 degress (values 0 to 32).
To calculate the angle:
ARCTAN_LOOKUP[(Y * 256) / x] (for Y less than X)
64 - ARCTAN_LOOKUP[(X * 256) / Y] (for X less than Y)
Then use the sign of X and Y to find the quadrant. Notice I use a 16bit divide routine, this is the only expensive operation.
Calculating the offsets.
When using the compass module, I found there was often an offset on the X and Y values, this makes the heading calcuation very inaccurate and must be removed. Also, the module is very senstive to angle, and it would give wild results if not calibrated. I found finding the X and Y offsets for a given angle increased the accuracy.
For this reason, when the belt is turned on, you need to do some calibration. This works by going into a loop monitoring X and Y from the HM55B, and continually updates the Max and Min values of X and Y it sees, the user must spin round about 2 or 3 times so the Max and Min can be established.
The Belt
I used a black leather belt to attach the motors and wires, admittedly it does not look very neat, but because it is mostly black other people would not notice it on! I used velcro for the circuit and battery, so it can easily be removed.
Files
Results
It works as expected, I have only been wearing it for a couple of days, so will need to give it longer for proper results.
Please feel free to ask any questions you may have!