![]() |
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 |
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. |
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 |
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. |
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. |
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) |
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. |
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. |
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 |
Re: Gear Tooth Sensor
Thx alot. il try to wire the senor.
|
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. |
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.
|
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 =\ |
Re: quadrature
Quote:
|
Re: quadrature
Quote:
Robinson |
Re: quadrature
Quote:
|
Re: quadrature
Quote:
APS |
Re: Gear Tooth Sensor
First here's the datasheet
http://www.allegromicro.com/datafile/0642.pdf Try to think of it this way...... When the gear is moving forward (CW), as a tooth passes, the digital signal from the GTS goes high (0 to 1 or off to on) and stays high for a specified length of time and then turns off. When the gear is moving backward(CCW), as a tooth passes, the digital signal from the GTS goes high (0 to 1 or off to on) and stays high for a specified length of time and then turns off. What is different between the two is the length of the time that the signal remains high. So besides noting the interrupt or the transition from 0 to 1, you would now also need to know the length of time it remained one. Thus by knowing the time the signal reamained one, based on the datasheet you would know the direction. There is a time range for sensing forward, and a different time range for reverse. Last years sensor was 45microseconds(CW) for forward and 90microseconds(CCW) for reverse. I hope this helps. |
Re: quadrature
Quote:
|
Re: quadrature
Quote:
The PID control was only used for positioning during autonomous, though the code originally also had the ability to use speed control instead of power control for normal operation. I have yet to find a driver who prefers that option. |
Re: Gear Tooth Sensor
Ok, I'm having problems with the gear tooth sensor. I have the sensor wired up correctly and everything, but when I print the value of the digital port, it stays at 0. I have tried puting a gear in front of it in all sorts of postitions. I've tested the power connection and the connection to the rc and it seems all to be right. Am I missing something? Thanks
|
Re: Gear Tooth Sensor
Quote:
Have you configured the port as an input? You probably didn't need to do anything special, because the default code sets all digital pins to inputs in User_Initialization(). How exactly are you printing the value? Show us the line of code that you're using. Once we've determined that you can indeed read the state of the input pin, you're only half finished. Unless you intend to monitor a gear that has only a few teeth going by per second, you will almost certainly need to use interrupts in order to count gear teeth reliably. |
Re: Gear Tooth Sensor
Quote:
|
Re: Gear Tooth Sensor
this is what it looks like :
Code:
printf("%d\r",rc_dig_in01); |
Re: Gear Tooth Sensor
Hi, sorry for bumping in, but we just recieved the 2 GTS pieces and we'd like to know how exactly do we use it?(where do we connect, what values to we use, what we need to code or what code to download to make it work etc..)
|
Re: Gear Tooth Sensor
Quote:
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. 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. |
2007 Gear Tooth Sensor (GTS) - does indicate direction
i just wanted to clear up a misconception, the GTS 2007 does indeed indicate the direction but in a manor different than the 2006.
reading the datasheet for the sensor, http://www.allegromicro.com/datafile/0642.pdf we see on page 10 that if the gear rotates past the sensor in a 'pin 1 to pin 4' direction, then the output produces a square wave pattern, about 50% duty cycle. but if the same wheel rotates past the same sensor the other direction, now pin 4 to pin 1, that same square wave pattern is produced BUT the signal is inverted! now... who wants to provide the code for this :p slloyd |
Re: Gear Tooth Sensor
From what I understood from our mentor, the GTS has 4 holes to insert 4 certain screws that are supposed to "tick" with the gear teeth. Those screws are to be, as you say, .5 to 2.7 mm from the certain geartooth?
And another thing, Kevin mentioned this illustration in his Encodr FAQ: http://kevin.org/frc/encoder/encoder_isr_latency.pdf What is this illustration about? And even furthermore, why are there 6 encoder counts in Kevin's Encoder code(we did understand that the first 2 are to calculate velocity of the gear teeth, the 3rd and 4th for the positioning[in relation to the begining point in each intialization of the RC and everything])? And could someone please send an exact illustration how to connect the GTS to the geer tooth or a picture of a team's GTS connection? |
Re: Gear Tooth Sensor
Quote:
The GTS board has two holes. Those holes are just for mounting the board in place. The actual sensor part is a black block at the edge of the board. Its face should be placed a millimeter or so from the teeth of a rotating steel gear. Nothing on the board touches the gear. It senses the passage of teeth by detecting changes in the magnetic field around the sensor. |
Re: Gear Tooth Sensor
OH, SWEET!!!:D :cool:
So could you answer my other questions related to Kevin's Encoder code? |
Re: Gear Tooth Sensor
Ok, I understood how to connect the GTS....well, except for the connection to the 20 AMP one. How do we do that?
And what's with the phase B, what is it, what's the illustration in Kevin's FAQ and what do I need to do with it in Kevin's Encoder code to make things work? |
Re: Gear Tooth Sensor
Quote:
Quote:
The illustration I believe you are referring to shows how a too-fast quadrature signal can be misread if the software is not responsive enough to process an interrupt before the signals change. It is not relevant to the Gear Tooth Sensor. (A different problem is possible if the GTS interrupt rate gets too high, but "too high" in this case means more than several thousand pulses per second.) If you use inputs 1 and 2 and leave the associated phase B inputs disconnected so they remain high, I think Kevin's encoder software will work without modification. To change it so that it works specifically with a single-phase pulse instead of a quadrature signal, just remove the test for the level of the phase B input, and make the code always increment the counter when the interrupt occurs. If you want to, you can get fancier and choose whether to increment or decrement the counter based on which direction you think the gear is turning. |
Re: Gear Tooth Sensor
Quadrature signal??? (O_o')
|
Re: Gear Tooth Sensor
our team's head programmer (GO 1221!!) got the encoder going earlier this week. the posts on this message board and kevin's code/FAQ were invaluable.
now... what to do with this information? we would like to use it to help the mobility of our robot become smooth and accurate. i have read the FIRST document for PID control of motors, it was linked somewhere but i forget now. seems this is a good match and is the right way to go. but, looks really tough to program. maybe need floating point math? also, has anyone successfully determined which direction the gear is rotating (see my earlier post that proves it IS at least possible with 2007 sensor). i'd appreciate your comments if you have. slloyd |
Re: Gear Tooth Sensor
Just realized, haven't got an answer from this question and the programming sub-team is about to start working soon, so if we could get assistance we that we'll be able to work on this encoder faster.
So, anyone, quardrate signal and stuff? Anyone knows? |
Re: Gear Tooth Sensor
Is that last question asking for an explanation of Quadrature Output? OK if it is, Wikipedia has a pretty basic one and there are a lot others but look at
http://en.wikipedia.org/wiki/Rotary_encoder And scroll down to the section headed "Incremental rotary encoder". They also explain that backward count problem so kudos to them for being through. This same theory applies to rotary and strip encoding schemes so the entire article is a good read. Hope that's what you were asking. Steve |
Re: Gear Tooth Sensor
Thank you, that was an excellent read! :D
I even tried with the mouse (yes...I admit..I use old mouses :rolleyes: ) and if I spinned one of the "scrollers" top fast the mouse on the screen actually bounced to the other side and then back! :D I think I might have a question about the "two sensors" thing. I belive the GTS has those "two sensors" (as in Phase A and Phase B) inside them, is that correct? I'm just quite tired now and I don't think I'll be able to go over the encoder code now, but I'm hoping to do so tommorow and maybe finally understand how to work with this stuff. :) Thanks again. |
Re: Gear Tooth Sensor
Quote:
Single GTS is intended to give you theoretical distance traveled on a wheel but you keep track of direction by knowing WHICH direction you are driving the motor. IN other words if my PWM is > 127 and I get a signal I add to my counter... < 127 and I get a signal then I subtract from the count. Same with a relay driving a motor. if the forward direction is set and the interrupt occurs you add to the count...well you get the idea. Rotary optical encoder have two sensors built in at 90 degree offsets so they are very accurate and directional information comes from knowing what the previous state was... or in hardware by using a simple flipflop. clocked by the A phase. (See the banebot encoder schematic for their divider page 5 of the manual http://banebots.com/pc/ELECTRONICS/EN-A0001-KT ) Now ALL this tells you how much the motor and wheel have rotated but do not take into account slippage of the wheel to the ground, so one more "fly in the ointment" ( Where do we get these old sayings anyway? ) OK that's my piece for now Steve |
Re: Gear Tooth Sensor
Quote:
|
Re: Gear Tooth Sensor
Ah! I see what you are saying... you kill power but the bot still rolls. Well ok you have to "remember" which direction you were rolling and allow the bot to come to a complete stop... before changing direction with a single GTS. Yes in that case Quad is preferable.
But probably not a problem with something like positioning an arm. In any case... this is still a "dead reckoning" scheme so it's an approximation anyway. (If it were easy it wouldn't be worth doing. ) In an aside... to obtain Quad with GTS... one suggestion has been that : 1) using a gear with an odd number of teeth. 2) using two GTS 3) IF you carefully position them at 90 degrees to the gear center, you get a 90 degree phase shift and can treat them as an A B phased encoder. I haven't done the math on this but it seems plausible. Steve |
Re: Gear Tooth Sensor
Quote:
Has anyone actually done this? My gut feeling is that the trouble of mounting and keeping two GTSs aligned out of phase would be more trouble than just using an encoder. I'd love to hear from anyone who's done this with the kit GTSs though! |
Re: Gear Tooth Sensor
I have been wiring up the Gear Tooth sensor boards and found that there are two of them but the labeling on one has J1 & J2 while the other has J4 & J5.
We have two sets and I found that the J4 & J5 sensor boards do not work while the two J1 & J2 sensor boards work. What is the difference? |
Re: Gear Tooth Sensor
|
Re: Gear Tooth Sensor
We know how to wire our gear tooth sensor, but how do we put the wires through the gearbox to the board. Anyone have any solutions to sending the wires through the gear box to the board, is there a certain way to run the wires?
|
Re: Gear Tooth Sensor
Quote:
|
Re: Gear Tooth Sensor
Quote:
Good catch! One of our boards worked, the other didn't. I wonder if it is the same one like you found. The first one we separated from the other boards worked, the second didn't. Could there be a flaw in the board or manufacturing? We have given up on the FIRST GTSs. Only 1 worked and replacements are not available. We will be posting pictures of our gearboxes outfitted with a different COTS gear tooth sensor that is relatively inexpensive ($25). Tonight we proved that they work great on the AM gearboxes and had IR-stimulated autonomous code running. |
Re: Gear Tooth Sensor
We have the same problem with only one sensor working. We tested it and we have a reading of 3.6 volts on the signal cable when it is suppose to read 0 or close to it.
|
| All times are GMT -5. The time now is 20:48. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi