trouble with encoder obex...
kutalinelucas
Posts: 80
I've been trying to use the "Quadrature encoder" method from the parallax obex (http://obex.parallax.com/objects/24/), but even though it is very well documented, I'm having difficulties getting it working and was wondering if somebody could see where I'm going wrong...
I have a faulhaber motor (micromo 1624...s) with a built in 2-channel magnetic encoder with 10 pulses/revolution.
All I'm looking to do at the moment is turn the motor untill the encoder returns a set amount of pulses, but I've been working so long now I can't see the wood for the trees...
POS[0] doesn't seem to leave zero, and i've tried different encoders to no avail...
Any ideas would be brilliant
I have a faulhaber motor (micromo 1624...s) with a built in 2-channel magnetic encoder with 10 pulses/revolution.
All I'm looking to do at the moment is turn the motor untill the encoder returns a set amount of pulses, but I've been working so long now I can't see the wood for the trees...
VAR word Ratio long Stack[9] long Pos[2] 'create buffer for 1 encoders + delta long Encoder_count OBJ Encoder : "Quadrature Encoder" PUB Init Encoder.Start(11, 1, 0, @POS) PUB Main Ratio := 18000 PUB Toggle | Time Time := cnt repeat WHILE (Encoder_count < 50) Encoder_count := POS[0] waitcnt(Time += 20000 - Ratio) OUTA[10]~~ 'motor1 waitcnt(Time += Ratio) OUTA[10]~ 'motor2 Encoder.Stop OUTA[10]~ RETURN
POS[0] doesn't seem to leave zero, and i've tried different encoders to no avail...
Any ideas would be brilliant
Comments
Your program is still small but already includes a lot of variabilities which could cause the problem.
The main strategy for problem solving is narrowing down the areas where the problem could be.
So a first test-prg would only do
Did you do something similar to check if the encoder-object delivers positions?
keep the questions coming
best regards
Stefan
I have some Faulhaber 16/3k minimotors. They have encoders, but they don't need external transistors.
I was buggering about with the prop program for quite sometime tonigh and i assumed the missing transistor was the problem because the motor PWM routine would only trigger if POS[0]== 0, so the encoder wasn't acatually switching...Either that or I'm not calling the method correctly
The/Their Vcc could go to 3V3, GND to Vss (Prop Gnd), and the ChannelA/Bs to Prop inputs.
The encoder outs are pulled up (de rigeur common emitter switches) so everything is in readiness.
If you run the motor slowly, you should be able to see the outputs change states with a voltmeter