Go to Post FIRST is a big family and we‘ll get through this together. - Gary Dillard [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 19-12-2011, 11:34
DavisC DavisC is offline
Registered User
FRC #0539 (Titans)
Team Role: College Student
 
Join Date: Jul 2011
Rookie Year: 2010
Location: Virginia
Posts: 200
DavisC is just really niceDavisC is just really niceDavisC is just really niceDavisC is just really nice
Arduino and FRC Sensors

Well, on my grand Arduino goals I am going to try to use the various FRC sensors such as the Accelerometer, Gyro, and the Rotary/Linear Magnetic Encoders.

My 2 biggest goals are the Accel and Gyro but I my team has never used these before and so I am going to start by getting it to work with the Arduino (hopefully easier, and I don't have the cRIO over break).

I noticed that the Accel is the same 1 as on SparksFun except the board connectors are different and the documents provided by FIRST seem quite complex. So step 1 would be figuring out how to set it up and then program it.

Anyone have some advice to start the code or can mention the proper way to connect it to the arduino.

Thanks!
Davis
  #2   Spotlight this post!  
Unread 19-12-2011, 11:53
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Arduino and FRC Sensors

First, you have to figure out how it communicates with the microcontroller - usually i2c, analog, or SPI. If it's i2c, you'll need to find out its address. From there, google "arduino i2c accelerometer" (or whatever) and you'll have lots of information.

Or, if it's a pretty common sensor, you can just google the name of it with "arduino" tacked on to the front and get a good guide.
  #3   Spotlight this post!  
Unread 19-12-2011, 13:14
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Arduino and FRC Sensors

Any way you do it, you'll end up with raw data, which will need filtering and math to get useful information.

A gyro measures yaw rate, so it outputs a velocity. If you integrate it once, you will get angular heading. If it's analog, you'll also need a center bias, usually digital ones output a signed number. Don't worry about the calculus, it's fairly easy to "cheat" in robotics programming.

An accelerometer measures acceleration, so you'll need to integrate it once to get velocity and twice to get distance (at which point it's very inaccurate). If you aren't moving at all, you can use it as an inclinometer by finding the vector G from multiple axis of acceleration perpendicular to each other. Like the analog gyro, analog accelerometers need a center bias.

If you want vehicle speed and/or position, a pair of quadrature encoders and a gyro is the way to go. Although there can be wheel slip in the encoders, they're generally more accurate than the second integration of acceleration (which itself could be a noisy analog signal).

If you want to run quadrature encoders, you'll need to setup an ISR on one or both of the pins, on one or both edges (the number of interrupts = the decoding, one edge of one pin = 1x, both edges of one pin = 2x, both edges of both pins = 4x) and check the other pin to get direction. Speed comes from the first derivative of distance or the time between samples (I recommend filtering it any way you do it, it will be fairly noisy).
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #4   Spotlight this post!  
Unread 19-12-2011, 13:57
DavisC DavisC is offline
Registered User
FRC #0539 (Titans)
Team Role: College Student
 
Join Date: Jul 2011
Rookie Year: 2010
Location: Virginia
Posts: 200
DavisC is just really niceDavisC is just really niceDavisC is just really niceDavisC is just really nice
Re: Arduino and FRC Sensors

Alright, so for the Accel, 1 tutorial mentions to use SDA and SCL and connect them to pin 4 and 5 on the Arduino, but the board layout is different. So this might sound a little stupid but how do I connect the power for this board, I only see the the 2 0V and 5V connectors and I don't see anything else relating to Ground.
  #5   Spotlight this post!  
Unread 19-12-2011, 15:47
WizenedEE's Avatar
WizenedEE WizenedEE is offline
Registered User
AKA: Adam
FRC #3238 (Cyborg Ferrets)
Team Role: Leadership
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Anacortes, WA
Posts: 395
WizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to allWizenedEE is a name known to all
Re: Arduino and FRC Sensors

Gnd/Ground is 0v (at least in DC circuits), so connect the 5V to the 5V pin on the arduino and the 0v to one of the Gnd pins.
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


All times are GMT -5. The time now is 18:47.

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