Encoder design and Algorithm for accurate positioning

LINIX Brushless, VEXTA Brushless, RC Servo, DC Geared, Linear, Stepper, Tamiya.....

Encoder design and Algorithm for accurate positioning

Postby limbq » Wed Dec 07, 2011 10:33 am

I am using dc brush motor of IG32E-05K Planetary DC Geared Motor which having a built in encoder.

1)
Since the encoder input of the IFC dual brush motor card is only support for single channel,
And I need two channel (channel A and channel B) to get the direction and position of the motor,
I can't use the IFC card encoder input,
Thus, I am thinking to connect encoder channel A to encoder input 1 (for the external pull up purpose only) and
connect encoder channel B to encoder input 2 (for the pull up also)'
then connect channel A directly to the RB0 (at the IFC brain board) and channel B directly to the RB1.
I will disconnect the LED resistor from pin RB0 and RB1 from PIC on the brain board.
This setup is so that I can use RB0 and RB1 as interrupt input to keep track on the position of the motor.
Do you think this will work?

2)
Will the encoder output suffer bouncing? Is it an mechanical encoder? Do I need debouching in the software?

3)
I will use interrupt to monitor both the raising edge and falling edge of channel A,
Then at each interrupt will check the level if channel B to know the direction of the motor,
And will counting on the pulse, will know the position of the motor.
Any comment on this algo plan?
Any improvement need? Is this algo creep prove enough?
Or I should monitor the raising and falling edge of channel B as well? and then use the XOR algorithm? will this better compared to my suggested algo?

Pls advise and thanks.
limbq
Newbie
 
Posts: 10
Joined: Wed Dec 07, 2011 9:47 am

Re: Encoder design and Algorithm for accurate positioning

Postby robosang » Wed Dec 07, 2011 3:40 pm

I think Cytron did share an article in ROBOT.Head To Toe magazine about using quadrature encoder. They even have video for it. You might need to check which volume of the magazine they publish the article. Cannot remember, should be this year. Visit their magazine site at http://www.robothead2toe.com.my/. The schematic, source code and article can be downloaded free 8-)

Let me search the video, OK here is it:


Though is not using IFC, but I think you can utilize it.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: Encoder design and Algorithm for accurate positioning

Postby A380 » Wed Dec 07, 2011 4:44 pm

Yes, I think it should be no problem. Do remember set the TRIS for RB0 and RB1 to input. For 4X coding full quadrature encoder, you might need to monitor the both raising edge and falling edge for both A and B channel. If you monitor single channel either A or B only, the resolution will be divided by 2 if compare to 4X coding. You can get the detail about quadrature encoder from ROBOT.Head To Toe magazine Volume 7 and 8 as suggested by robosang. The video shown in last post also using IG32E Planetary DC Geared Motor and PIC18F4431 as controller, it is using RB0/INT0 and RB1/INT1 external interrupt pins to monitor the Channel A and B too. You can get its sample source code and schematic from www.robothead2toe.com.my for your reference.
User avatar
A380
Discoverer
 
Posts: 120
Joined: Tue May 19, 2009 2:44 pm
Location: Malaysia

Re: Encoder design and Algorithm for accurate positioning

Postby limbq » Wed Dec 07, 2011 11:51 pm

Thanks Robosang n A380,
This info really useful to me :D
limbq
Newbie
 
Posts: 10
Joined: Wed Dec 07, 2011 9:47 am


Return to DC Motor

Who is online

Users browsing this forum: No registered users and 6 guests

cron