#Rotary Encoder - Settings?

1 messages · Page 1 of 1 (latest)

warm radish
#

So I have some rotary encoders that Have Push Pull switches, but encoder section is probably not the best. The only setting that works with these is 4 detents per cycle, the other four settings don't even respond. The 4 detents per cycle works when turning fast, but also takes a lot of turns to turn speed up on the FBW A320NX. Is there a way to increase the values quicker?

neat sentinel
#

You mean this encoder is failing? Why not replace it?

#

AFAIK there is no way to change the speed increment for the autopilot spd knob in this aircraft.

clear dune
#

it might help if you share a bit more info about such encoders - datasheet or shop link.

warm radish
#

No the encoder is not failing. Horizontal rotary encoder RK097 self-locking push-pull shaft 20 positioning pulse digital potentiometer, from Ali Express. Use these because of the compactness and the in out action, which I have made mounts for the Push and Pull buttons to be activated. I would just like to not have to turn the dial so much to adjust values. wondering if there is a way to add a variable to make these more sensitive. https://www.aliexpress.com/item/4000865492540.html?spm=a2g0o.productlist.main.53.130d8vaA8vaAMG&algo_pvid=d0b82c92-114b-4ea0-a7f0-4508d6c5a132&algo_exp_id=d0b82c92-114b-4ea0-a7f0-4508d6c5a132-26&pdp_npi=4%40dis!CAD!3.39!3.39!!!2.42!!%40210307c117006922244778058e9dbc!10000009730005856!sea!CA!2351904085!&curPageLogUid=XgOcxbta0f8w

clear dune
#

ok so how did you wire them?

#

they seem to have just 3 contacts?

#

you can configure the two side pins as switches and see what kind of code they output

#

encoders that mobiflight supports have phase-shifted waveforms so they are like this

#
0101010101010101
1010101010101010
#

so that one pin goes high and the other follows later

#

I have also seen encoders from ALPS (that these likely are too), they look very similar to ALPS) that also split the signal to two pins

#

so one pin is only left turn pulses and the other is only right turn pulses

#

so you could configure them as simple buttons to see what kind of a signal it is

#

then turn them slowly one click at a time and see how it goes

#

it should be like this for the MF supported encoders

warm radish
#

Um Like a normal 3 wire encoder, They work but as I said above only when I select 4 detents per cycle which is why I think they need so much

clear dune
#

the actual clicks can be either between every change, or at full cycles

#

so do they make one "right" or "left" event per click?

#

or does it take several?

#

the different types are related to this

warm radish
#

Several

#

When I used them before using SimVim they didn't seem to have this problem, but that was also XP-11

clear dune
#

yeah I guess the question is what kind of signal they output

#

usually most encoders fall into one of the four options

neat sentinel
#

I searched for the datasheet for RK097

#

says it is a potentiometer???

clear dune
#

there are many variants of those usually

#

and in aliexpress the name can be anything

#

but if it works as an encoder, even if slow, it cannot be a potentiometer

neat sentinel
#

I don't understand how the wiring goes with only three terminals

#

if you have push, pull switching and encoder? You need three terminals just for an encoder turning right and left.

clear dune
#

not sure if the switch is connected? could be just to pop out the knob from a panel

#

some car audio systems have such flush knobs

neat sentinel
#

I give up.

clear dune
#

but yeah, I also noticed it has just 3 contacts?

warm radish
#

OK Rotary Encoders have 3 Terminals, Center is Ground the other two go to you digital inputs. The switches have Zero connection to the rotary encoders Always! The encoder I showed you is only an encoder, I 3d Print an assembly with 2 switches for push and pull, which the design of this encoder has enough travel in and out to accomplish. with these and my 3D printed switch holder the footprint fits inside a 28mm dia circle. You get it now?

neat sentinel
warm radish
#

Ok in logging, every single click shows a left and right single entry. Why should it show a left entry and at the same time a right entry on the line below at every click even though I am turning in one direction only. Do I need to install Diode or Cap ?

clear dune
#

is this now with pins configured as buttons?

#

or as encoder?

#

the encoders make a signal on both pins but the pin that goes to 1 first determines the direction

#

so the encoder reading code handles all that

#

and converts that into left or right events

neat sentinel
#

Yes, and you should only see exactly one right or left event per click depending on the turn direction.

#

I think you should try again the other types of encoder types and see how they register in the log.

clear dune
#

just to clarify: configuring the pins as separate button inputs lets you see what kind of signal the encoder puts out, but it is just for that, for actual use configure it as an encoder, and usually one of the 4 variants works, unless the encoder is something different than commonly found ones

neat sentinel
#

There should not be a need for diodes or caps as Mobiflight is just listening to both pins and determining which one goes to 1 first.

warm radish
#

Ok logging was a good suggestion, these encoders seem to put out a CW and CCW pulse no matter which way I turn them. Puts out both pulses. Weird part is these came from my SimVim airbus setup and worked for a few years that way, with a Mega 2560 same as now. But after Much Much testing all other types of encoders I have work just fine, its just these ones (:( . Major set back now to get a push pull encoder setup again in this tiny footprint

neat sentinel
#

did you try testing with the other encoder types?
show screenshot of the encoder device config in Mobiflight Modules

#

also a screenshot of the input config for these encoders, please

clear dune
#

yeah practically all encoders put out pulses on both pins. It is the order which switches first that determines the direction

warm radish
#

Well if I drop either the Left or Right code it works fine lol, but thats not practical so will work on different solution

clear dune
#

I mean the "configure it as button" is just a way to see what kind of signal it outputs

#

not a way to configure it as an encoder (unless it really would split the signal to left or right pin, those exist too)

neat sentinel
#

Can you please post screenshots of your device and input configs

warm radish
#

Why Jaime? Its an Encoder, as created under my mega board, it has pins 40 and 41 assigned, tried all settings and found only the 4 variant would give any reading when turning, Tried a whole bunch of input configs, they work with better encoders that I have, just not the ones I wanted to use with the sliding shaft. No worries proto type redesign is already in the printer as i speak.

neat sentinel
#

Ok, as you wish. I tested all encoder types with my EC11 encoders and could not reproduce anything remotely resembling the behavior you have. The EC11 did not once generate both a CW and CCW event when turning in any direction.

clear dune
#

yeah, did the config-as-buttons show something different there if you look at the button pressed or releases if you turn one click at a time first forward, then backward, and then one direction and switch direction? It has to somehow be different if the other encoder types did not pick up anything

warm radish
#

New revised Airbus Push Pull encoder, with a better encoder on bottom and pull PB function, same small footprint. 🙂 Tuomas the encoders I wanted to use are just really cheap, and I think they are maybe worn out, hence the new redesign with the better encoder at the bottom.

clear dune
#

there is also a design on github

#

also there was some designs on #1148707070128955402 I think

#

yours is more compact though

warm radish
#

Back again!!! Does Mobiflight work well for anybody with rotary encoders? I have changed my encoders as above, and the ones I am using now work beautifully on Arduino Pro Micro, But mobiflight sure doesnt like them. If I set the value for CW (Right) only then the encoder behaves normally, but as soon as I add a value to the Left Tab (CCW) then it jumps all over the place, goes up sometimes even though turning left and visa versa. I have tried all 5 settings for the encoder and only the 4 detents per cycle seems to register with mobiflight. Do I need to add some variables somewhere? or just give up and wire in an Arduino Pro Micro or Teensey 4.1 with code that seems to have no problem with these encoders?

warm radish
#

One "Click" CW gives the following log file entries: MobiFlight A32NX => SPD => RIGHT => executing "Speed Encoder" , MobiFlight A32NX => SPD => executing "Speed Encoder" Turning Fast just adds the RIGHT_FAST to the above . And what is the message that scrolls continuously in the log file: Warn Exception on NCalc evaluate =>0 , which is always duplicating

neat sentinel
#

I have four KY040 and 10 EC11 rotary encoders in use. Zero issues.

warm radish
#

Lucky You

neat sentinel
#

what kind of encoder are you using?

#

I think there is not too many ways to go wrong

warm radish
neat sentinel
#

Three terminals for the encoder function A, GND, B. In all my encoders the middle terminal is GND and the side terminals are A and B. If you misconnect A and B, the worst you get is the firmware thinks you are turning to the reverse side, which you usually can fix by just inverting the pins in the device config.

#

I see nothing special about those encoders you linked.

#

The Mobiflight log should register exactly one right event per click when turning CW and exactly one left event per click when turning CCW

warm radish
#

Not my first rodeo

neat sentinel
#

ok good for you.

warm radish
#

Just saying these were all built on Arduino Pro Micro's and the GNS 1000 was built with Teensy 4.1 board, and all encoders work just fine, I just cant get Mobiflight to play ball

cinder jolt
#

Encoders work fine with Mobiflight

#

if they aren't working for you share the following:

  1. Screenshot of the module config dialog for the encoder
  2. Photo showing the wiring of the encoder
  3. A screenshot of the input config for the encoder, in a file that has no other input or output entries configured
  4. The complete log.txt file when Info level logging is enabled
clear dune
#

you should get exactly the same log entries as you click through the detents

#

except for that fsuipc log entry

#

precisely one per detent, and the direction should also exactly match - if not, then the type is wrong

warm radish
#

ok what is my warning "Warn Exception on NCalc evaluate => 0 which is always duplicating, is this a problem I have elsewhere?

cinder jolt
#

Ignore it, unrelated to your problem. Unless you post the four things I asked for above nobody is going to be able to assist you further

#

Getting snippets of log messages here and there is just wasting everyone's time. We need to see the four things I mentioned so we can have a complete picture of your setup to see if we can figure out what the issue is.

warm radish
#

Ok I will work on getting the info as requested. Sorry for tone been a rough two days trying to move this along. The Max 7219 board driving my V/S with the cold solder joints wasted 4 hrs yesterday trying to figure that one out.