Go to Post Ice cream is an iterative process. - JVN [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 23-01-2014, 11:25
bhylak bhylak is offline
Ben
FRC #0365 (MOE (Miracles Of Engineering))
Team Role: Programmer
 
Join Date: Mar 2013
Rookie Year: 2011
Location: Wilmington, Delaware
Posts: 5
bhylak is an unknown quantity at this point
Analog Maxbotix XL-EZ4

I was wondering if I could get any help programming a Maxbotix XL-EZ4. (in C++) I did read through the API, and the spec sheets for the sensor but I'm still a little confused. So I know that the XL is approximately 4.9mv per inch. On the arduino which I tested the sensor, I could simply get the value of the sensor (1-1024) and that would be the cms.

This is a quote from the spec sheet:

Analog output of distance reading: (Vcc/1024) / cm (4.9 mV/cm when input voltage Vcc = 5 V)

The analog on the CRIO however is scaled to 10v instead of the 5v from the arduino, although the output from the analog sidecar is 5. I also don't understand whether I should use the GetVoltage or GetValue, and I also don't understand how I scale it. (And an explanation of how you came up with the numbers would be appreciated as I attempt to understand)

Sorry if this is a stupid question- it's my first time using an analog sensor with the CRIO.

Ben
  #2   Spotlight this post!  
Unread 23-01-2014, 12:25
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,089
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Analog Maxbotix XL-EZ4

GetVoltage will return the input voltage. It's scaled in the Analog Breakout, but I believe it's unscaled in WPILib. If it isn't the math to un scale yourself is easy since it's a linear scale.

Once you have the unscaled voltage, just multiply your voltage by 0.0049 and you'll have inches.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

  #3   Spotlight this post!  
Unread 23-01-2014, 13:22
bhylak bhylak is offline
Ben
FRC #0365 (MOE (Miracles Of Engineering))
Team Role: Programmer
 
Join Date: Mar 2013
Rookie Year: 2011
Location: Wilmington, Delaware
Posts: 5
bhylak is an unknown quantity at this point
Re: Analog Maxbotix XL-EZ4

Thanks! That makes a lot of sense. However, the voltage is scaled in WPILib.
It says

"Get a scaled sample straight from this channel on the module. The value is scaled to units of Volts using the calibrated scaling data from getLSBWeight() and getOffset(). "

That's the part I don't understand.
  #4   Spotlight this post!  
Unread 23-01-2014, 13:56
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Analog Maxbotix XL-EZ4

The "scaling" mentioned in the library is simply a conversion from raw A/D counts to volts. What you get out of GetVoltage() is the measured voltage on the pins.
  #5   Spotlight this post!  
Unread 23-01-2014, 15:52
bhylak bhylak is offline
Ben
FRC #0365 (MOE (Miracles Of Engineering))
Team Role: Programmer
 
Join Date: Mar 2013
Rookie Year: 2011
Location: Wilmington, Delaware
Posts: 5
bhylak is an unknown quantity at this point
Re: Analog Maxbotix XL-EZ4

That makes sense! So is get voltage in mv? Do you just times get voltage by .0049
  #6   Spotlight this post!  
Unread 23-01-2014, 16:08
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,089
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Analog Maxbotix XL-EZ4

Quote:
Originally Posted by bhylak View Post
That makes sense! So is get voltage in mv? Do you just times get voltage by .0049
Voltage * .0049 = distance in inches. That's it.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

  #7   Spotlight this post!  
Unread 23-01-2014, 16:16
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Analog Maxbotix XL-EZ4

Quote:
Originally Posted by cgmv123 View Post
Voltage * .0049 = distance in inches. That's it.
The units in the spec sheet is 4.9 mv/cm To get cm, you would divide by .0049v/cm. You could then convert to inches if desired.
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 02:44.

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