Go to Post FIRST: Making women's hair grow, and mens hair fall out. - Ashley Christine [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 21-12-2009, 00:32
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
rescale analog inputs

Our analog inputs on the cRIO have a range from -10v to 10v.
Our accelerometer has an effective range from 0.6v to 2.4v
That's 9% of the full range, which means you get 9% of the full accuracy.

I was considering ways of rescaling it, and I was thinking a linear regulated 10v supply, a -10v supply, and an LM386 would be a good way to do it.

However, before I go out and buy anything, i wanted to check with you guys. Is there a simpler way to do this? Is there something I'm overlooking?
__________________
-- Marshal Horn
  #2   Spotlight this post!  
Unread 21-12-2009, 02:16
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: rescale analog inputs

Quote:
Originally Posted by kamocat View Post
Our analog inputs on the cRIO have a range from -10v to 10v.
Our accelerometer has an effective range from 0.6v to 2.4v
That's 9% of the full range, which means you get 9% of the full accuracy.

I was considering ways of rescaling it, and I was thinking a linear regulated 10v supply, a -10v supply, and an LM386 would be a good way to do it.

However, before I go out and buy anything, i wanted to check with you guys. Is there a simpler way to do this? Is there something I'm overlooking?
I think the easiest thing to do is to use over-sampling. Are you really sure you need to throw hardware at it? If you are sure, there are circuits that remap one voltage range to another. I've done this for the day-job in a couple places; I have a MATLAB script I can send if you are interested.

I looked into doing something like this for the Analog Breakout. I ran into three major problems:
1) Cost.
2) Supplies.
3) Quantization vs Accuracy noise.

Cost:
Since you are one-offing this, I wouldn't worry about it too much. I couldn't design anything useful that was cost-effective in bulk. FIRST has a way different budget than medical products do.

Supplies:
To remap, you need rails that at least cover the range you are aiming for. Creating a clean (-10:10)V rail or even a (0:10)V rail on the robot is difficult, as it requires a boosting switcher of some sort. Boosts are really noisy on the output, and inverters aren't pretty either.

You could nudge the 24V rail up to 28V, filter it, and use a pair of precision LDOs to create the (-10:0:10V). The down-side is that this 0V wouldn't be ground referenced, which would cause serious issues if NI hadn't been so nice to isolate all of their cRIO modules.


Quantization vs Accuracy noise:
Here is the meat of the issue. You are recovering up to 3.4 bits of quantization, but you adding accuracy and high-frequency noise. 9% range on a 12bit ADC leaves 8.6 functional bits.

So the question is now "What is important to you?"


If you are only concerned with relative values, you are in good shape.

If you are concerned with the precise DC value, be careful. If the error exceeds .25%, it is a net loss. This includes all of the errors caused by the op-amp, the resistor dividers, whatever biasing reference you are using, and (possibly) the power supply rails. A lot of this can be compensated for by calibration, but that is a pain in the neck.
  #3   Spotlight this post!  
Unread 21-12-2009, 02:49
daltore's Avatar
daltore daltore is offline
Electronics/programming/design
AKA: Aaron Osmer
FRC #3529 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: San Antonio, TX
Posts: 272
daltore has a spectacular aura aboutdaltore has a spectacular aura aboutdaltore has a spectacular aura about
Send a message via AIM to daltore Send a message via MSN to daltore Send a message via Yahoo to daltore
Re: rescale analog inputs

Not to mention, you have to compare the precision of the accelerometer to the precision of the cRIO. The DAC on the accelerometer probably outputs either an 8-bit or a 10-bit output. If it's a 10-bit output, then the values occupy 25% of the precision range of the cRIO, but 9% of the values, for a loss of -- well, somebody else can do the math, it's late. But my point is, if it's a 10-bit device, you will lose some data.

However, if it's an 8-bit output, the output precision range is only 1/16 that of the input range, so you have a voltage range that is 9% of the total, but a precision range that is 6.25% of the total. Since 9% is not a clean multiple of 6.25% there will be some error induced by thresholds not lining up, but effectively, you're not losing any data.

This is all assuming that you're not getting any EMF on the wire. As far as I've seen, there's a pretty big lack of consistency on analog devices just because of induced interference. If you're really worried about precision, a more accurate method may be either pulse-width modulation (also imprecise if the timers are not lined up, but on something as fast as the cRIO, that's not really an issue), or serial data (don't know which pins can be used as a serial bus other than the I2C port). An example would be these two, from Parallax and SparkFun:

http://www.robotshop.us/parallax-2-4...e-mma7455.html
http://www.robotshop.us/sfe-16g-trip...d-adxl345.html

At $35 and $28, these are well within the range of all of the other basic triple-axis accelerometers, and only require one connection to get all three axes, as opposed to connecting three independent analog lines. They can both use either SPI or I2C, so they might be perfect for our setup on the cRIO. Serial accelerometers go all the way down to around $20, but they're mostly 8-bit resolution at that point.

But as for scaling the voltage coming off of the one you have, you may or may not gain precision. If the accelerometer's resolution is high enough to warrant boosting the voltage, you have to account for the noise that will be incurred just by virtue of amplification. However, if the accelerometer's data precision is low enough anyway (8-bit), there's no reason to scale the voltage, because the V/G (volts per G) precision will not increase with mapping, it's a resolution problem at that point. If you are going to try scaling the voltage however, do use something with low losses. And don't worry about expanding into the - voltage range, usually accelerometers only have up to 10-bit resolution (most of the time, if yours is 12-bit, go for it if you can figure out a way), so that results in 1/4 of the cRIO's ADC resolution. That means if you got the voltage range past 5 volts, that's the maximum resolution you're going to get out of the device anyway. I think you're on the right path using an LM386, they have lots of nice features for this, like both a + and - input for resolution's sake, and an internal gain. Having all of these features in such a small package guards against interference. And don't forget the good impact of twisting your wires.

Last edited by daltore : 21-12-2009 at 03:09.
  #4   Spotlight this post!  
Unread 21-12-2009, 08:09
Gdeaver Gdeaver is offline
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,370
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: rescale analog inputs

For a long time First teams where complaining about the lack of hardware SPI or I2C on the IFI RC. Now we have it on the C_RIO. May be it's time to use it. The plus is that the manufacturer takes care of the conditioning for you. A 5 volt spi device would be nice.
  #5   Spotlight this post!  
Unread 21-12-2009, 10:47
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Mentor, LRI, MN RPC
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,813
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: rescale analog inputs

It's not a bad idea to think about this, and think about how it could be improved... but might I suggest you do some tests first with the accelerometer on the robot, without any additional hardware? You may find that it's "accurate enough" for your needs.

One of the most common problems i see in computer programmers is that the program is never "done" - there's always something that can be improved, tweaked, or modified... An important part of engineering is determining when something is "good enough" and moving on to the next task.
  #6   Spotlight this post!  
Unread 21-12-2009, 21:48
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: rescale analog inputs

Well, the accelerometer I'm looking at is, in fact, not the KOP one, so I'm going to provide that datasheet instead:
http://www.analog.com/en/sensors/ine...s/product.html
(can be purchased here: http://www.sparkfun.com/commerce/pro...roducts_id=849)

It says the output is ratiometric; the output scaling is proportional to the voltage input. Does that imply it's a true analog device, without a DA converter?
__________________
-- Marshal Horn
  #7   Spotlight this post!  
Unread 21-12-2009, 22:49
David Brinza's Avatar
David Brinza David Brinza is offline
Lead Mentor, Lead Robot Inspector
FRC #0980 (ThunderBots)
Team Role: Mentor
 
Join Date: Feb 2003
Rookie Year: 2003
Location: Glendale, CA
Posts: 1,379
David Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond repute
Re: rescale analog inputs

In prior years*, the use of custom circuits have been allowed in FRC robots. This is an opportunity to use a simple operational amplifier (op-amp) circuit to apply gain and offset to the input and filter the signal to eliminate high frequency noise (i.e. motor/compressor vibrations, electrical power noise). Signal conditioning requires some care, but is not too complicated. Simple evaluation boards can be purchased from op-amp distributors (i.e Digi-Key), not to mention kits.

Have fun!
__________________
"There's never enough time to do it right, but always time to do it over."
2003 AZ: Semifinals, Motorola Quality; SoCal: Q-finals, Xerox Creativity; IRI: Q-finals
2004 AZ: Semifinals, GM Industrial Design; SoCal: Winners, Leadership in Controls; Championship: Galileo #2 seed, Q-finals; IRI: Champions
2005 AZ: #1 Seed, Xerox Creativity; SoCal: Finalist, RadioShack Controls; SVR: Winners, Delphi "Driving Tomorrow's Technologies"; Championship: Archimedes Semifinals; IRI: Finalist
2007 LA: Finalist; San Diego: Q-finals; CalGames: Finalist || 2008 San Diego: Q-finals; LA: Winners; CalGames: Finalist || 2009 LA: Semifinals; Las Vegas: Q-finals; IRI: #1 Seed, Finalist
2010 AZ: Motorola Quality; LA: Finalist || 2011 SD: Q-finals; LA: Q-finals || 2013 LA: Xerox Creativity, WFFA, Dean's List Finalist || 2014 IE: Q-finals, LA: Finalist, Dean's List Finalist
2016 Ventura: Q-finals, WFFA, Engineering Inspiration

Last edited by David Brinza : 21-12-2009 at 23:38. Reason: * mandatory pre-kickoff disclaimer, Digi-key
  #8   Spotlight this post!  
Unread 29-12-2009, 21:24
spartango spartango is offline
Registered User
FRC #0192 (GRT)
Team Role: Alumni
 
Join Date: Nov 2009
Rookie Year: 2008
Location: Palo Alto, CA
Posts: 43
spartango is an unknown quantity at this point
Re: rescale analog inputs

Watch out re:SPI

Last year (2009) our team bought SCA3000s from sparkfun(http://www.sparkfun.com/commerce/pro...d=8791)--wired them up to a a different device and had them working nicely with SPI...Gave us AMAZING accuracy btw..

Then we took them to the cRIO and started using the standard WPILibs...and we got junk...some careful work with a logic analyzer and oscilloscope revealed that WPILib's SPI library was reading the data at the wrong point on the wave, and because the Labview VIs for FPGA control are all locked we couldnt fix this. Further, our custom library(that worked on a DAQ, albeit a little slowly) for SPI was pretty much useless because we couldnt get microsecond precision timing to do the wave generation, and once again the FPGA was off limits...

I doubt the same problem will come up with I2C, but this was really sad for SPI...
  #9   Spotlight this post!  
Unread 30-12-2009, 00:03
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: rescale analog inputs

Quote:
Originally Posted by spartango View Post
Watch out re:SPI

Last year (2009) our team bought SCA3000s from sparkfun(http://www.sparkfun.com/commerce/pro...d=8791)--wired them up to a a different device and had them working nicely with SPI...Gave us AMAZING accuracy btw..

Then we took them to the cRIO and started using the standard WPILibs...and we got junk...some careful work with a logic analyzer and oscilloscope revealed that WPILib's SPI library was reading the data at the wrong point on the wave, and because the Labview VIs for FPGA control are all locked we couldnt fix this. Further, our custom library(that worked on a DAQ, albeit a little slowly) for SPI was pretty much useless because we couldnt get microsecond precision timing to do the wave generation, and once again the FPGA was off limits...

I doubt the same problem will come up with I2C, but this was really sad for SPI...
The SPI driver saw some minor tweaks for this next year, hopefully that will cover your issue. However, I'm reasonably confident that the timing was correct. Perhaps you could give further details?
  #10   Spotlight this post!  
Unread 03-01-2010, 01:17
daltore's Avatar
daltore daltore is offline
Electronics/programming/design
AKA: Aaron Osmer
FRC #3529 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: San Antonio, TX
Posts: 272
daltore has a spectacular aura aboutdaltore has a spectacular aura aboutdaltore has a spectacular aura about
Send a message via AIM to daltore Send a message via MSN to daltore Send a message via Yahoo to daltore
Re: rescale analog inputs

It's really hard for SPI to have timing issues, that was kind of the whole point of it being synchronous (although I don't disbelieve you, they probably didn't work too hard on the SPI libraries because they probably though no one would use them last year, and they would be easy to write ). Did you compare the two programs you had for the working controller and the cRIO to see if you initialized something incorrectly?
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
Potentiometers in Analog Inputs brVex Technical Discussion 12 12-11-2008 23:22
Analog Inputs bush Programming 5 13-03-2006 17:49
Analog Inputs prob. Bharat Nain Programming 2 07-02-2004 20:48
Failing analog inputs? Phasmatis568 Control System 5 22-01-2004 13:28
Analog Inputs 316_programer Technical Discussion 2 05-02-2002 05:53


All times are GMT -5. The time now is 07:35.

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