Go to Post I bet if anyone took a look at the 118's Bill of Materials the only thing that would be on there is hard work and that's priceless. - rcmolloy [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 14-01-2007, 14:35
Zoom's Avatar
Zoom Zoom is offline
Lost User
AKA: Umair Nasir
FRC #0369 (Nuts & Volts)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2003
Location: Brooklyn
Posts: 22
Zoom is an unknown quantity at this point
Send a message via MSN to Zoom
Gear Tooth Sensor

Hello
I need help programming the gear tooth sensors. I searched chiefdelphi but didnt find any thing that helped me. im looking for the program for the sensors. I came upon some posts but i couldnt get any thing for the sensors.

Also on the sensors there is j1 and j2 you have to wire them both. like one pwm cable for j1 and one for j2. from reading the manual i think the pwm cables go to rc_dig , right?

Thank you
__________________
A Program isnt finished until the Programmer dies...
  #2   Spotlight this post!  
Unread 14-01-2007, 15:18
Phalanx's Avatar
Phalanx Phalanx is offline
Formerly Team 1089 (Mercury)
AKA: Michael Reffler
FRC #5431 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 1999
Location: Lewisville, TX (previously NJ)
Posts: 384
Phalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond repute
Re: Gear Tooth Sensor

First off, download and read Kevin Watsons encoder code and encoder FAQ
http://www.kevin.org/frc/encoder/
http://www.kevin.org/frc/frc_encoder.zip

To make his code work with the gear tooth sensors you need to remove the "Phase B" logic from it.

Second you wire them to digital I/O 1 and digital I/O 2 with a pwm cable. You also need to power them on a 12volt power supply as well.

See the 2007 Sensor Manual for more information.
__________________
Don't just ask the experts, become one!
Leadership is not about ability. It's about responsibility!
Diagonally Parked in a Parallel Universe. It's okay we do Quantum Physics


  #3   Spotlight this post!  
Unread 14-01-2007, 15:32
Zoom's Avatar
Zoom Zoom is offline
Lost User
AKA: Umair Nasir
FRC #0369 (Nuts & Volts)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2003
Location: Brooklyn
Posts: 22
Zoom is an unknown quantity at this point
Send a message via MSN to Zoom
Re: Gear Tooth Sensor

"Phase B" dont understand this?
"12volt power supply" for teh this do you mean like connecting a wire for the battery to the sensors. thx
__________________
A Program isnt finished until the Programmer dies...
  #4   Spotlight this post!  
Unread 14-01-2007, 15:53
JSonntag JSonntag is offline
Registered User
FRC #0486 (Positronic Panthers)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: United States
Posts: 16
JSonntag is on a distinguished road
Send a message via AIM to JSonntag
Re: Gear Tooth Sensor

1. "Phase B" refers to the code that determines which way the encoder is spinning. Since you are using a tooth sensor and not an encoder, this code will just cause problems.

2. to power on a 12volt supply, run a wire from one of your breaker panels.
  #5   Spotlight this post!  
Unread 14-01-2007, 16:17
Zoom's Avatar
Zoom Zoom is offline
Lost User
AKA: Umair Nasir
FRC #0369 (Nuts & Volts)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2003
Location: Brooklyn
Posts: 22
Zoom is an unknown quantity at this point
Send a message via MSN to Zoom
Re: Gear Tooth Sensor

12 Volt Power with using a victor or just straight from there. What kind of a fuse should we use 40 AMP?

Also PHASE B logic, its located inside encoder.c file however I do not know which part to uncomment directly.

You guys have been a tremendous help so far.
__________________
A Program isnt finished until the Programmer dies...
  #6   Spotlight this post!  
Unread 14-01-2007, 16:48
JSonntag JSonntag is offline
Registered User
FRC #0486 (Positronic Panthers)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: United States
Posts: 16
JSonntag is on a distinguished road
Send a message via AIM to JSonntag
Re: Gear Tooth Sensor

Go directly from the fuse panel, not from a victor. I am not quite sure but i think you should use a 20 or maybe 30 amp fuse. the 40 amp fuses are for the motors.

The phase b pins are used in if statements so that it adds to the counter if it is moving forward and subtracts when moving backward. You basically have to replace it with code that will just add to the counter whenever an interrupt is fired off.

Something like this should work:
Code:
void Encoder_3_Int_Handler(unsigned char state)
{
if(state == 1)
{
Encoder_3_Count += ENCODER_3_TICK_DELTA;
}
}
  #7   Spotlight this post!  
Unread 14-01-2007, 17:57
Zoom's Avatar
Zoom Zoom is offline
Lost User
AKA: Umair Nasir
FRC #0369 (Nuts & Volts)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2003
Location: Brooklyn
Posts: 22
Zoom is an unknown quantity at this point
Send a message via MSN to Zoom
Re: Gear Tooth Sensor

for the 12 volts on the board it says 12 and underneath it there is the letter w meanning the white cable goes there from the pwm cable. so we have to connect that whit cable to the fues to get 12volts.

Also the Encoder Handler's are differnet from 1 and 2. like everything above 2 are differnet. is tehre something special about them? thx for all the help.
__________________
A Program isnt finished until the Programmer dies...
  #8   Spotlight this post!  
Unread 14-01-2007, 18:24
JSonntag JSonntag is offline
Registered User
FRC #0486 (Positronic Panthers)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: United States
Posts: 16
JSonntag is on a distinguished road
Send a message via AIM to JSonntag
Re: Gear Tooth Sensor

The descriptions for the different encoder handlers are in the encoder_readme.txt file included with the code.

I am not sure exactly how to wire up the sensor since i have not yet wired it up myself and have not yet done the research on how to do so.
  #9   Spotlight this post!  
Unread 14-01-2007, 22:39
Phalanx's Avatar
Phalanx Phalanx is offline
Formerly Team 1089 (Mercury)
AKA: Michael Reffler
FRC #5431 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 1999
Location: Lewisville, TX (previously NJ)
Posts: 384
Phalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond repute
Re: Gear Tooth Sensor

To wire the sensor...

Take one end of a pwm cable, and solder it to J2, the black wire to GB (ground-black) the red wire to 5R (+5 volts-red) the white wire to SW (signal white). Connect the other end of this pwm to digital I/O 1.

Take a 2nd pwm cable and solder it to J1, the black wire to GB, the white wired to (12W), the red wire is unused. Connect the other end to a 20amp circut on one of your atc breaker panels.

Mount the sensor from .5 to 2.75 mm away from the gear to be measured.

Repeat this for the second one except connect it to digital I/O 2.

As for the code...
Use encoder 1 and encoder 2, disable the others. Then remove the "Phase B" logic in the interrupt handler for encoder 1 and encoder 2.

If you need more help PM me and I will try to clarify it better
__________________
Don't just ask the experts, become one!
Leadership is not about ability. It's about responsibility!
Diagonally Parked in a Parallel Universe. It's okay we do Quantum Physics



Last edited by Phalanx : 14-01-2007 at 22:43.
  #10   Spotlight this post!  
Unread 15-01-2007, 16:09
Zoom's Avatar
Zoom Zoom is offline
Lost User
AKA: Umair Nasir
FRC #0369 (Nuts & Volts)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2003
Location: Brooklyn
Posts: 22
Zoom is an unknown quantity at this point
Send a message via MSN to Zoom
Re: Gear Tooth Sensor

Thx alot. il try to wire the senor.
__________________
A Program isnt finished until the Programmer dies...
  #11   Spotlight this post!  
Unread 16-01-2007, 15:02
Ultima Ultima is offline
Registered User
FRC #0369
 
Join Date: Oct 2005
Location: Brooklyn, NY
Posts: 26
Ultima will become famous soon enough
Re: Gear Tooth Sensor

Our code looks something like this for Encoder 1 and 2

void Encoder_1_Int_Handler(void)
{
// Encoder 1's phase a signal just transitioned from zero to one, causing
// this interrupt service routine to be called. We know that the encoder
// just rotated one count or "tick" so now check the logical state of the
// phase b signal to determine which way the the encoder shaft rotated.
if(ENCODER_1_PHASE_B_PIN == 0)
{
Encoder_1_Count += ENCODER_1_TICK_DELTA;
}
}

#endif

#ifdef ENABLE_ENCODER_2

Would this work or not?

P.S. If I take away the #ifdef ENABLE_ENCODER_3 from the correct intrrupt would that correctly disable ENCODERS 3 -6. If not was would be the correct way for doing this.

Last edited by Ultima : 16-01-2007 at 15:34. Reason: Clarification
  #12   Spotlight this post!  
Unread 16-01-2007, 15:47
Andrew Schuetze's Avatar
Andrew Schuetze Andrew Schuetze is offline
499 Founder / Alamo FTC & FLL AP
no team
Team Role: Leadership
 
Join Date: Jan 2002
Rookie Year: 2001
Location: San Antonio, Texas
Posts: 689
Andrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond reputeAndrew Schuetze has a reputation beyond repute
quadrature

Reading these posts seems to confirm my thoughts that this sensor doesn't provide rotation direction information. CW or CCW This of course does not render this a useless sensor as one is often powering the motor from which sensor data is being generated. Meaning you already know its rotation and just need rotational speed for closed-loop feedback.
__________________
APS

Founder FRC 499
Parent alumni FRC 2745 & 4219
Co-Coach FTC 4549 & 6407
Alamo FTC Affiliate Partner
Alamo FLL Affiliate Partner
  #13   Spotlight this post!  
Unread 16-01-2007, 18:41
Ultima Ultima is offline
Registered User
FRC #0369
 
Join Date: Oct 2005
Location: Brooklyn, NY
Posts: 26
Ultima will become famous soon enough
Re: Gear Tooth Sensor

Well the sensor is quiet more usuful than that if we can get it to work.
It will provide us with a tooth count with which we can cross reference the speed of the motors and figure out what kind of a distance we traveled.


That is if we can get it to work =\
  #14   Spotlight this post!  
Unread 16-01-2007, 21:10
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: quadrature

Quote:
Originally Posted by Andrew Schuetze View Post
...one is often powering the motor from which sensor data is being generated. Meaning you already know its rotation and just need rotational speed for closed-loop feedback.
It took us a few tries last year to find and correct a small problem with this idea. When turning a small amount, the output from the direction PID can sometimes be too small to get out of the Victor deadband on one side of the 'bot but still drive the other side. What happens is that the entire robot moves forward, while the feedback routine is assuming it's turning in place. We had to ensure that we always applied a high enough control value to the Victors to actually make the motors move in the desired direction.
  #15   Spotlight this post!  
Unread 16-01-2007, 22:46
gnirts gnirts is offline
Suspicious pointer conversion
AKA: Robinson Levin
FRC #1648 (The Gearbox Gangstaz)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: ATL
Posts: 116
gnirts will become famous soon enough
Re: quadrature

Quote:
Originally Posted by Alan Anderson View Post
[...] When turning a small amount, the output from the direction PID can sometimes be too small to get out of the Victor deadband on one side of the 'bot but still drive the other side. What happens is that the entire robot moves forward, while the feedback routine is assuming it's turning in place. [...]
A few questions:
  • How does the entire 'bot move forward with only one motor out of the deadband? I would think it would turn around that wheel.
  • In concert with the GTS, shouldn't the I term correct for this? (since the wheel in theory shouldn't be moving if the signal isn't enough to turn the motor)
  • Just out of curiosty, what is this PID loop for? Is it used during autonomous or driver control?
Thanks,
Robinson
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
Gear Tooth Sensor nukem Programming 9 04-02-2006 20:21
Gear Tooth Sensor Talha Electrical 1 23-01-2006 21:29
Gear Tooth Sensor AMIRAM Electrical 2 22-01-2006 04:09
Gear Tooth Sensor Question (InsrtNameHere) Electrical 2 20-01-2006 02:19
Gear tooth sensor issues Nine9cracker Electrical 2 17-01-2006 02:37


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

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