Compass, Tilt/Roll and Temperature sensor applications with the TD-CMP modules.


Original document from


Digital compass


This page will show you how to use the TD-CMP modules in a way which fits you most.


Here are the technical specifications of the modules:

  • Compass: Resolution: 1░ - Accuracy: 3░
  • Tilt/Roll: (TD-CMP02 and TD-CMP03 only) Resolution: 2░ - Accuracy: 5░
  • Temperature: (TD-CMP03 only) Resolution= 1░C/F - Accuracy =1░
  • Sampling rate: once a second.
  • Easy Tilt/Roll calibration.(TD-CMP02 and TD-CMP03 only)
  • Interfaces: I▓C, RS232 and mini-USB (as a HID device: PID=0461, VID= 1023)
  • Powered by USB bus or an external 5V.
  • Direct LCD readout possible. LCD contrast by user.
  • Low power LED blinks when facing North/East/South/West.
  • USB Windows application (written in C#) available for free download.)
  • Source code (CCS C and C# .NET) and schematics (Eagle) can be purchased separately.
  • Module software is 100% upgradable with a simple bootloader.
  • PCB Dimensions: 40 x 41 mm or 1"57 x 1"61, weight: 10 grams.


These modules are available from our online shop. Last update: September 25, 2006.

Download the specifications here: 023-TD-CMP_Specs.pdf


Main Connections:

Module diagram

Header pinouts

Digital compass
  JP2 pins RS232  

JP3 pins

  1 +5V   1 +5V   1 EXT (from JP3)
  2 RX   2 SCL   2 COMMON
  3 GND   3 SDA   3 USB
  4 TX   4 GND / TEMP SENSOR -      
        5 ADJUST      
        6 TEMP SENSOR +      
  * Note: pin 1 is marked by red in the diagram

Power Source: JP4: Connect pin 2 to pin 3 to power with the USB bus. Connect pin 1 to pin 2 when powered externally via JP3, pin 1.

LCD contrast Adjust: Connect pin 5, JP3 to +5V before powering up. Release when the desired the contrast is reached.

Tilt/Roll Calibration: (TD-CMP02 and TD-CMP03 only): First place the module on a completely flat surface, then apply +5V to ADJUST (pin 5, JP3)

Module RESET: apply GND to MCLR pin.

Temperature sensor: (TD-CMP03 only): The external LM335Z sensor connects to JP3 pin 4 and 6. No temperature will be displayed when the sensor is removed.

RS232 interface: JP2 provides the interface to connect to your COM port and hyper terminal. Also used for bootloading (module software update.) Check under the download section below for the latest version. Bootloading of the HEX-file can be done with Tiny Bootloader 1.91

I▓C interface: JP3 allows us to connect to another ÁC. The module is the slave device on address 0xa0. It can be read via a simple EXT_EEPROM command. Download this I▓C CCS C example to see how to connect I▓C with a 18F452. Don't forget to change the POWER SOURCE (JP4) and connect pin 1 to pin 2.

Internal 8 bit registers are:

Reading the module (ccs c code):

USB interface: is HID (Human Interface Device) on PID=0461, VID= 1023 Each packet is 8 bits long (4 bytes address and 4 bytes data.)

Low power LED: Will light up shortly when USB is connected and enumerated. Also the LED will blink several times, according to the capital direction it is facing:


Downloads: right-click & save as

  WARNING: may not be duplicated for any commercial use whatsoever without explicit consent from the author (c) Michel Bavin, TechDesign Electronics.

 Windows Example program setup: 023- TDCMP setup.msi  - September 25, 2006. Written in C# Visual Studio .NET

Important Note: You need to have Microsoft .NET Framework 1.1 (or higher) installed to get the executable running.

 I▓C Connection CCS C Source Code:  - May 18, 2006. Connects a 18F452 to the TD-CMP module using I▓C to read data.

 TD-CMP02 Module HEX: 023_v28.HEX  - September 25, 2006. Can be bootloaded to the module through the RS232 port (JP2) and Tiny Bootloader 1.91


 Module PIC CCS C Source Code, Schematics, C# code : not released, but you can buy a license on our Products page.


Info & datasheet:

Graphic LCD module type LPH7779 (NOKIA 3310 LCD) 48*84 pixels and its integrated controller PCD8544.


C# Windows Example Program

Digital compass


The PIC code was made with the PCWH CCS compiler ($425,-); you can install Microchip's MPLAB IDE (click on the link and you can get it for free) with it to get things running smoothly.

Bootloading of the modules is done with the excellent Tiny PIC bootloader, through RS232 (JP2).

Eagle 4.11e was used for the schematic & PCB layout. 


[ FREE Ham Radio Data Center [ FREE Ham Radio Links Directory [ About me | Acronyms  | CW | Data Sheets | Docs | Download | E-mail | HOME | Ham projects | Hobby circuits | Photo galery | PIC | QTH photos |
Sign in my guestbook | View my guestbook ]

© 2001 - YO5OFH, Csaba Gajdos