0% found this document useful (0 votes)
32 views9 pages

Digi-Compass

The document discusses the development of the Digi-Compass, a modern electronic flux-gate compass designed for various applications, including robotics and navigation. It explains the principles of magnetohydrodynamics and the construction of a flux-gate magnetometer, detailing how it measures Earth's magnetic fields. Additionally, it outlines the interface for connecting the Digi-Compass to a computer, emphasizing its compatibility with standard printer ports and the necessary circuitry for operation.

Uploaded by

sehowa5450
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
32 views9 pages

Digi-Compass

The document discusses the development of the Digi-Compass, a modern electronic flux-gate compass designed for various applications, including robotics and navigation. It explains the principles of magnetohydrodynamics and the construction of a flux-gate magnetometer, detailing how it measures Earth's magnetic fields. Additionally, it outlines the interface for connecting the Digi-Compass to a computer, emphasizing its compatibility with standard printer ports and the necessary circuitry for operation.

Uploaded by

sehowa5450
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 9
TD: oO So ‘THERE 1S NOTHING MORE FRUSTRATING than not knowing where you are go- ing. Consider ancient mariners, ner- vously navigating mysterious waters, unsure of what lay ahead in their travels. They soon learned to read the heavens and were eventually assisted by the mysterious powers of the navi- gational compass. Now consider the modern mobile robot, unsure of where itis going, anxiously prodding with tactile sensors and acoustic rang- ing equipment. It, too, is a little re- lieved by the information contained in its compass system. All of us have probably experienced the utility of a delicately balanced magnetic needle, carefully suspended on a cork floating in water—a most typical compass ex- periment from our grammar school days. Of course modern technology has overshadowed our first experience with the compass. The compass de- sign met a major milestone when the gyro-stabilized_remote-indicating compass was introduced during World War IL, Suddenly, navigation was automated, freeing the pilot from routine maneuvering, But modern technology has further improved on that massive electro-mechanical de- vice, and now there are new, afford- able alternatives for your next robotic project. We introduce our Digi-Compass project. Actually it’s a Radio Shae! electronic flux-gate compass, intend- ed for automobile use, with added circuitry that provides it with an out put that can be fed directly into a personal computer. That makes it suitable for applications such as a computer-controlled model airplane, ‘an automobile navigation assistant, or a video camera that intelligently films your journey. Magnetohydrodynamics The iron-nickel core of our planet ‘generates a weak magnetic field. The phenomenon is due to a large moving and highly conductive liquid mass in arth’s core. The study of magne- tohydrodynamics (MHD) suggests that by applying an electrical current under those canditions, a magnetic DIGI- COMPASS Is your house rotating...what about your computer? THOMAS E. BLACK 0) ite ®& 6961 uIGNIAON B RADIO-ELECTRONICS field is produced (conversely. apply- ing a magnetic field will produce an electrical current). The magnetic field is what causes compasses (0 point North, It should be noted that magni North is somewhat different than true North (due to what's called magnetic declination), and it may even wander overtime. Itis also dependent on your geographical location. You can deter- ‘mine the difference between magn North and truc North by consulting a US Geological Survey (USGS) to- pographical map. True declination is, computed as (Map-indicated declination + (an- nual drift rate x (current date — ‘mappublish date))) ‘There is also a magnetic inclina- tion, which is the vertical component of Earth's magnetic field. Compass accuracy can be severely affected by its horizontal position, so it is impor- tant to keep your compass as level as possible, Flux-gate magnetometer There are a number of different methods used in modern solid-state compasses. but one of the most prac tical is the flux-gate magnetometer. Although the difficulties in building such a device have eliminated by inte- grating an off-the-shelf flux-gate au- tomotive compass into the Digi- Compass, we will discuss the theory behind the device Many magnetic materials exhibit linear magnetization up to a certain flux level. At that point they saturate and lose their magnetic properties t FRONT COMPASS PB oN Tose Re Mog [ts Yrvteczaton san tT nes 1 a ac ba 1 : fn | ee al oe t | Hee a ‘ca | Chae Bancone mE ada] 2078 Erase | ro cose cee Yo ua te TEGRATOR greats uF Bam cone 1 aw aesowen i 7 * : pact t 1 ayor fono _a.cno}0°K FIG. 2—INSIDE THE FLUX-GATE COMPASS, the sine and cosine voltage output to steer an air-core resolver. Soeeese bees sleoae : conta. 72> INPUT / SINE 3 oureur FIG. 1—A TYPICAL FLUX-GATE magne- tometer is constructed by wrapping con- trol, sine, and cosine windings on a torcidial core. Unsaturated magnetic material will pull in magnetic flux lines, whereas saturated material will not (it com- pletely ignores magnetic fields). So, if you gate Earth’s magnetic fields into and out of saturation, they will alternately be concentrated and ig- nored. If you place a sense winding hear your magnetic material, you can measure the strength of Earth’s fields entering or leaving the material. The magnitude of the signal is propor- tional to the Earth's field strength along the axis that has been sensed. AS shown in Fig. I, a typical flux- gale magnetometer is constructed by ‘carefully wrapping control, sine, and cosine windings on a toroidial core (a donut-shaped core made of iron parti- cles), The sine and cosine windings give us quadrature outputs, which are analog outputs that are separated by ‘9 degrees. The torvidial core must be carefully chosen for the proper oh - square” saturation curve. The com bination of materials and winding di- rection prevent the drive current that is induced into the saturation-control winding from being picked up by the sense windings. External circuitry also protects against that condition, which would cause measurement er- rors, Extra windings and circuitry can be added t0 minimize magnetic in- clination—bulky gyro mechanisms contain a similar feature, ‘The two quadrature signals pick up magnetic pulses that are related to the sine and cosine of the surrounding magnetic fields. External circuitry switches the control winding on and off at a low frequency, and the result- ing ratios of the integrated sine and cosine output voltages provide the data necessary to interpret direction. Inside the flux-gate compass, the sine and cosine voltage outputs are used to steer an air-care resolver (see Fig, 2). The resolver consists of a pointer and magnet, both attached toa freely rotating axle. Surrounding the ‘magnet are two coils oriented at right angles with one another. The magnet will align itself with the vector sum of the two magnetic fields generated by the coils, which is a direct product of, the currents applied to them: ee] fore, by varying both the polarity an magnitude of the coil voltages, the axle assembly can be made to rotate a full 360 degrees The compass was intended to be mounted in « environment with some vibration (car, boat, etc.) to aid the movement, as it tends to stick, While sitting on your workbench, the com- pass may have to be tapped occasion- ally while moving the sensor. Fortunately, our digital interface ig- nores the position of the electro-me- chanical movement, so it does. not suffer from that mechanical problem. Digi-compass interface Because the Digi-Compass must have as universal a computer interface as possible, it is designed to be used with an IBM PC or compatible, and communication to the compass oc- curs through the standard LPTI, LPT2, or LPT3 printer ports. The software is provided as a learning tool, and it would not be difficult to adapt the Digi-Compass to any com puter that has four available VO im ‘The two programs available for t Digi-Compass provide both a graphic display of compass direction as well = Cos sig MreRonTa CoMPass +108 ‘sno ympass (cos and si) are use to generate direction- @: 3~-SCHEMATIC OF THE DIGITAL-COMPS fomputer. as a simple text-only display of diree- tional degrees (from 0 to 360), ‘The interface circuitry used to ‘monitor the compass's output is rather simple. All that is required is an Ana- log-to-Digital Converter (ADC) for each compass output. To keep the cost down, only one eight-bit ADC is used, and it is multiplexed between the two outputs. The eight-bit resolu- tion of the ADC is adequate for the chosen off-the-shelf compass, and it Provides more than two degrees of resolution. In order to use a standard IBM-compatible printer port with its limited VO lines, a serial ADC that needs only four VO lines was used (twice as many would be required on a typical eight-bit ADC), ‘As shown by the interface sche matic in Fig. 3, the printer port is connected to the Digi-Compuss inter face circuitry by four opto-couplers. ‘They provide some isolation between he computer and the compass but. 10st significantly, provide a high de~ ree of noise immunity on long cable distances, which can typically exceed 25 feet SIN SIG ITERFACE. Two signals taken from the ted data, which Is then fed intoa The cosisin control line is used to switch between the sine (Y) and the cosine (X) compass output voltages When the control line is high, the cosine voltages are available to the ADC, and when it is low the sinc voltages are available. With cosstv high (cosine mode), the analog switch ICI-c ison and IC- ais off. Op-amp IC2-a is a used as an inverter—a somewhat abstract use for the device. The cosine voltage from the compass is attenuated by R8 and R10 before being passed by ICI-a. It is important to limit the compass volt- ages to less than 5-volts DC, or lis earity will suffer. When cos:sty is low (sine mode), IC1-¢ is off and ICL-a is fon, and attenuation is provided by RID and RIB. Gain control over the switched sig- nal is provided by IC2-b before it is passed t0 1C3 (the TLCS48 ADC), and it sets the minimum voltage up- plied to IC3. However, IC3 could be damaged if the analog input voltage exceeds Ve +0.3 volts DC, but by using 6.8-Volts DC to power the op- amp we have avoided the condition The LM324 op-amp’s output can swing only 10 Vj, ~ L.5-volts DC, so as long as Vyyp) remains at or below 6.8 volts, no trouble will arise. The LM324 output can also go as low as 0 volts, a must for extending the dy- namic range of the input. Be fore- other op-amps will behave differently, so be sure to observe that requirement As mentioned before, the ADC is a serial device. ‘That means that the data, which is in single-bit form, is presented to the host computer over a series of host-provided clock cycles Lis up to the host to repack the data bits into byte form, a process that is pertormed in software, There are con- siderable hardware advantages to using that type of device, but such ADC's are not useful in high-speed applications due to the overhead in handling their data output. The ADC (1C3) requires two ence voltages, a clock. und a select line, The two reference-voltage inputs set the analog input thresholds that result in minimum and maximum dig ital outputs (0 to 255 decimal). As we will see during calibration, RI7 and RI8 are adjusted to set those limits 6961 43QW3AON & RADIO-ELECTRONICS $ x pan Hom || lm cux OMT __J _AED cosisin FIG. 4—THE RS-232 MODULAR JACK ADAPTER is wired as shown here. The capacitor ill tt inside of the adapter. ‘The host then scales the digital num- bers into meaningful units such as “yolts,"* but that doesn’t involve the Digi-Compass Conversion of the input voltage is initiated when the ADC's active-low cs line (chip select) goes low. The ADC then waits for two rising edges and then one falling edge of the cux line before recognizing the cs condition (the delay debounces the cs input). ‘The most-significant bit (D7) then appears on the ADC's pata ourPuT line, The next seven clock pulses shift out the remaining bits, highest to lowest. The computer controls the clock and select line through one of the LPT printer ports, as we men- tioned previously. It is important to note that the data shifted out represents the voltage that was latched during the previous con- version. On the fourth falling edge of the clock the ADC samples the input voltage, which is not available until the next acquisition. That is not a problem if you continuously access the ADC, but in an input multiplexing, mode such as that used in the Digi- Compass, you must always read the ADC twice, throwing out the first ‘measurement. In ideal applications, the TLCS48 ‘can provide conversions in less than 25 microseconds. However, in this project, acquisition is deliberately much longer due to limited band- width of the opto-couplers (war RED. PINs Construction The Digi-Compass interface is suit able for perfboard construction using point-to-point wiring techniques. The prototype is mounted in a plastic en- closure (metal could affect the flux- gate sensor), which is attached to the bottom of the compass and serves asa base. If you mount the interface sepa- rately from the compass. use shielded wiring and keep the cable as short as possible. If you intend to operate the inter- face board more than ten feet from your computer, you should mount ICS and R20 at the computer end, perhaps inside of the DB-25's housing. That may not be necessary, depending on the environment the cable will be in. Be sure to use sockets on the IC's just in case you need to replace one later. The voltage regulator does not need a heatsink, and a 6.8-volt Zener diode can be used instead of the 6.2- volt Zener (D2) and 1N4001 diode (DD) combination shown. Just make sure that you use a 12-volt DC power supply that can deliver at least 750 mA Connecting the interface involves dismantling the compass. Inserting a coin or a masking-taped screwdriver blade into the left and right sides of the bezel’s groove and carefully twist ing will allow the bezel to pop off. OF course you have just violated the com- pass’s warranty, so be sure that it works correctly before you dismantle it, Remember that you are on your < own once you take the compass apart. ‘Once inside the compass, find the ig. 2) on the bezel-mounted circuit board marked e | “JRC3415” or “NIM3415” (R23 is right next to iton the PC board). Pin 7 of that IC is the cossic output and pin Lis the stvsic output. Solder a labeled 10-inch 26AWG wire to each pin, and trim as necessary. Find the 3-pin power connector at the rear of the horizontal PC board. Solder a 22AWG wire for +12-volts DC and one for ground directly to the pins—+12 is the middle pin and ‘ground is the one toward the center of the circuit board (ignore the outer un- used pin), You can double check for + 12and ground, as well as continuity in the newly installed power wires by temporarily plugging in the compass’s factory cigarette-lighter plug and ver- ifying proper voltages. Now you can remove the cigarette-lighter plug and throw it in your junkbox Pass the four new wires out of the compass cabinet through one of the vents on the bottom. Re-assemble the compass, being careful not to crush any wires. Temporarily connect +12 volts to the new power wires, and ver- PARTS LIST All resistors are Yewatt, 5%, un less otherwise specified. Ri-R3, R21—150 ohms R4-RB, R10-R13, R20—1000 ohms Ro, R14—22,000 ohms R15, R19—10,000 ohms FR22—270 ohms, 1/2 watt, 10% R16-R18—10,000 ohms, 15-turn trimmer potentiometer Capacitors C1-C3, CS—10yF, 16 volts, Tantalum C4—100pF. 35 volts, electrolytic C8—470uF ‘Semiconductors IC1—CD4086 quad switch 1C2—LM324 quad op-amp IC3—TLC548 serial ADC 1C4—LM7805 §-volt regulator IGS-IC8—MCT2E opto coupler (Q1—2N2222 NPN transistor D1—1N4001 1-amp, 50-volt diode (see text) D2—6.2-volt,1-watt Zener diode (see text) Other components J1DB25 modular-jack adapter Fi—%-amp fuse iscellaneous: Plastic cabinet (pro totype used 4x 27%e x te inches) 12 VDC 1A power supply, Micronta\ high-accuracy auto compass, wire, sockets, pertboard, etc, ify that both the sine and cosine out- puts vary from about 1.5~7.5 volts as you move the sensor in different direc tions. Do not allow the two outputs to touch each other, power, or ground, and don't be concerned if your com- pass doesn’t quite reach the men- tioned voltages; they may be within a volt or two. ‘The DB-25 connector used for the prototype is actually an KS-232 mod- lar jack adapter; its a male DB-25 connector on one side, and a 6-pin phone jack on the other. The DB-25 side plugs into your computer, and a 6-pin phone cord plugs into the jack side; the other end of the phone cord is wired to the interface circuitry. The green wire is used for + 2, the yellow wire is ground, and the other four are for COS'SIN. CLK, DATA, and set. The prototype’s color coding is shown in Fig. 4, but it doesn't matter as long as you connect the proper points in the interface circuitry to the proper pins of the DB-25 connector. A pho- tograph of the finished adapter is shown in Fig. 5. Don’t forget to install the 470,.F capacitor (C6) inside the adapter. Software Software is supplied in both com- led and ASCII text source code forms, and it is available for free as an archive file (Compass. anc) on the RE- BBS (516) 293-2283. The source code should provide sufficient exam. ples as to the methods used to access and convert the Digi-Compass data. Because of the graphics code ComPass.C, you may find the simpler TEXTCOMPC source much easier to read. The two programs are meant to get you started in developing your own applications. There is a graphics-based program and one that relies strictly on text out- put. As shown in Fig. 6, compass.rxe produces a likeness of « handheld compass. The program requires an EGA graphics adapter and monitor, ora CGA adapter that can display the CGA high-resolution monochrome mode. ‘There are some clever features in- cluded in compass exe. On startup, the program will attempt to automat- ically choose the printer port by exer. ing all of the BIOS configured LPT @: Ifa properly operating compass found, the respective printer port is selected. You can skip that feature by including “LPTI,” “LPT2," or 181 -COPPATS TEST SOREN by Thanen E, Block FIG. 6—THIS IS WHAT YOUR COMPUTER'S SCREEN will look like when oper digital compass. “LPT3” as the only argument to the program. Be sure to input a port name that is installed in your computer, or the program will not execute (appro- priate error messages are echoed). Standard command-line syntax is COMPASS LPTn, where “n” is the printer port desired (1, 2, or 3) The data display in compass exe. provides current acquisition informa- tion. The X and Y values indicate the digitized cosine and sine values from the compass interface. ‘The “angle” value is the number of degrees from North in the clockwise direction. It is interesting to note that North is both 0 and 360 compass degrees, depending ‘on your heading. The “mode™ value shows when you are in the Digital, Analog or Both be changed by pushing or “B™ keys. The digital mode is the default and it plots FIG. 5HERE'S WHAT THE INSIDE of the ‘edapter looks like. ing the the compass needle using geometry based on the X and Y values. It shows compass direction in the form of a pivoting compass needle. The analog mode is capable of displaying both direction and magnitude of Earth's magnetic fields. While in the analog mode, if you rotate the flux-gate sen- sor off the horizontal plane you will see the compass needle length shrink and grow. The longer the needle length, the greater the magnetic field. There is considerable loss in ac- curacy while in the analog mode due to the software method in plotting the needle. The analog mode converts the X and Y values to Cartesian coordi nates based on fixed center. The ac- curacy of the analog mode is only fair at best, but could be improved by optimizing the code. The angle value and the digital mode's compass nee- dle are displayed with accuracy that exceeds the compass’s electro-me- chanical movement. You can display both the digital and analog needles at the same time while in the Both mode. The number of data acquisition averages can be changed by pushing the “keys. When the average is at the minimum value of zero, the X, ¥, and angle values will be somewhat unsteady. The values become in- creasingly more stable as you move to the maximum of thirty-one, but_ac- quisition time will be very slow. The default of four is fine for most of the applications. continued on page 82 6961 L3@N3AON 6 oe DIGI-COMPASS continued from page 51 @ The “port” value shows the cur rently used LPT port. You can switch between the available LPT ports by pushing the “P” key. That is ex- tremely handy while debugging the compass or if you have two compasses attached to your computer. he text-only program, TEXTCOMPEXE, must be used if your display adapter is not compatible with COMPASS EXE. It too will auto-config- ure the LPT port and provide default acquisition averages. You can include the LPT port on the command line as well as the number of acquisition aver- ages to perform (up to 255). To in- clude the average argument, you must include the LPT port argument. Stan- dard syntax is: TEXTCOMP LPTn10, where “n” is the printer port desired (1,2, 0F3), and “10” is the number of averages (0-255). Calibration All adjustments must be made ona flat non-metallic surface, and the compass unit must be calibrated cording to the manufacturer's instrue- tions first. Keep the compass sensor away from the compass display, com- puter equipment, metal objects, etc Any magnetic fields generated by electronic equipment or appliances, or nearby ferrous metals could affect the calibration accuracy of your Digi- Compass. Also, do not use a metal screwdriver to adjust the compass or your adjustments will be mean- ingless; use the supplied non-magnet- ic adjusting tool ‘To run the text-based compass pro- gram, plug the interface into the par- allel printer port of an IBM PC/X'T/ AT. On the command line type TEXTCOMP LPTx™ (where x is @ I, 2, of 3, depending on the port used). Be sure to specily directory paths as required. For example, sup- pose you plugged Digi-Compass into LPT and had textcomrext on a flop- py in the A drive. At the command Prompt, you would type “A:TEX- TCOMP LPTI.” To calibrate the interface unit, ad- just the “max-limit” potentiometer (RIT) to 4.15-volts DC at pin I of IC3, and the “min limit” potentiometer (RI8)to L.15-volts DC at pin 3 of IC3. With the interface unconnected from the computer, carefully direct the flux-gate sensor exactly to the North- east, keeping the sensor perfectly horizontal. Adjust the “gain” poten- tiometer (R16) on the interface so that pin 2 of IC3 is 4.25-volts DC. Aim the sensor up 0 5 degrees towards the North, and then up to degrees to the East, and verify that the voltage does not exceed the adjust- ‘ments—otherwise re-adjust. When aiming the sensor for the S-degree test, ignore all measurements beyond the 5 degrees. With the Digi-Compass interface connected to the computer and ‘TexTCOMPEXE running. verify that at the Northeast direction, when the X and Y readouts match (+ 2), that the highest value is 220 (+ 5). Adjust R17] to set the highest value. Next, verif that at the Southwest direction, when the X and Y readouts match (+2), that the lowest value is 30 (+5). If necessary, adjust RIS on the interface to set the lowest value, Now go hack and recheck those steps, as they are interactive. Verify that the compass readings match the computer's read- ‘outs while in the “digital” mode. The Digi-Compass interface is now ad- justed RE ie Certain errors made their way into the Digi-Compass story (Ra- Electronics, November, 1989), In the schematic of Fig. 3, the la- bels Vocand Vj, should be tran: posed, and V,,, should be 6.8 volts instead of 6.5. Also, the two voltages are outputs, and should therefore have open circles in- stead of arrows. The labels for pins 2and 3 of IC3 should also be trans- posed; pin 2 is ivr and should be connected to IC2 pin 7, and pin 3 is Ree and should be connected to 1C2 pin 8. On page 5, in the right- hand column toward the botiom of the page, the text states that “the number of data acquisition averages can be changed by push- ing the ,,” keys.” It should have read "by pushing the “>” and “=" keys.” And, last, on page 82, “TEX- TCOMPLPTNI0” should contain spaces between arguments; it hould be written as "TEXTCOMP Tn 10.”—Editor RE DIGI-COMPASS PARTS I've heard from a number of “Digi-Compass” builders (Radio- Electronics, November 1989) that the TLC-543 ADC IC is impossible to find, It has been discontinued by Radio Shack, although its pos- sible that some stores may have still have a lew available (part #276-179%, $6.95). AS a special service to Radio- Electronics readers, | will supply the part for $6.95. Those who don’t want to download the software file can also purchase that trom me, for $6.00. (That might be cheaper than downloading the 100K file at 1200 baud from the RE BBS) It will be supplied on a 360K PC data flop- py diskette. To order, please send a check or money order only (California resi: dents add 6.5% sales tax) plus $1.75 shipping and handling to Digital Products Company, cio Thomas E. Black, 134 Windstar Circle, Folsom, CA 95630. This offer is subject to change and is valid fora short time only. Thanks for publishing my arti- cle. I'm thrilled that it has stirred up some interest. THOMAS F. BLACK Folsom, CA

You might also like