Hall Sensor working?

We have the ATS665LSG encoders, and we can’t get them to work… Are they just digital ins?? Could someone give me a print statement that has a way of displaying whether its working… Thanks in advance

Yeah, i’m having big problems too.
They are analog ins. I cannot get them to output usable data.
no matter where they are when I start the program, they just float around 0 and 1. Sometimes the value starts at like 50, then every second it drops by like 1 or 2.
but if i move the sensor, it goes back to 0, and once it’s at 0, i cant get it any higher than 1.

theres no consistancy, what kind of value should i be gettnig frmo a working hall effect?

well, we just got it to work digitally, but you have to be pretty close, it should switch between 1 and 0. Thanks anyways guys, i guess we solved our own problem.

The Hall Effect Sensor should output a digital signal. According to the documentation, it converts its analog signal to digital before output. It also appears that it should be positioned between .5 and 2.5 mm from the gear. We just finally mounted ours Thursday night, and it was able to reliably detect the teeth, although we have yet to incorporate it into our code.

Ys, we have them working…and he trick I was not aware of until I “READ THE SPEC” was that they do a self-calibration when you power them on…that is, if they are not powered on “in position”, they do not get the magnetic lay of the land and do not sense teeth too well.

(if that makes sense to anyone)

No, they produce digital signals. But the signals are just a transistor switched to ground, so unless there is a pullup to +5 volts, you will read either an essentially random (and decaying) voltage or ground on the RC analog inputs.

The RC digital inputs provide a +5 pullup resistor, so they’re all ready to handle the Allegro gear tooth sensor with no additional components. (The application note strongly suggests filters on the supply and the output, but you can ignore them if you’re not concerned about electrical noise.)

I looked at the output on our 100mhz scope and did not see any noticeable noise when the sensor was looking at the output sprocket of the kit gearbox. The sensor was on the end of a 36" PWM cable. It may be worse if you tried it on one of the internal gears that moved a lot faster.

Do you have to have interrupts?? or is the fast loop fast enough??

all you need to do is set the counting part of your program in user_routines_fast.c this is plenty fast enough… no need for interupts… (we didn’t need them…) it counted almost everytooth on the last stage gear in the stock tranny running at full speed…

for the code do something really simple like


////in variables section
int numteeth=0; //num of teeth
int lastreading=0;

/// in code
if((rc_dig_in01-lastreading)!=0)  // if the value of the sensor changes then......
{
numteeth++;  // add one to teeth count....
}
lastreading=rc_dig_in01;

also this will count from going from the valley before the tooth to the tooth and then from the tooth to the valley after the tooth… so the tooth count will be double … but this is better…more resolution (half a tooth is more resolution than you can use anyways!)

YES… if you move the counter you need to reset there is a automatic calibration… this is okay to move the sensor if your using a sprocket or something… but if you are using a gear…NO NO NO… get that thing mounted EXTREMELY stable… with in 3-4 mm of the gear teeth… it will not read if it is out of appx. that range.

We’r eusign it on the last sprocket (the one on our wheel) that came with the kitbot. It seems to not count all of the teeth, unless its going pretty slow…

Well, i tried that stuff, and it still wo’t work, where did you guys mount your sensors?? maybe thats our mistake…

Thats odd… it seemed on our robot to count all teeth on the sprocket even at full speed! …
remember the sensor needs to be fairly stable … you guys aren’t just holding it near the teeth to test or anything like that right? (cuz we tried that :smiley: !)

try running some code that will stop the motors after the count reaches a certain number (like the 2Xnumber of teeth on the sprocket…) at full speed the motors will of course not stop in time… but you can see how many extra revolutions the sprocket made… and then see if its ballpark with in the count value…

are you printf the count value? also keep the sensor about 10-15 mm away from the SPROCKET (with gears its different) try different things till it works…

We have it there with a bracket, but it’s probobaly about an inch or so away from the sprocket. with the double chips running at 2/3 speed, it goes 10 revs in “100 teethcount” . But when its at 10 off 127, it goes just about 2 revolutions counting “100 teeth” so thats a problem…