How to add a digital compass to the PPRK

 

Overview

A digital compass can be very useful for mobile robot navigation, especially for a small robot such as the PPRK, which lacks wheel encoders and hence built-in odometry and ded-reckoning. Dinsmore Instrument Co. produce a very low-cost ($14) digital compass, the 1490, which can be easily interfaced to the SV203 board of the PPRK. The compass is shown below:

 

 

Purchasing and technical information

For purchasing information and detailed technical specs, go to the Dinsmore Instrument Co. Digital Compass Sensor page of HobbyRobot.com.

 

Interfacing

The compass provides eight headings (N, NE, E, SE, S, SW, W, and NW), which are encoded in four signal wires (N, E, S, W). Each of the wires is standard TTL open-collector NPN output and can be interfaced to digital input lines via pull-up resistors. For a detailed description of how to interface the compass to digital equipment, see the Digital Compass Application Note from Arrick Robotics.

 

However, the SV203 has no digital input lines instead, it has five analog voltage ports, three of which are already used by the IR sensors. It is still possible to interface the compass to the SV203 by converting the four digital signals into analog voltage and reading this voltage through a remaining analog port. The circuit below is based on a standard resistor-ladder digital-to-analog converter with four bits, with the addition of four pull-up resistors. Although these resistors lead to deviations of the converted voltage from exact powers of two, this circuit only has to encode eight different values for the possible headings, and the choice of resistors in the circuit results in clear separation between the voltages corresponding to different headings.

 

 

 

 

The transistors shown in the circuit are inside the compass only the resistors have to be supplied. The compass has 12 pins:

 

1N, 1E, 1S, 1W Vcc, connect to pin 9 of SV203s port A (J3);

2N, 2E, 2S, 2W ground, connect to pin 10 of SV203s port A (J3);

3N, 3E, 3S, 3W - signal wires, connect as shown above.

 

The location of the pins is shown in the datasheet of the compass (PDF). The output of the resistor ladder, Vout, can be connected either to pin 4 or pin 5 of SV203s port A (J3).

 

Determining compass heading

The encoded compass heading can be read by means of the AD4 or AD5 commands of the SV203 board, depending on whether Vout was connected to pin 4 or 5 of the analog input port A. The range of readings for each of the directions depends on the exact values of the resistors in the circuit, which vary due to manufacturing imprecision, and possibly to noise. The ranges we obtained were (these values may need adjustments for each particular set of resistors):

 

Heading

Low

High

North

149

151

Northeast

37

42

East

97

100

Southeast

78

82

South

197

202

Southwest

163

164

West

181

184

Northwest

115

117

 

 

If you have questions, problems, or suggestions for improving the circuit, please contact me at: daniel.nikovski@cs.cmu.edu

 

This page last modified: March 2, 2001.