Go to Post Dedication to FIRST gets more challenging as life gets more complicated but the rewards are SOOOOO worth it! - Sean Schuff [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 08-02-2004, 20:35
Joshua May's Avatar
Joshua May Joshua May is offline
Go Bears!
FRC #1110 (Binary Bulldogs)
Team Role: College Student
 
Join Date: Nov 2003
Rookie Year: 2003
Location: Berkeley, CA
Posts: 1,306
Joshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond repute
Send a message via AIM to Joshua May
Current Sensor

Does anyone have anything on programming the code for the current sensor. All I really need to know is what type of input the sensor is, what type of value it returns, and the range of the value (and perhaps that value's meaning)
  #2   Spotlight this post!  
Unread 08-02-2004, 22:05
WillyC's Avatar
WillyC WillyC is offline
"handy"
#1347
Team Role: Engineer
 
Join Date: Jan 2004
Location: Ottawa, Canada
Posts: 29
WillyC is on a distinguished road
Re: Current Sensor

Quote:
Originally Posted by HHSJosh
Does anyone have anything on programming the code for the current sensor. All I really need to know is what type of input the sensor is, what type of value it returns, and the range of the value (and perhaps that value's meaning)
Look here at the current sensor document from the usfirst.org website.

Wire the sensor up to a PWM cable and plug it into one of the analog inputs on the FRC.

The current sensor gives an analog output voltage between 0 and 5 volts. The output voltage corresponds linearly to the current measured, with 0 volts = -75 amps, 2.5 volts = 0 amps, and 5 volts = 75 amps. Look at the graphs in the documentation I've attached for more info on the voltage vs. current characteristics. Use your program to read the analog voltage, then calculate the corresponding current using these characteristics (we just use a linear y = mx+b calculation).

If you need help getting your software to read the analog value, look at the 2004 Programming Reference Guide available here.

Hope this helps! Good luck, and let me know if you need any more help.
  #3   Spotlight this post!  
Unread 08-02-2004, 23:47
Joshua May's Avatar
Joshua May Joshua May is offline
Go Bears!
FRC #1110 (Binary Bulldogs)
Team Role: College Student
 
Join Date: Nov 2003
Rookie Year: 2003
Location: Berkeley, CA
Posts: 1,306
Joshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond repute
Send a message via AIM to Joshua May
Re: Current Sensor

This should work, thank you!
__________________
The FIRST Wiki - openFIRST - Ultimate Robot Challenge - URC Wiki
I currently have 50 GMail invites, PM or email me for one.
UC Berkeley Class of 2009

2005 Las Vegas Regional Autodesk Visualization Award
2005 Las Vegas Regional #8 Seeded Alliance with 988 and 1505
2006 Southern California Regional #15 seed
  #4   Spotlight this post!  
Unread 09-02-2004, 22:28
Dale(294engr]'s Avatar
Dale(294engr] Dale(294engr] is offline
Mentor/Sponsor since '98
FRC #0294 (Beach Cities Robotics)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Redondo Beach, CA
Posts: 92
Dale(294engr] is a glorious beacon of lightDale(294engr] is a glorious beacon of lightDale(294engr] is a glorious beacon of lightDale(294engr] is a glorious beacon of lightDale(294engr] is a glorious beacon of lightDale(294engr] is a glorious beacon of light
Re: Current Sensor

Quote:
Originally Posted by WillyC
Look here at the current sensor document from the usfirst.org website.

Wire the sensor up to a PWM cable and plug it into one of the analog inputs on the FRC.

The current sensor gives an analog output voltage between 0 and 5 volts. The output voltage corresponds linearly to the current measured, with 0 volts = -75 amps, 2.5 volts = 0 amps, and 5 volts = 75 amps. Look at the graphs in the documentation I've attached for more info on the voltage vs. current characteristics. Use your program to read the analog voltage, then calculate the corresponding current using these characteristics (we just use a linear y = mx+b calculation).

If you need help getting your software to read the analog value, look at the 2004 Programming Reference Guide available here.

Hope this helps! Good luck, and let me know if you need any more help.

ACS NOTE RANGE:
1Vout = -75A
2.5Vout = 0A
4Vout = 75A

(0V ~-100A, 5V ~+100A, not guaranteed linear)

see my replies posted elsewhere
  #5   Spotlight this post!  
Unread 11-02-2004, 16:40
UCMHSrobotics UCMHSrobotics is offline
Registered User
#1257
 
Join Date: Feb 2004
Location: Scotch Plains, NJ
Posts: 2
UCMHSrobotics is an unknown quantity at this point
Re: Current Sensor

I checked the programming guide, and I couldn't find anything on the current sensor. It would be great if someone could explain the programming to me or just give me some code for the current sensors. Thanks!
  #6   Spotlight this post!  
Unread 11-02-2004, 20:37
Joshua May's Avatar
Joshua May Joshua May is offline
Go Bears!
FRC #1110 (Binary Bulldogs)
Team Role: College Student
 
Join Date: Nov 2003
Rookie Year: 2003
Location: Berkeley, CA
Posts: 1,306
Joshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond reputeJoshua May has a reputation beyond repute
Send a message via AIM to Joshua May
Re: Current Sensor

Quote:
Originally Posted by UCMHSrobotics
I checked the programming guide, and I couldn't find anything on the current sensor. It would be great if someone could explain the programming to me or just give me some code for the current sensors. Thanks!
I have written some code for the current sensor, but it doesn't do anything but display the sensor's data. You can put this in the final lines of user_routines_fast.c where your own code for every loop can be placed:

Code:
/* The formula comes from the equation of the line from the data by Willy C */
/* For this to work, the current sensors must be connected to Analog Inputs 1 and 2 */

#define Amps1     (rc_ana_in01 * 30) - 75
#define Amps2     (rc_ana_in02 * 30) - 75

printf("1st Sensor: %d\n", Amps1);
printf("2nd Sensor: %d\n", Amps2);
__________________
The FIRST Wiki - openFIRST - Ultimate Robot Challenge - URC Wiki
I currently have 50 GMail invites, PM or email me for one.
UC Berkeley Class of 2009

2005 Las Vegas Regional Autodesk Visualization Award
2005 Las Vegas Regional #8 Seeded Alliance with 988 and 1505
2006 Southern California Regional #15 seed
  #7   Spotlight this post!  
Unread 12-02-2004, 10:48
WillyC's Avatar
WillyC WillyC is offline
"handy"
#1347
Team Role: Engineer
 
Join Date: Jan 2004
Location: Ottawa, Canada
Posts: 29
WillyC is on a distinguished road
Re: Current Sensor

Quote:
Originally Posted by HHSJosh
I have written some code for the current sensor, but it doesn't do anything but display the sensor's data. You can put this in the final lines of user_routines_fast.c where your own code for every loop can be placed:

Code:
/* The formula comes from the equation of the line from the data by Willy C */
/* For this to work, the current sensors must be connected to Analog Inputs 1 and 2 */

#define Amps1     (rc_ana_in01 * 30) - 75
#define Amps2     (rc_ana_in02 * 30) - 75

printf("1st Sensor: %d\n", Amps1);
printf("2nd Sensor: %d\n", Amps2);

Be careful here guys. I made a mistake in my earlier post when I quoted the Volts vs. Amps characteristics of the current sensors, which Dale was nice enough to correct. Here are the correct values:

Quote:
Originally Posted by Dale(294engr
]

ACS NOTE RANGE:
1Vout = -75A
2.5Vout = 0A
4Vout = 75A
The characteristic is (almost perfectly) linear between -75 amps and 75 amps. Using this adjusted data you'd find that

I = 50 * V - 125

where I is the current and V is the voltage you measure on the analog input.

Also, in the code above, I think you want to use a Get_Analog_Value(rc_ana_01) in order to convert to an analog voltage. You also want to cast to an integer before printf'ing.

user_routines.h:

Code:
/* Current sensor data */
#define CURR_SLOPE 0.02			// Slope  used in the current calculation
#define CURR_INTERCEPT 2.5		// Y intercept used for the current calculation
#define LEFT_CURR_SENS rc_ana_in01	// analog input 1; used to measure current on left motor
#define RIGHT_CURR_SENS rc_ana_in02 	// analog input 2; used to measure current on right motor
user_routines.c/Default_Routine():

Code:
/* Calculate and display the current going to the two drive motors using analog readings */
 
printf("Left motor current = %d\n", (int) (Get_Analog_Value(LEFT_CURR_SENS) - CURR_INTERCEPT) / CURR_SLOPE);
printf("Right motor current = %d\n", (int) (Get_Analog_Value(RIGHT_CURR_SENS) - CURR_INTERCEPT) / CURR_SLOPE);
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
Current Sensor Output Controls1317 Electrical 5 01-02-2004 23:45
Current Monitoring system questions PyroPhin Technical Discussion 44 17-02-2003 15:34
Quick Optical Sensor Question zorro Technical Discussion 10 21-01-2003 06:39
What else do we want? archiver 2000 63 23-06-2002 23:19
DC Motor current to an Analog Input junkyarddawg Motors 43 04-04-2002 15:53


All times are GMT -5. The time now is 10:46.

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