Go to Post Real coaches dont use "strategy assistants" during matches. - Rick [more]
Home
Go Back   Chief Delphi > Technical > Control System > Sensors
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 21-02-2010, 21:46
Randy Forgaard's Avatar
Randy Forgaard Randy Forgaard is offline
Parent 1729, former mentor 3126
FRC #7129
Team Role: Parent
 
Join Date: Oct 2009
Rookie Year: 2010
Location: Hollis, NH, USA
Posts: 48
Randy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to behold
Has anyone written C++ code to read the temperature sensor on the gyro?

Has anyone written C++ code to read the temperature sensor included as part of the ADW22307 gyro in the 2010 Kit of Parts?

The purpose of the temperature sensor is to allow one to interpret the gyro data while compensating for temperature, since the gyro data varies somewhat depending on the ambient temperature around the gyro itself. We aren't planning (anytime soon) to implement this temperature compensation for the gyro data (although that would be cool and quite doable...maybe someone will submit that temperature compensation code to WPILib someday).

However, we would still be interested in reading the temperature sensor on the gyro, just to find out the ambient temperature around our electronics inside the robot. We would like to display the robot temperature on our custom dashboard, and if we find that it's getting hot in there from the Jaguars and such, we can potentially add one of those nifty fans from the Kit of Parts to help cool down the robot electronics.

The gyro temperature sensor is just a standard 3-wire analog sensor, and can apparently be plugged directly into the analog breakout board on the cRIO, just like the gyro itself. However, WPILib doesn't seem to include any functions that provide a convenient way to read that temperature from the gyro.

Per the datasheet for the ADW22307 gyro, and the FRC 2010 Sensor Manual, the temperature sensor has a nominal output of 2.5V at 25°C (77°F), and the output varies up or down by 9mV per one degree Celsius (5mv per one degree Fahrenheit).

It would not be difficult to write the C++ code to read the temperature sensor on the 2010 gyro. It would involve using the AnalogChannel class in WPILib. We've never written code to use AnalogChannel directly before, but we could start with the Gyro.cpp WPILib source code (which also uses AnalogChannel) and modify it accordingly. But if someone else has already written the code to read the temperature sensor, and is interested in sharing it, we wouldn't have to re-invent the wheel. No big deal either way, we just thought we'd ask.

Many thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 21-02-2010, 22:05
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Has anyone written C++ code to read the temperature sensor on the gyro?

I haven't written code to do this, but probably the easiest thing to do would be to do this:

Code:
AnalogChannel* temp = new AnalogChannel(1); // adjust port accordinly
float change;
float temperature;

change = temp->GetVoltage() - 2.5; //Get temperature offset from 77 F
change *= 200 //convert to degrees F (1000 to bring out of millivolts / 5 per degree)
temperature = 77 + change; //apply offset to reference temperature
Change the constants accordingly to make it Celsius (the 200 becomes 1000/9 (not even so leave as equation) and the 77 becomes 25)

I can make a wrapper class for this if you want
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
Reply With Quote
  #3   Spotlight this post!  
Unread 22-02-2010, 00:11
Randy Forgaard's Avatar
Randy Forgaard Randy Forgaard is offline
Parent 1729, former mentor 3126
FRC #7129
Team Role: Parent
 
Join Date: Oct 2009
Rookie Year: 2010
Location: Hollis, NH, USA
Posts: 48
Randy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to beholdRandy Forgaard is a splendid one to behold
Re: Has anyone written C++ code to read the temperature sensor on the gyro?

Awesome. That looks so easy. I thought it would be a lot more involved. We will work on this tomorrow, starting with your code. Much appreciated!
Reply With Quote
Reply


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
how to attach the gyro sensor on the robot dazero Sensors 1 02-03-2009 13:16
Gyro Temperature Compensation? Orborde Programming 1 09-02-2008 17:15
Has anyone ever read... Raven_Writer Chit-Chat 6 11-06-2004 15:17
Has anyone craked the code yet Jeremy General Forum 2 09-01-2004 14:12
Has anyone succesfully programed the Gyro? archiver 2001 16 24-06-2002 02:56


All times are GMT -5. The time now is 08:00.

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