Go to Post Machinery tends to make chips fly into weird places. Lathes and mills are particularly good at this, though drill presses are skilled as well. - Karibou [more]
Home
Go Back   Chief Delphi > Technical > Electrical
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-05-2007, 22:03
Kelly Kelly is offline
Registered User
FRC #1418
 
Join Date: Jan 2007
Location: VA
Posts: 78
Kelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud of
Interfacing a digital compass with the RC

As an off-season project, my team wants to add a digital compass to this year's robot. We are currently interested in the one featured here: http://www.robot-electronics.co.uk/s...CMPS032004.htm

I was wondering if anyone has experience with this or other digital compasses or if anyone has specific advice for getting data from it with the robot controller.

The documentation says it can use PWM and I2C outputs (outputs on the compass, meaning inputs on the RC). Which of these would I want to use? Which pins would I connect it to on the controller?

Also, we're looking for something that can handle spinning around pretty quickly without getting out of whack. How quickly does this compass update?
  #2   Spotlight this post!  
Unread 22-05-2007, 22:09
Darkforces's Avatar
Darkforces Darkforces is offline
Froforces
AKA: Taylor Burch
FRC #1875 (Autonomato Atonamatons)
Team Role: Leadership
 
Join Date: Mar 2006
Rookie Year: 2005
Location: Florida
Posts: 70
Darkforces will become famous soon enoughDarkforces will become famous soon enough
Send a message via AIM to Darkforces
Re: Interfacing a digital compass with the RC

We planed on using on this season but we were unable to include it due to a lack of time. Ill see if i can get any notes from the programmer about it, and if you want i think we have a program that sends the orientation of the to the controller. It's somewhat of a drivercentric prototype.
__________________

  #3   Spotlight this post!  
Unread 23-05-2007, 08:03
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al WFFA 2005
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 10,795
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: Interfacing a digital compass with the RC

Kelli,
We had looked into using a compass on a few occassions. The ones we were looking at (and I am guessing this one as well) reguire a rather large current pulse or pulses to help calibrate and restore operation. The I2C reference is a car serial control protocol as I remember. Perhaps someone from the auto makers could elaborate on this. We had trouble working with our prototype depending on the building structure. Although we were able to get usable data in most locations, we didn't want to depend on arena variables to prevent us from doing a good auto mode. FYI so you don't get too discouraged, we spent some long hours trying to debug the compass while working on a stainless steel conference room table. Rack that up to late hours at the end of the build. It took us a while to realize where the error was coming from.

See http://www.robot-electronics.co.uk/h...he_i2c_bus.htm
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
Storming the Tower since 1996.

Last edited by Al Skierkiewicz : 23-05-2007 at 08:06.
  #4   Spotlight this post!  
Unread 23-05-2007, 08:24
Protronie's Avatar
Protronie Protronie is offline
Have big wrench...and will use it!
no team
 
Join Date: Dec 2006
Rookie Year: 2006
Location: North Carolina
Posts: 617
Protronie has much to be proud ofProtronie has much to be proud ofProtronie has much to be proud ofProtronie has much to be proud ofProtronie has much to be proud ofProtronie has much to be proud ofProtronie has much to be proud ofProtronie has much to be proud of
Send a message via ICQ to Protronie Send a message via Yahoo to Protronie
Re: Interfacing a digital compass with the RC

Please forgive a uninformed question but,
How would you use a digital compress in a robot?
And wouldn't the electronics and metal of the robot throw it off a few dozen degrees?
Especially when inside a building.
__________________
Protronie rule 5 - When the big wrench starts swinging, get out of the way!
  #5   Spotlight this post!  
Unread 23-05-2007, 08:29
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Interfacing a digital compass with the RC

Your only issue with the Inter-Integrated Circuit (I2C) communications is... none of the lines from the processor that do I2C are routed outside the board!

If your working on an non-FIRST project, then definintely you can use I2C, however, on the FIRST RC you'll need to use PWM.

According to the website that you ordered this from, the PWM signal updates at anywhere from 66ms - 102ms (or 9.8 - 15.2Hz, slower the closer you get to 359.9degrees).

If you need help doing PWM pulse timing, just give me a yell, didnt know if you just wanted advice with which way to go or what. You can check this post to see if it will help you any, but can't remember if i said much on pwm timing here. Again, if not, just give me a yell back on this thread and i'll be happy to help.

By the way just for my curiosity, what's this compass for exactly? Why do you want to know which way your robot's going? Arent you worried about flux fields from motors and such in your robot throwing it off?

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #6   Spotlight this post!  
Unread 23-05-2007, 08:38
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al WFFA 2005
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 10,795
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: Interfacing a digital compass with the RC

Quote:
Originally Posted by Protronie View Post
Please forgive a uninformed question but,
How would you use a digital compress in a robot?
And wouldn't the electronics and metal of the robot throw it off a few dozen degrees?
Especially when inside a building.
That is part of the high current pulse for cal, etc. Car compass modules use this type of device. It requires some thought and planning as to placement but it is done all the time. Cars don't really need to depend on direction when inside a building or structure so it is usually not a problem. I have had a car compass go a little whacky inside big garages or undergound though.
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
Storming the Tower since 1996.
  #7   Spotlight this post!  
Unread 23-05-2007, 12:11
Kelly Kelly is offline
Registered User
FRC #1418
 
Join Date: Jan 2007
Location: VA
Posts: 78
Kelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud of
Re: Interfacing a digital compass with the RC

We have a holonomic drive train, and we want to use the compass to determine which way our robot is pointing so we can make a field-centric drive system. We aren't worried about it being off relative to the Earth, we just need it to be consistently off.

We're trying to use the 2007 RC for this project. Can it receive PWM input?
  #8   Spotlight this post!  
Unread 23-05-2007, 13:08
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Interfacing a digital compass with the RC

Quote:
Originally Posted by Kelly View Post
We have a holonomic drive train, and we want to use the compass to determine which way our robot is pointing so we can make a field-centric drive system. We aren't worried about it being off relative to the Earth, we just need it to be consistently off.

We're trying to use the 2007 RC for this project. Can it receive PWM input?
Ahhh I always wanted to try this! Though with the added bonus of a fluxgate compass in the OI pannel too, so a crab drive could always be relative to the OI pannel, even if the operator is walking with the robot. ANYHOW....

Absolutely it can recieve PWM input, thats the great thing about embedded processors, you can do about anything you want! If you need help with how to program up a pulse timer using a hardware timer and a PORTB external interrupt, i can definitely help, just get me in touch with your programmer and i'll see what i can do.

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #9   Spotlight this post!  
Unread 23-05-2007, 14:37
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: Interfacing a digital compass with the RC

Quote:
Originally Posted by Al Skierkiewicz View Post
The I2C reference is a car serial control protocol as I remember.
You're probably thinking of CAN. I2C a very short range, low speed serial interface and designed to be a simple interface between microprocessors/microcontrollers and various peripherals. The uses of I2C are basically the same as SPI - in some ways they could be considered to be competing standards (though many microcontrollers will support both interfaces). It is typically used to connect chips that are all on the same PCB, and isn't that hard to implement in software if necessary.
Quote:
Originally Posted by Al Skierkiewicz
FYI so you don't get too discouraged, we spent some long hours trying to debug the compass while working on a stainless steel conference room table. Rack that up to late hours at the end of the build. It took us a while to realize where the error was coming from.
Al, I'm going to step in here and defend the team that worked on this. Nate and the rest of the firmware team explored the compass as one possible solution to determining orientation, and we all knew that the room we were working in wasn't a good location to test in. We never wasted long hours trying to figure anything like that out. We tested it in many locations, including at our field and in the model shop. The bottom line is that the compass we were using at the time (can't remember the model #) was totally ineffective. When installed on the robot it didn't report anything useful at all (the readings would change with fluctuations in motor speed, which is what we were afraid of). Adjusting the reading with the high-current pulse or whatever method that one used wouldn't have made any difference (the compass we were using was not I2C - as I recall it output an analog signal).

The year this took place was 2003. We explored a bunch of options and ended up going with a gyro and integrating to get rotational position. This worked perfectly for the 15 seconds of autonomous, but unfortunately it would not be stable enough for Kelly's needs (where it would need to maintain correct orientation for basically the whole match).

As for reading the PWM input, sometimes you can take the PWM output and run it through a simple RC circuit to convert it to an analog value that you could read directly with the RC.
  #10   Spotlight this post!  
Unread 23-05-2007, 17:55
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Interfacing a digital compass with the RC

Quote:
Originally Posted by Dave Flowerday View Post
As for reading the PWM input, sometimes you can take the PWM output and run it through a simple RC circuit to convert it to an analog value that you could read directly with the RC.
Give me a pwm signal, a timer (internal peripheral) and an external interrupt (portb) and i'll time you a pulse...

Have had to do this this year and in the past for getting distance data out of an ultrasonic sensor...

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08

Last edited by Qbranch : 23-05-2007 at 17:56. Reason: Yeah... commas separate list items in coloquial english... :o
  #11   Spotlight this post!  
Unread 23-05-2007, 18:13
Kelly Kelly is offline
Registered User
FRC #1418
 
Join Date: Jan 2007
Location: VA
Posts: 78
Kelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud ofKelly has much to be proud of
Re: Interfacing a digital compass with the RC

How hard is that?
  #12   Spotlight this post!  
Unread 23-05-2007, 18:16
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Interfacing a digital compass with the RC

Algorithm wise its easy peasy. Hardware wise, you'll need to know how to use interrupts, and how to use a hardware timer... nothing too bad.

If you'd like to try, i'll write up how you do it, just don't want to take the time to write it till i'm sure somebody needs it. (call me lazy )

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #13   Spotlight this post!  
Unread 23-05-2007, 22:11
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: Interfacing a digital compass with the RC

Quote:
Originally Posted by Qbranch View Post
Give me a pwm signal, a timer (internal peripheral) and an external interrupt (portb) and i'll time you a pulse...
Yes, that's not hard to do at all. I was simply offering a potential alternative solution in case the original poster isn't comfortable using timer interrupts and such. Occasionally things which seem most obvious to one person can be very daunting to another.
  #14   Spotlight this post!  
Unread 26-09-2007, 18:55
kE7JLM's Avatar
kE7JLM kE7JLM is offline
KE7JLM `
AKA: John Harris
FRC #0842 (Falcon Robotics)
Team Role: Driver
 
Join Date: May 2007
Rookie Year: 2006
Location: Phoenix, AZ`
Posts: 136
kE7JLM is a name known to allkE7JLM is a name known to allkE7JLM is a name known to allkE7JLM is a name known to allkE7JLM is a name known to allkE7JLM is a name known to all
Send a message via MSN to kE7JLM
Re: Interfacing a digital compass with the RC

We have a Devantech CMPS03 Digital Compass I would apresiate if someone could give me some step by step instructs on hw to do this, please.
__________________
Team 842 Programmer

Pictures at:
http://picasaweb.google.com/KE7JLM
&
http://picasaweb.google.com/john.h.842

Videos -
http://www.youtube.com/user/KE7JLM

When your not busy with FIRST try NURC

  #15   Spotlight this post!  
Unread 27-09-2007, 19:01
jgannon's Avatar
jgannon jgannon is offline
I ᐸ3 Robots
AKA: Joey Gannon
no team
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Pittsburgh, PA
Posts: 1,467
jgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond reputejgannon has a reputation beyond repute
Re: Interfacing a digital compass with the RC

Quote:
Originally Posted by kE7JLM View Post
We have a Devantech CMPS03 Digital Compass I would apresiate if someone could give me some step by step instructs on hw to do this, please.
I've been wanting to publish the code for this, as well as some other code, for quite some time, but I can't get a hold of Kevin Watson to allow me to reprint parts of his code. So here's the best I can do.

Step one: Get a copy of Kevin Watson's interrupt code here.
Step two: Enable timer 1, set the prescaler to 1:8, change register operations to 8-bit accesses, and disable the timer 1 interrupt. These are all documented in Initialize_Timer_1(). Also, enable interrupt 1 in Initialize_Interrupts().
Step three: Add these declarations to the top of interrupts.c. Increasing the value of SAMPLES should decrease the noise in your readings, to an extent:
Code:
#define SAMPLES 1
unsigned char Temp_Buf;
unsigned int Timer_Snapshot;
unsigned int Readings[SAMPLES];
unsigned char p=0;
Step four: Replace the blank Int_1_Handler() with:
Code:
void Int_1_Handler(void)
{
  Temp_Buf = TMR1L;
  Timer_Snapshot = TMR1H;
  if(Temp_Buf == 0xFF)
    Timer_Snapshot--;
  Timer_Snapshot <<= 8;
  Timer_Snapshot += Temp_Buf;
  TMR1L = 0;
  TMR1H = 0;
  Readings[p++] = ((Timer_Snapshot - 0x4000) / 125) % 360;
  p %= SAMPLES;
}
Step five: Add this to the end of interrupts.c (and add the appropriate prototype to interrupts.h):
Code:
unsigned int Get_Compass(void)
{
  int i,x=0;
  for(i=0;i<SAMPLES;i++)
    x+=Readings[i];
  return x/SAMPLES;
}
Step six: Wire pin 1 on the compass to +5V on digital I/O 1 on the RC, pin 4 to signal, and pin 9 to ground.
Step seven: Call Get_Compass() to get the current reading from the compass... I can't remember right now if the value is in degrees or tenths of degrees, but you should be able to figure it out pretty quickly.

Best of luck!
__________________
Team 1743 - The Short Circuits
2010 Pittsburgh Excellence in Design & Team Spirit Awards
2009 Pittsburgh Regional Champions (thanks to 222 and 1218)
2007 Pittsburgh Website Award
2006 Pittsburgh Regional Champions (thanks to 395 and 1038)
2006 Pittsburgh Rookie Inspiration & Highest Rookie Seed

Team 1388 - Eagle Robotics
2005 Sacramento Engineering Inspiration
2004 Curie Division Champions (thanks to 1038 and 175)
2004 Sacramento Rookie All-Star

_

Last edited by jgannon : 27-09-2007 at 19:04.
Closed Thread


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
Where can I get a digital compass sensor? EHaskins Technical Discussion 6 26-09-2007 18:33
Interfacing with Allen-Bradley Sensors doubleslash Electrical 9 31-01-2006 14:11
I2C Digital Compass Programming CyberWolf_22 Programming 7 03-01-2005 00:20
Interfacing a PC with last year's Robot Controller punarhero Technical Discussion 2 21-04-2004 00:05
Interfacing a second Micro to the RC Matt Reiland Programming 3 08-06-2003 00:11


All times are GMT -5. The time now is 06:59.

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