Go to Post You are becoming the leaders of tomorrow by leading today. - Chris Fultz [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 28-09-2007, 00:39
Phil Mack Phil Mack is offline
Registered User
FRC #0836 (RoboBees)
Team Role: Mentor
 
Join Date: May 2007
Rookie Year: 2007
Location: Maryland
Posts: 30
Phil Mack is a splendid one to beholdPhil Mack is a splendid one to beholdPhil Mack is a splendid one to beholdPhil Mack is a splendid one to beholdPhil Mack is a splendid one to beholdPhil Mack is a splendid one to beholdPhil Mack is a splendid one to behold
Re: Programming a Devantech Magnetic Compass - CMPS03

Quote:
Originally Posted by kE7JLM View Post
Can someone show me what is wrong?
This compass does not output an analog voltage. It outputs a pulse with a specific time, or byte values can be read over an I2C bus.

The timing pulse is high for 1mS to 37mS in 0.1mS increments and then low for 65mS. The rise and fall time is much faster (a few nanoseconds if i recall, but i cant find the datasheet right now). The ADC in the robot controller works fast enough that whenever it measures the voltage, the voltage will be either high or low... not in between.

You essentially have three options... use an additional micro controller, design a circuit, or write interrupt driven software.

The first option is the easiest (in my oppinion) and will give you the most accurate results. You can purchase or build an I2C master with an RS232 interface that the robot controller can communicate with. One elegant implementation of this is available at http://www.emicros.com/i2c232.htm for about $90, but one could be built for much less than that (I built a less elegant one in college using an AVR Butterfly that cost $20 and that was processing overkill.)

The second option would require a series of filters and amplifiers that would translate the pulse into a voltage. This one is a bit outside of my field of expertise, so I'll leave an explanation to someone else, because it would be a relatively complex circuit.

The third option to interface with this compass you have to measure the length of the pulse width using on board timers triggered by interrupts. You would want to scale one of the timers to use increments fairly close to but not over .1ms. The pulse out on the compass would trigger an interrupt, at which point the timer's count would be noted. The (count_at_fall - count_at_rise)/clock_scale_factor would be the width of the pulse and also your heading.

I hope this helps.
~Phil
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Interfacing a digital compass with the RC Kelly Electrical 14 27-09-2007 19:01
Where can I get a digital compass sensor? EHaskins Technical Discussion 6 26-09-2007 18:33
I2C Digital Compass Programming CyberWolf_22 Programming 7 03-01-2005 00:20
Political Compass Joshua May Chit-Chat 11 01-10-2004 22:32
Compass/direction sensor Frank(Aflak) Technical Discussion 10 06-04-2003 09:18


All times are GMT -5. The time now is 15:20.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi