Sie sind auf Seite 1von 6

Email: Visit us at http://www.sunrom.


Document: Datasheet

Date: 6-Jun-12

Model #: 1172

Products Page:

Magnetic Compass/Pressure/Altitude/Temperature Sensor

This sensor measures Direction, Atmospheric Pressure, Temperature and Altitude and outputs in simple serial data, which can be viewed on PCs terminal software at 9600 bps or read into Microcontrollers for further processing. Compass data can be used for direction finding. It is a digital magnetic compass, which can be used to detect deviation from magnetic north pole (heading). This compass uses orthogonal two-axis magnetic sensor. The atmospheric pressure reading is converted to read the altitude of the sensor, as the environment pressure decrease as altitude increases with simple equation.

Fast response time / Simple 5V Supply & Interface Serial Data output at 9600 bps Atmospheric Pressure from 300-1100 milibars Realtime Magnetic Compass Data Temperature from -20 deg C to +60 deg C Altitude above sea level output

Navigation Systems, Automatic Direction Finding Robots Digital Electronic Compass Design Weather Stations / Environment Monitoring Environment Surveillance Position Sensing / Vehicle Detection

Parameter Supply Voltage Supply Current Temperature Range Pressure Range Magnetic Field Range Pin +5V DC 20 mA -20 to + 60 deg C 300-1100 milibars +/- 2 guass Notes Supply voltage greater than +5.5V will damage the sensor Degree Celsius

Understanding Magnetic Compass readings

The module outputs X and Y data of the direction. When we rotate the sensor full 360 direction and take that data into excel sheet we get below results. Then we select and plot that data into scatter type graph. This data tells us how position X and Y relates to our rotation of sensor.

Excel showing graph of X, Y data during rotation of sensor

Custom Software using the X,Y Data from sensor in realtime

Magnetic Compass part is made by use of Memsic MMC2120MG magnetometer chip. Details about the IC and its application notes can be found here

Sunrom Technologies

Your Source for Embedded Systems

Visit us at

Understanding Pressure Unit milibar

Atmospheric air pressure is often given in millibars where "standard" sea level pressure is defined as 1013.25 mbar (hPa). Despite millibars not being an SI unit, meteorologists and weather reporters worldwide have long measured air pressure in millibars. After the advent of SI units, some meteorologists began using hectopascals (symbol hPa) which are numerically equivalent to millibars. 1 hpa=1 milibars.

Module Connections
Pin# 1 2 3 Pin GND TXD +5V Name Ground TRANSMITUART +5V DC Supply Type I/O Ground Output 5V level Positive Supply Details Power Supply Ground Serial Data of 9600 bps, 8 bit data, no parity, 1 stop bit Power Supply Positive

Output from sensor is Serial Data at 9600 bps at 5V level. You can also use the serial data to interface to PC using MAX232 level convertor for serial port or use USB-TTL chip to get a virtual serial port on PC to which many software like Hyperterminal can be connected. Custom software can also be made to monitor the incoming data. You can also use serial interface directly with a microcontroller when you have a dedicated serial input pin available on your application to get the data for display or processing.

Serial Data Output Format

When you see data output from chip in serial at 9600 baud rate, you will get total forty five bytes output containing reading of temperature, pressure, altitude and XY of compass. This data is output every second in ASCII format so you can view it on screen. Let us see what data output you will get in serial mode. The last byte in serial mode is new line character so that when you see this data in terminal you can see each new data in new line. Example Output of Serial in terminal software: Terminal log file Date: 6/6/2012 - 11:44:43 AM ----------------------------------------------P:0990.77Hpa T:0037.40C A:195m X:2114 Y:1960 P:0990.75Hpa T:0037.41C A:195m X:2114 Y:1960 P:0990.85Hpa T:0037.42C A:195m X:2115 Y:1960 P:0990.86Hpa T:0037.41C A:195m X:2115 Y:1961 P:0990.81Hpa T:0037.42C A:195m X:2116 Y:1960 P:0990.84Hpa T:0037.40C A:195m X:2116 Y:1960 ----------------------------------------------End log file Forty five bytes output consist of one new line characters and 44 reading characters. 44 bytes of Reading, ASCII text 0x0D End of Reading, New Line Character

Sunrom Technologies

Your Source for Embedded Systems

Visit us at

Terminal software
We recommend this software which can be used two receive serial data for testing purpose on PC side. Download it from

Receive Window

Sunrom Technologies

Your Source for Embedded Systems

Visit us at

Connecting Sensor to Serial Port

If you wish to interface the module with RS232 level like a PC serial port or any other device you need a level convertor such as MAX232 as shown below since the sensor level out is of 5V while RS232 works on +/-12V levels for data transmission. If you connect sensor directly to serial port, it will damage the sensor due to high voltage. That is the reason MAX232 is required if interfaced with serial port.
+5V U12 Sensor GND TXD +5V 11 9 12 10 + C13 10uF 16V 1 3 2 + C14 10uF 16V C16 100n U6 MAX232 16 14 8 13 7 4 5 6 C15 Max232 10uF 16V + C12 10uF 16V P2 DB9-CONN-FEMALE 1 6 2 7 3 8 4 9 5


1 2 3




You can also use our Board Model 1104




Interfacing to USB Port and Powering from USB Port

Since the output of sensor is at 5V level, you can directly connect to USB-TTL UART boards to get data to PC. More over USB also supplies power to the sensor. So no external power is required. It will appear as virtual serial port on PC to which you can communicate through any software which can receive by this serial port like hyperterminal or custom made software. You can use our USB to Serial Board Model 1151

U10 Sensor GND TXD +5V

U11 USB Communication Board SUNROM#1224


Sunrom Technologies

3 2 1

Your Source for Embedded Systems


1 2 3

Visit us at

Interfacing to MCU
AT89S52s RXD pin is used to receive serial data from sensor. You can use any microcontroller to interface using this interface. We have chosen AT89S52 to show here since it is more widely used but can be any 8051 MCU or other MCU. The interfacing with microcontroller is show shown below, The sensor level is 5V data so directly connected to Microcontroller RXD pin.


U4 Sensor +5V TX-OUT GND VCC 3 2 1 C1 100n P2.0/A8 P2.1/A9 P2.2/A10 P2.3/A11 P2.4/A12 P2.5/A13 P2.6/A14 P2.7/A15 P3.0/RXD P3.1/TXD P3.2/INT0 P3.3/INT1 P3.4/T0 P3.5/T1 P3.6/WR P3.7/RD 21 22 23 24 25 26 27 28 10 11 12 13 14 15 16 17 29 30

U2 AT89S52 39 38 37 36 35 34 33 32 1 2 3 4 5 6 7 8 VCC + C8 10uF 16V R1 10K 31 P0.0/AD0 P0.1/AD1 P0.2/AD2 P0.3/AD3 P0.4/AD4 P0.5/AD5 P0.6/AD6 P0.7/AD7 P1.0/T2 P1.1/T2EX P1.2 P1.3 P1.4/SS P1.5/MOSI P1.6/MISO P1.7/SCK EA/VPP






C9 33p


Dimensions in mm

Sunrom Technologies

Your Source for Embedded Systems

Visit us at