Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:31 26 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Rotary Encoders

Author Message
steveizett
Newbie

Joined: 15/05/2012
Location: Australia
Posts: 21
Posted: 02:20pm 11 Sep 2012
Copy link to clipboard 
Print this post

Hi Guys

Has anyone implemented reading a Rotary Encoder on the Maximite.
I dont have time to try and work it out. Just want to pinch an existing tried and tested setup.

Cheers

Steve Izett
 
boss

Senior Member

Joined: 19/08/2011
Location: Canada
Posts: 268
Posted: 04:24pm 11 Sep 2012
Copy link to clipboard 
Print this post

Hi Steeve,

yes, I did it with ENC128 optical encoder from Bourns long time ago. It was pretty simple task just few lines of code. Here is the "Test code".

Setpin 31 , 6 , L001
Setpin 32 , 2
P = 0 : M = 80 : N = 15000 : V = 0
Do
If P > M And P < N Then Sound P , 200
Loop
L001: ' CW
V = Pin(32)
If V = 1 Then P = P + 1 Else P = P -1
Print " " ; P ; " " ; Chr$(13);
Ireturn

Regards
boss
 
steveizett
Newbie

Joined: 15/05/2012
Location: Australia
Posts: 21
Posted: 03:19am 13 Sep 2012
Copy link to clipboard 
Print this post

Thanks Boss

Being optical I guess that contact bounce is not an issue.
They appear much more expensive than the mechanical contact variety.
So I could use the mech version I have and use either hardware debounce or put some delay into the read of pin 32 which is not so good in an ISR.

Cheers

Steve Izett
 
boss

Senior Member

Joined: 19/08/2011
Location: Canada
Posts: 268
Posted: 04:52am 13 Sep 2012
Copy link to clipboard 
Print this post

Hi Steve,

I choosed the optical one for resulution 128 pulses/rotation and I was also tested the mechanical one with 32pulses/rot. If I remember well, I used 4k7 resistor to Vcc and multilayer capacitor 2M2 (2.2uF) to GND. The optical one was on Ebay around $10 which is not bad.

Regards
boss

 
steveizett
Newbie

Joined: 15/05/2012
Location: Australia
Posts: 21
Posted: 10:32pm 13 Sep 2012
Copy link to clipboard 
Print this post

Hi Boss

I used the mechanical encoder I had with some hardware debounce and she works like a beaut.
Thanks very much.
Steve
 
boss

Senior Member

Joined: 19/08/2011
Location: Canada
Posts: 268
Posted: 04:34am 14 Sep 2012
Copy link to clipboard 
Print this post

Hi Steve,

nice to hear that. If you don't mind please publish the details about debouncing for others. Most people include myself are looking here before they started a project.

Regards
boss
 
steveizett
Newbie

Joined: 15/05/2012
Location: Australia
Posts: 21
Posted: 05:04am 14 Sep 2012
Copy link to clipboard 
Print this post

Altronics S3350 Rotary Encoder $4.50 - 20 pulses/360deg

Setup as follows:
Common to 0v
Two outputs via 4K7 to Vcc (3.3v) and 104 caps to 0v
I'm using the D0 & D1 inputs on the Colour Maximite.

Functions flawlessly with normal rotation of the encoder.
When rotated very quickly (beyond normal use) it fails to read.
I haven't checked how noisy the outputs are on my CRO at this stage.

Code, pretty much identical to that listed by Boss earlier in this thread except interrupt triggered on negative going pulse.


Steve Izett


 
boss

Senior Member

Joined: 19/08/2011
Location: Canada
Posts: 268
Posted: 05:19am 14 Sep 2012
Copy link to clipboard 
Print this post

Hi Steve,

this corresponds with my earlier tests. I used inexpesive ebay product 32pulses/360deg.

I experienced the same difficulties use encoder at excessive speed. That's why I increased capacitors value. Inreasing the capacity beyond 2.2 uF gives no further improvement. The best cap value will depend on particular encoder you have to tray it.

Regards
boss
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024