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

Projects Home

Get this page as PDF


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= 1C/F - Accuracy =1
  • New: Sampling rate: 12,5 to 25 samples/second.
  • Easy Tilt/Roll calibration.(TD-CMP02 and TD-CMP03 only)
  • Interfaces: IC, 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 lights when facing North (angle within 11,25 both left and right from North.)
  • USB Windows application (written in C#) available for free download.) Compatible with WinXp/Vista.
  • 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 assembled modules are available from our online shop.

You may also purchase the bare pcb, a KIT DIY* version and the source code. KIT step-by-step construction guide.

New: compass calibration.

Schematics and pcb diagrams available for download. Last update: November 26, 2009.

DIY* = Do It Yourself


C# Windows Example Program

Schematics: (click for full resolution image)

Main Connections:

Module header diagram


Header pinouts

  JP2 pins RS232  

JP3 pins

  1 +5V   1 +5V   1 EXT (from JP3)
  2 RX   2 SCL/SPEED1   2 COMMON
  3 GND   3 SDA   3 USB
  4 TX   4 GND / TEMP SENSOR -/SPEED2      
        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 the module directly from USB. Connect pin 1 to pin 2 when powered externally via JP3, pin 1.

New: Increase sampling speed from 12,5/second to 25/second: connect SPEED1 to SPEED2 (JP3, pin4 to JP3, pin2.)

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):


Compass Calibration: (do not touch the PCB or chips whilst calibrating.)


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. Communications @ 115200 bpS, 8N1.

Use a level converter like the MAX3232 between the TD-CMP module and the pc serial port. See this example.

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

RS232 terminal screen @115200 bps


IC 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 IC CCS C example to see how to connect IC 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  - January 28, 2009. Written in C# Visual Studio .NET, compatible with Windows XP and Vista.

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

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

 TD-CMP Module HEX: 023_v34.HEX  - November 26, 2009. Can be bootloaded to the module through the RS232 port (JP2) and Tiny Bootloader 1.91

 Schematics: gif, pdf.

 PCB Diagram: gif.

 Partslist: html.

Get this page as PDF


 Module PIC CCS C Source Code, Schematics (eagle) , 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.


Check out our development tools page.

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. 

Projects Home