Help with the Kit Gear Tooth sensors

We are trying to use the KoP’s Gear Tooth sensors.We wired the sensor and are trying to get imput from the sensor but I get a constant 1 which is “i don’t see it” I was just using a simple if then from the rc_dig_in02. I tried interupts before but since I don’t know how to use them I got nothing. So I need some help maybe something I’m doing wrong with the sensor.which way to mount it and program it eventually with interrupts.please help! I’ll be counting sprocket teeth with this sensor

make sure it hasn’t been damaged. last year we had a problem where our sensor worked, but had trouble with it’s count. after noticing this problem, we found it had been damaged.

and how would I know if its been damaged?

Use a multimeter to test the sensor, I believe it shorts signal to ground when a tooth is detected, so an open connection (bad connection or loose wire?) behaves the same as no tooth detected (The RC has pullups, so with no connection, it defaults to 1). See if you can see a voltage change on the signal pin to around 0 volts when there’s a tooth present. If that works then perhaps you aren’t making the right connection to the RC, or you have the digital I/O in question set as an output. Start small, work from there, it’s probably more likely a silly mistake than a damaged sensor. And silly mistakes are fun to laugh at later, so that’s no big deal :slight_smile:

Is your gear made of ferrous metal?

try these sites:
http://allegromicro.com/hall/ats.asp

In our experience the sensor has needed to be dangerously close to the teeth. Think: it needs to be closer to the teeth than the teeth are to each other (at least is the way I think of it, I really don’t know to tell you the truth.)

Good luck,
Robinson

If you just poll it you should get varied responses of 0s and 1s. However you will miss many teeth. So for debugging to see if it works you can poll it but you will need interupts to get the GTS working correctly. If you need help see Kevin Watson’s code.

According to the 2007 Sensor Manual the sensor outputs a pulse, but as chris31 says the sensor should be wired to a digital input port and use interrupts - see Kevin Watson’s code.

If you just try to “poll” for the state of the sensor in user_routines or even user_routines_fast, you will miss most of the pulses. Using interrupt method guarantees the pulse will be counted.

Last year we mounted the sensor securly inside the tranmission gearbox - no problems.

what if we’re not using a regular cim motor. what if we’re using one of those small black motors with a big winch pulley thing attached to it? how do we mount it then? the motor is too small for the sensor to go inside

Hello-

This is how our team integrated and tested the GTS as supplied with the KoPs.

  1. Download from Kevin’s FRC site the latest encoder sample code.
  2. Follow the instructions in the readme. Pay special attention to the part about updating the .h file.
  3. Solder part of a PWM cable to the encoder as indicated in this post:
    http://www.chiefdelphi.com/forums/showpost.php?p=560384&postcount=26
  4. Test-compile Kevin’s code to make sure you’ve got the appropriate files.
  5. Hook up the GTS.
  6. Download/run the program
  7. Grab a pair of ferrous pliers. Tap the black/grey sensor head (you’ll feel the magnetic pull) several times, swinging them back several inches. This simulates a ‘tooth’ moving into and out of the frame of the sensor.
  8. If the counters don’t work, try it on IO1, IO2, and IO3. For some reason our second sensor would only work on IO2.
  9. If it STILL does not work, try a different sensor. Our (real) first one was ‘dead’ and never worked at all.

When you’re done, if you’re trying to integrate a number of different sensors, remember this post here for correct interrupt handling:

http://www.chiefdelphi.com/forums/showthread.php?t=53483