Jump to content

encoder jitter/bounce


WickedBlade
 Share

Recommended Posts

Hello again,

my application is working rather fine as far as inputs and outputs are, but I'm experiencing a slight problem with encoders.

I have 2 of them, they work almost always fine but I experience strange increment values from time to time. My test app just displays a value between 0 and 99 on the LCD and the encoders are used to increase/decrease the unit and ten digits respectively.

So if I start at 00 and I turn the unit encoder clockwise I get 01 then 02 etc. But it sometimes happens that the value jumps around, for instance it goes from 02 to 07 instead of 03. It's the same with both encoders. I can also get positive increment when turning CCW sometimes.

I'm not sure, but it seems to be more frequent when I turn the encoders very slowly. These are detented encoders and by slowly I mean staying out-of-dents for a short time.

I've currently declared them as DETENTED2.

Is this a problem with the detented type, or is it a speed value, or is it simply that my encoders are not the best quality and I get bounce from time to time? If so, how would I go about fixing this in software?

Any idea?

Thanks!

Link to comment
Share on other sites

Thank you for your help, TK.

I updated to MIOS 1.9g (and rebuilt my app with MIOS base 1.1 of course) and tried all the detented modes. Only mode DETENTED2 worked (almost) correctly, the other modes gave completely incorrect increments.

I played a bit with the MIOS_ENC_SpeedSet too. It was initially set to fast mode, with a speed of 2. I tried slow mode (with speed 0) and normal mode, and also a couple other speeds in fast mode.

The normal mode is the one that gives me the less incorrect behaviour. This is kind of expected, since apparently I'm getting jitter, which the fast mode would interpret at a greater speed, hence bigger increment values.

Any idea what I could do to avoid this jitter? I rather liked the initial Fast 2 mode...

Link to comment
Share on other sites

Hi,

You can try to identify the bad transitions and use a custom detent-mode. Therefore, instead of MIOS_ENC_MODE_DETENTEDxx, use 0x01, 0x02, 0x04 and 0x08 to test increments, and 0x10, 0x20, 0x40 and 0x80 for decrements. Try them one after another in normal speed-mode and note, which show jitter and which are jitter-free for a full revolution of the encoder.

to get a behaviour like DETENTED2, you need one jitter-free increment and one decrement. For DETENTED (resp. DETENTED1) you need two jitter-free test-modes for increment and two for decrement. Then you can sum up the working test-modes to a custom mode and use that for your application. remember to add the modes in hex!

Just an example: let's assume, the following test-modes are jitter-free: 0x02, 0x08, 0x10, 0x40, 0x80.

to get a custom DETENTED2-like mode, you could use 0x02 for increments and 0x10 for decrements, summing up to 0x12 as your custom-mode.

to get a DETENTED1-like mode, you could use 0x02, 0x08, 0x10 and 0x80, resulting in 0x9A as custom-mode.

I hope you can find a working enc-mode that way.

best regards,

Alex

Link to comment
Share on other sites

I... think I understand what you're saying. I suppose this is explained in the topic that TK mentioned, but I don't speak german at all...

So if I got it right, I can specify custom modes instead of DETENTED2, DETENTED3 and all, just by choosing one of 4 available modes for increments and decrements. That would make for 16 possibilities.

I'm not sure this will help, because if I use a mode other than DETENTED2, the increments are no longer units but bigger figures... But I'll try anyway, it can't hurt...

Thanks.

Link to comment
Share on other sites

I just finished the graphics to illustrate the new modes and also how to create custom modes. It is attached to my last post in the topic, TK quoted. with the graphics, it should be easier to see, how a custom mode might solve your problem.

good luck!

Link to comment
Share on other sites

I just finished the graphics to illustrate the new modes and also how to create custom modes. It is attached to my last post in the topic, TK quoted. with the graphics, it should be easier to see, how a custom mode might solve your problem.

good luck!

Oh, I see. They are actually flags that I should sum up. I haven't had the time to test yet, but seeing as I have the datasheet for my encoders, with a diagram, I could perhaps guess the correct values, right?

The datasheet is there: EN12 encoder

The diagram is at the bottom of the last page. I would have thought that it was a regular DETENTED2 encoder, though...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...