Go to Post every year presents new challenges. What worked well last year might well be a clunker-bot this year. keep an open mind! - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-02-2014, 20:31
Micah Chetrit's Avatar
Micah Chetrit Micah Chetrit is offline
Registered User
FRC #3276 (NSR)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: New London - Spicer MN
Posts: 90
Micah Chetrit is on a distinguished road
Potentiometer

Hello,
Sorry to bug you again, but we are trying to use a potentiometer to set the speed of a motor, but for visualizing what is happening, we are temporarily using a servo in it's place. We wired a 10 turn pot to the analog module on the crio with the signal wire going to the sweeper pin on the pot.

When we move the pot it sets the servo to one of two positions, either fully rotated one way, or fully rotated the other, and it happens after a fraction of a turn from one endpoint on the pot. So if we are fully CCW on the pot the servo is in one position, if we move the pot about 1/16 of a rotation the servo moves to the opposite end. We tried two different pots to make sure it wasn't the pot, and they are both 10k ohms. I don't think I need to wire a resistor in series or anything like that, do I?

I tried using both the GetValue and the GetVoltage functions and have the same issue. Here is the code:
Code:
AnalogChannel *MainPot;
float PotValue;
int Temp;


MainPot= new AnalogChannel(1);
PotValue=Temp=0;


			Temp=MainPot->GetValue();
			PotValue=Temp;
			PotValue=PotValue/1000;
			Servo6->Set(PotValue);
I divided GetValue by 1000 because it is a value of 0-1000 (and the Set Servo is -1 to 1) if I understand it right. I used a temporary variable temp to make sure there was no conflict in changing variable types. When I used GetVoltage I divided by 5 because the voltage is 0-5. Is there something obvious I am missing?
Reply With Quote
  #2   Spotlight this post!  
Unread 15-02-2014, 22:14
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,112
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: Potentiometer

Quote:
Originally Posted by Micah Chetrit View Post
We wired a 10 turn pot to the analog module on the crio with the signal wire going to the sweeper pin on the pot.
What are the other two pins on the potentiometer connected to?
Reply With Quote
  #3   Spotlight this post!  
Unread 16-02-2014, 15:40
Micah Chetrit's Avatar
Micah Chetrit Micah Chetrit is offline
Registered User
FRC #3276 (NSR)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: New London - Spicer MN
Posts: 90
Micah Chetrit is on a distinguished road
Re: Potentiometer

they are connected to the analog breakout as well
Reply With Quote
  #4   Spotlight this post!  
Unread 16-02-2014, 19:24
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,112
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: Potentiometer

What is the voltage on the "sweeper pin" (?) as you turn the potentiometer?
Reply With Quote
  #5   Spotlight this post!  
Unread 17-02-2014, 14:30
Micah Chetrit's Avatar
Micah Chetrit Micah Chetrit is offline
Registered User
FRC #3276 (NSR)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: New London - Spicer MN
Posts: 90
Micah Chetrit is on a distinguished road
Re: Potentiometer

It does read 0-5v, but we noticed that the breakout gets hot when the pot is plugged in (both pots, and both breakouts we have, since we have a spare). My mind goes to some sort of short, but we double checked our power to the breaker, and the pot wiring, and it's good. Ideas?
Reply With Quote
  #6   Spotlight this post!  
Unread 17-02-2014, 15:37
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,112
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: Potentiometer

What manufacturer and part number is the pot, and what is its value? Can you post a clear picture of how you have the wiring connected to it?
Reply With Quote
  #7   Spotlight this post!  
Unread 17-02-2014, 16:14
Micah Chetrit's Avatar
Micah Chetrit Micah Chetrit is offline
Registered User
FRC #3276 (NSR)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: New London - Spicer MN
Posts: 90
Micah Chetrit is on a distinguished road
Re: Potentiometer

We just decided to clean up the crio and cards, and after cleaning everything up it worked again. Not sure what exactly caused it, but I guess we should try to keep a cleaner environment...
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


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

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