DC motor with quadrature encoder (MO - SPG -30E)

Digital Fiber, Photoelectric, Laser Range, Optical, Temperature, Rotary Encoder, Ultrasonic, Gas, Gyro, Accelerometer, FlexiBend, Flexiforce, Compass......

Re: DC motor with quadrature encoder (MO - SPG -30E)

Postby silveroblado » Thu Sep 08, 2011 8:32 am

If I remember correctly!!PID control was given in robot head to toe!!volume 8!!plus u can also see the video!
silveroblado
Apprentice
 
Posts: 32
Joined: Mon Aug 15, 2011 2:30 am
Location: Kuala Lumpur

Re: DC motor with quadrature encoder (MO - SPG -30E)

Postby A380 » Thu Sep 08, 2011 5:31 pm

what is HED-like quadrature encoder? LOL..
You can get the schematic in this video.

User avatar
A380
Discoverer
 
Posts: 120
Joined: Tue May 19, 2009 2:44 pm
Location: Malaysia

Re: DC motor with quadrature encoder (MO - SPG -30E)

Postby silveroblado » Mon Sep 12, 2011 11:06 am

Thanks a lot!!For last couple of days i have been trying the code!!bt not achieving what i need!!I have been trying on proteus and it says some too fast!!Plus the other thing i wanted to know can this code work with 20 mhz crystal!!bcoz i gss cytron guys used 4 mhz crystal to count using encoder!!bt the code allows us to count using any crystal value right!!just wanted to confirm!!bcoz now i m losing my head!!
silveroblado
Apprentice
 
Posts: 32
Joined: Mon Aug 15, 2011 2:30 am
Location: Kuala Lumpur

Re: DC motor with quadrature encoder (MO - SPG -30E)

Postby A380 » Mon Sep 12, 2011 11:32 am

silveroblado WROTE:Thanks a lot!!For last couple of days i have been trying the code!!bt not achieving what i need!!I have been trying on proteus and it says some too fast!!Plus the other thing i wanted to know can this code work with 20 mhz crystal!!bcoz i gss cytron guys used 4 mhz crystal to count using encoder!!bt the code allows us to count using any crystal value right!!just wanted to confirm!!bcoz now i m losing my head!!

20 MHz crystal oscillator should be no problem. Actually higher frequency is better because it is able to execute your code faster.
User avatar
A380
Discoverer
 
Posts: 120
Joined: Tue May 19, 2009 2:44 pm
Location: Malaysia

Re: DC motor with quadrature encoder (MO - SPG -30E)

Postby silveroblado » Mon Sep 12, 2011 1:45 pm

And the last thing I want to know is what the actual function of initA = A; initB = B;

and stopA; stopB;

I cant understand where to put it!!Should I even use stopA and stopB command???

And should I write initA and initB after while(1) or should I write it after while(countAB<20).........if after while(countAB<20), should I write initA and initB in second loop also, which is after while(countAB>10)...........

Because I don't really understand the function of these commands!!

What I understand is initA and initB is for starting sending the data to the PIC and stopA and stopB is for stopping it to do so...But in sample code provided by cytron they say its for stop storing!!
silveroblado
Apprentice
 
Posts: 32
Joined: Mon Aug 15, 2011 2:30 am
Location: Kuala Lumpur

Re: DC motor with quadrature encoder (MO - SPG -30E)

Postby A380 » Mon Sep 12, 2011 2:06 pm

initA = A; initB = B;
stopA = A; stopB = B;

initA and initB are used to save the current state of A and B before start counting the state.
while stopA and stopB are for saving the state once jump out the while counting loop.
User avatar
A380
Discoverer
 
Posts: 120
Joined: Tue May 19, 2009 2:44 pm
Location: Malaysia

Re: DC motor with quadrature encoder (MO - SPG -30E)

Postby andyew » Tue Sep 13, 2011 12:25 pm

Hi

This encoder reader is something like this:
http://www.alldatasheet.com/datasheet-p ... -9710.html

It has basically 2 quadrature outputs, but voltage at 3.2V and 0V.

Thanks,
ANdy
andyew
Greenhorn
 
Posts: 3
Joined: Sun Dec 13, 2009 10:06 pm

Re: DC motor with quadrature encoder (MO - SPG -30E)

Postby A380 » Tue Sep 13, 2011 4:16 pm

What Micro-controller or PIC do you use? Are you using SK40C?
User avatar
A380
Discoverer
 
Posts: 120
Joined: Tue May 19, 2009 2:44 pm
Location: Malaysia

Re: DC motor with quadrature encoder (MO - SPG -30E)

Postby silveroblado » Tue Sep 13, 2011 6:09 pm

PIC 16F877A with SK40C
silveroblado
Apprentice
 
Posts: 32
Joined: Mon Aug 15, 2011 2:30 am
Location: Kuala Lumpur

Re: DC motor with quadrature encoder (MO - SPG -30E)

Postby A380 » Tue Sep 13, 2011 8:26 pm

andyew WROTE:Hi

This encoder reader is something like this:
http://www.alldatasheet.com/datasheet-p ... -9710.html

It has basically 2 quadrature outputs, but voltage at 3.2V and 0V.

Thanks,
ANdy


After referring to its datasheet, if your PIC16F877A remain 5V, input 3.2V still in the range of logic HIGH. So, it should be no problem. Be caution for your encoder input voltage, may be its cant sustain for 5V, read its user manual first.
User avatar
A380
Discoverer
 
Posts: 120
Joined: Tue May 19, 2009 2:44 pm
Location: Malaysia

Previous

Return to Sensor

Who is online

Users browsing this forum: No registered users and 4 guests

cron