Go to Post The imbalance and vibration is telling you something, you are not listening. - Al Skierkiewicz [more]
Home
Go Back   Chief Delphi > Technical > Control System
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 07-03-2008, 21:45
Guy Davidson Guy Davidson is offline
Registered User
AKA: formerly sumadin
FRC #0008 (Paly Robotics)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Ra'anana, Israel
Posts: 660
Guy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to behold
Send a message via ICQ to Guy Davidson Send a message via AIM to Guy Davidson Send a message via MSN to Guy Davidson
Using Analog Inputs as Digital (on the OI)

Hey folks,

Is there anything we should watch for if we want to use analog inputs as digital? i.e. wire up a binary switch onto one of the analog inputs. Should we wire ground and signal, +5 and signal, or all three?

Thanks,

Guy Davidson

Paly Robotics (FRC #8)
__________________
  #2   Spotlight this post!  
Unread 07-03-2008, 21:52
ebarker's Avatar
ebarker ebarker is offline
Registered User
AKA: Ed Barker
FRC #1311 (Kell Robotics)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Kennesaw GA
Posts: 1,437
ebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond reputeebarker has a reputation beyond repute
Re: Using Analog Inputs as Digital (on the OI)

tie a 10K resistor from +5 to the analog input pin

connect a switch from ground to the same analog input pin

when the switch is closed you will have a 0

when the switch is open you will have full scale analog value (I don't remember if it is 8 or 10 bit or what)

write some code that interprets

half-scale or lower as a switch closed
else
switch open
__________________
Ed Barker
  #3   Spotlight this post!  
Unread 07-03-2008, 21:53
Guy Davidson Guy Davidson is offline
Registered User
AKA: formerly sumadin
FRC #0008 (Paly Robotics)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Ra'anana, Israel
Posts: 660
Guy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to behold
Send a message via ICQ to Guy Davidson Send a message via AIM to Guy Davidson Send a message via MSN to Guy Davidson
Re: Using Analog Inputs as Digital (on the OI)

Ed,

Thank you very much. Sounds good.
__________________
  #4   Spotlight this post!  
Unread 07-03-2008, 23:30
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Using Analog Inputs as Digital (on the OI)

Just as a reassurance, we are successfully using this on our OI panel this year.

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #5   Spotlight this post!  
Unread 08-03-2008, 02:07
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,369
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Using Analog Inputs as Digital (on the OI)

Quote:
Originally Posted by ebarker View Post
(I don't remember if it is 8 or 10 bit or what)
Your description is Spot On.
FYI, RC analog inputs are 10 bits, 0-1023. OI inputs are 8 bit, 0-255.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #6   Spotlight this post!  
Unread 08-03-2008, 09:18
Travis Hoffman's Avatar Unsung FIRST Hero
Travis Hoffman Travis Hoffman is offline
O-H
FRC #0048 (Delphi E.L.I.T.E.)
Team Role: Engineer
 
Join Date: Sep 2001
Rookie Year: 2001
Location: Warren, Ohio USA
Posts: 4,047
Travis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond repute
Re: Using Analog Inputs as Digital (on the OI)

Quote:
Originally Posted by Qbranch View Post
Just as a reassurance, we are successfully using this on our OI panel this year.

-q
As have we, for many years. We don't use the pullup resistor approach - the ground doesn't appear in our method of wiring switches to analog input. I've never had a problem with this method.

Remember, on the OI, you don't need to have a ground connection for an analog input pot reading - on the joysticks, it's just five volts through the joystick axis pot straight to the analog input. We duplicate this method in wiring digital switches to our analog in's.

For devices such as rocker switches or 3-position toggle switches where only one state can be active at one time due to the mechanics of the device, wire two resistors of differing values (each less than 100K - say 10k and 80k - whatever - I like to pick them to have a distinct separation that can easily be tested for in the code) between the +5V and the different poles of the device. 10k on one pole, 80k on the other. Wire the common of the device to a single analog input.

When you actuate the switch, you connect 5V through either 10k or 80k into the analog input, resulting in a distinct numeric value for each position. Use if statements to test for ranges centered around these values and set binary variables accordingly:

Code:
//Wrist Rocker switch on button box
if ((wristrocker > 218) && (wristrocker < 240))  //Wrist Reverse/Up rocker is active
{
  wristfwd_sw = 0;
  wristrev_sw = 1;
}
else if ((wristrocker > 73) && (wristrocker < 95)) //Wrist Forward/Down rocker is active
{
  wristfwd_sw = 1;
  wristrev_sw = 0;
}
else
{
 wristfwd_sw = 0;
 wristrev_sw = 0; 
}
__________________

Travis Hoffman, Enginerd, FRC Team 48 Delphi E.L.I.T.E.
Encouraging Learning in Technology and Engineering - www.delphielite.com
NEOFRA - Northeast Ohio FIRST Robotics Alliance - www.neofra.com
NEOFRA / Delphi E.L.I.T.E. FLL Regional Partner
  #7   Spotlight this post!  
Unread 08-03-2008, 09:20
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al WFFA 2005
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 10,792
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: Using Analog Inputs as Digital (on the OI)

We actually use a simlar method with an 11 position switch and 10 9.1K resistors wired to a joystick analog input, to give us a method of choosing different auto modes.
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
Storming the Tower since 1996.
  #8   Spotlight this post!  
Unread 08-03-2008, 20:19
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Using Analog Inputs as Digital (on the OI)

Quote:
Originally Posted by Al Skierkiewicz View Post
We actually use a simlar method with an 11 position switch and 10 9.1K resistors wired to a joystick analog input, to give us a method of choosing different auto modes.
That's right... we had that problem related to this in one of our practice matches at Chicago. When our automode started one time early on, the arm started trying to fold out while being closed. Turned out, one of the buttons on the OI panel was shorted out (the one for arm fold out) so I figured out that there must be one OI panel read before the autonomous mode enters (as there is one execution of the master uP routine before autonomous mode).

So anyhow, my question for clarification: Al: You guys use a switch on your OI panel, and it gets read by your robot before it starts to run autonomous?

If so... awesome!

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #9   Spotlight this post!  
Unread 08-03-2008, 20:30
Guy Davidson Guy Davidson is offline
Registered User
AKA: formerly sumadin
FRC #0008 (Paly Robotics)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Ra'anana, Israel
Posts: 660
Guy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to behold
Send a message via ICQ to Guy Davidson Send a message via AIM to Guy Davidson Send a message via MSN to Guy Davidson
Re: Using Analog Inputs as Digital (on the OI)

Q, I imagine that the OI is transmitting data throughout autonomous/hybrid mode - it's just that we never find out because it's hands-off.
__________________
  #10   Spotlight this post!  
Unread 08-03-2008, 23:29
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al WFFA 2005
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 10,792
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: Using Analog Inputs as Digital (on the OI)

Remember that the RC starts to run it's (your) program when you turn it on. The OI does not get a autonomous command until much after you power the robot. During autonomous, all OI analog inputs are held at 127 and all digital inputs at "0". See the IFI Programing Ref Guide for more information. I will let the software guys answer coding questions, electrical provides the switch wired to the inputs defined by the software team.
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
Storming the Tower since 1996.
  #11   Spotlight this post!  
Unread 09-03-2008, 08:29
Travis Hoffman's Avatar Unsung FIRST Hero
Travis Hoffman Travis Hoffman is offline
O-H
FRC #0048 (Delphi E.L.I.T.E.)
Team Role: Engineer
 
Join Date: Sep 2001
Rookie Year: 2001
Location: Warren, Ohio USA
Posts: 4,047
Travis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond reputeTravis Hoffman has a reputation beyond repute
Re: Using Analog Inputs as Digital (on the OI)

Quote:
Originally Posted by Qbranch View Post

So anyhow, my question for clarification: Al: You guys use a switch on your OI panel, and it gets read by your robot before it starts to run autonomous?

If so... awesome!

-q
This is from back in the day, but it illustrates exactly how we get OI variables stored in memory for autonomous routines to utilize:

http://www.chiefdelphi.com/forums/sh...37&postcount=3

If you happen to read the rest of the referenced thread, ignore all the dissenting statements - we've used this method for years, and it still works fine, including this season.

Next year, with a new control system - who knows.
__________________

Travis Hoffman, Enginerd, FRC Team 48 Delphi E.L.I.T.E.
Encouraging Learning in Technology and Engineering - www.delphielite.com
NEOFRA - Northeast Ohio FIRST Robotics Alliance - www.neofra.com
NEOFRA / Delphi E.L.I.T.E. FLL Regional Partner
  #12   Spotlight this post!  
Unread 09-03-2008, 09:14
EricS-Team180's Avatar
EricS-Team180 EricS-Team180 is offline
SPAM, the lunchmeat of superheroes!
AKA: Eric Schreffler
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Apr 2002
Rookie Year: 2001
Location: Stuart, Florida
Posts: 561
EricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond repute
Re: Using Analog Inputs as Digital (on the OI)

Just like Al and Travis's teams, we've been using "AiDi"s through the various analog input ports for some years now. Like WildStang (heck we probably got the idea from you guys Al ) we use a rotating 6 to 10 position switch with resistors in series. And, like Travis pointed out, we leave plenty of "room" for selecting which position we want. Here's a sample of how we do it.

Code:
const uint8 AUTONOMOUS_ANALOGS[7] = {6, 140, 160, 190, 210, 235, 255};

uint8 AnalogToDigital(uint8 value, uint8 analogs[])
{
  uint8 loop;
  for (loop = 1; loop <= analogs[0]; loop++)
    if (value <= analogs[loop])
      return ( analogs[0] - loop ) ;
  return 255;
}
The values in the array are the max loop counter, followed the boundaries between which the actual inputs will lie.

Eric
__________________

Don't PANIC!
S. P. A. M.
  #13   Spotlight this post!  
Unread 09-03-2008, 09:47
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 750
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: Using Analog Inputs as Digital (on the OI)

Quote:
Originally Posted by Qbranch View Post
So anyhow, my question for clarification: Al: You guys use a switch on your OI panel, and it gets read by your robot before it starts to run autonomous?
-q
We did this as well in 2005-2006 robots.

Basically we had a thumbwheel through one of the joystick ports. thumb,trigger, aux1, aux2. BCD 1,2,4,8.

When we powered up, we captured the inputs from the joystick to a global varible that was frozen. When auto mode started, we read the global varible.

I had heard of some isses (something changed) in 2007 that it wasn't the same. I think Nathan, our programmer worked through that, not sure what they came up with. So this year, I wasn't sure what to tell them so I suggested to move them since we had so many modes on the robot, we decided to move the thumb wheels back to the RC controller because we have three thumb wheels now.
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #14   Spotlight this post!  
Unread 09-03-2008, 14:50
Mark Pierce Mark Pierce is offline
Registered User
FRC #0085 (B. O. B.)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 1999
Location: Zeeland, MI
Posts: 239
Mark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant futureMark Pierce has a brilliant future
Re: Using Analog Inputs as Digital (on the OI)

Team 85 has used three 12 position switches for several years now. One sets the autonomous path. Others are used for selecting debug information to be sent out the programming port and displayed on the OI. In the pit or on the field we can easily check backup battery voltage, joystick centering, and other values. We also mount a 100K pot to that's handy when developing code or trying out parameters.
  #15   Spotlight this post!  
Unread 10-03-2008, 16:29
Guy Davidson Guy Davidson is offline
Registered User
AKA: formerly sumadin
FRC #0008 (Paly Robotics)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Ra'anana, Israel
Posts: 660
Guy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to behold
Send a message via ICQ to Guy Davidson Send a message via AIM to Guy Davidson Send a message via MSN to Guy Davidson
Re: Using Analog Inputs as Digital (on the OI)

Hmm. I'm just about to wire the switch, and I'm wondering if I really need a connection to ground. Shouldn't I just be able to wire: +5 aux -> 10k resistor -> switch -> analog input, all in series?
__________________
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
We need help with the analog inputs M_dalgashon Programming 4 08-02-2008 17:39
Code to Read the Binary Inputs on Analog Buttons Kingofl337 Control System 5 14-03-2007 11:01
Set Default Digital inputs to Low? How? bad Analog value? Generalx5 Programming 11 04-01-2007 18:57
How do the Analog Inputs work? JBotAlan Electrical 3 07-01-2005 00:11
Analog vs Digital inputs? f22flyboy Programming 8 08-11-2002 22:18


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

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