Log in

View Full Version : Deventeh Digatal - CMPS03 - Robot Compass Module


kE7JLM
08-11-2007, 09:07
I am in desperate need of help, I have been trying to integrate this compass for a while now with out any luck. At first we used interrupt code to read it, but the RC loop was too slow and did not give a accurate reading.


The compass has two interfaces, I2C, PWM. The PWM method is the one that did not work. Now since the RC is not compatible with I2C we bought a converter, it converts I2C to RS232. That means we have to connect it though the TLL port. But I have not experience with programming that port. Can anyone help me out. Anyone?


Thank You!

Daniel_LaFleur
08-11-2007, 09:59
I am in desperate need of help, I have been trying to integrate this compass for a while now with out any luck. At first we used interrupt code to read it, but the RC loop was too slow and did not give a accurate reading.


The compass has two interfaces, I2C, PWM. The PWM method is the one that did not work. Now since the RC is not compatible with I2C we bought a converter, it converts I2C to RS232. That means we have to connect it though the TLL port. But I have not experience with programming that port. Can anyone help me out. Anyone?


Thank You!


You may want to consider converting the PWM signal to an analog 0-5 Volt signal using something like this (www.bpesolutions.com/bpemanuals/dmxtoanalog1.pdf) and then putting it into the analog in ports on the RC.

Alan Anderson
08-11-2007, 11:35
At first we used interrupt code to read it, but the RC loop was too slow and did not give a accurate reading.

I don't understand what you mean. Using interrupts should make reading the sensor independent of the "RC loop".

...since the RC is not compatible with I2C...

The RC will talk to I2C devices. You just need to write the program to control the I/O pins with appropriate timing.

Phil Mack
08-11-2007, 14:38
I have not experience with programming that port.

Hello,
first, start by using Kevin's implementation of the serial drivers. you can download that at http://www.kevin.org/frc/frc_serial_ports.zip

You can then use the Read_Serial_Port and Write_Serial_Port functions to asynchronously send and receive bytes to either serial port.

Check in the documentation for the converter and the documentation for the compass to find out what bytes to send. If you are still using the emicros device, the documentation is at http://www.emicros.com/useri2c.zip and explains what you need to send to the converter to send a message over the I2C bus. It has complete examples that show exactly what you need to do.

Good luck,
~Phil

JamesBrown
08-11-2007, 16:34
I am in desperate need of help, I have been trying to integrate this compass for a while now with out any luck. At first we used interrupt code to read it, but the RC loop was too slow and did not give a accurate reading.

Thank You!

To read the pulse width from the compass you really need to write an interrupt function that uses the internal clock to count when the signal goes high and stop counting when the signal goes low. You can take this count convert it into microseconds (bases on frequency of the controllers internal clock) and then divide that by 100 to get a number in degrees.

I am not sure if you are using it for FIRST but be warned computers and other large metal objects will severely effect the heading of the compass. I am using one for a project for one of my classes, in the room where we have class the magnetic field varies so much that when the car with the compass is told to drive in a straight line you end up driving in a wave like shape. However in better settings (in this case a huge gymnasium) we use the compass with the same control algorithms on a blimp and get much better results.

jgannon
08-11-2007, 19:08
Hi John,
I already posted some code and instructions to help you out in another thread:

http://www.chiefdelphi.com/forums/showpost.php?p=643799&postcount=15

It'd be nice to hear one way or another if this worked out for you.