Rotary Encoders

[Update 06/24/2018]

The only change on this page is that, while I am still going to use the Propwash Dual Rotary encoders, I have modified my code to make use of hardware interrupts. In fact, I have just finished writing the new code to do just that. Using interrupts is the most efficient way to do this.

I bought two Elma E37 Dual Rotary encoders and have found them to be unreliable. In my test code I can see that my code is working, but I don’t always get a click to ‘fire’ as it should. Most of the time a click will fire, but not 100% of the time.

In contrast, the Propwash Dual Rotary encoders (which are much less expensive) are 100% reliable and always ‘fire’ on each click, no matter how fast I turn the knobs.

———————————————————————————

While on the surface, it seems that a rotary encoder is a simple component but finding the right ones for this project has proven to be extremely challenging and (initially at least) very expensive!

I am writing about these components with the hope that my experience will help someone else who is building their own flight simulator and may be looking around for single and dual rotary encoders. On my FS1000 FTD project, I need 39 components in all. Nine of these are encoders. I can’t imagine trying to build a full size flight simulator and needing a lot more switches and encoders than what my project needs! Yikes!

Here are some pictures of what rotary encoders look like:

dualrotaryencoders

single-rotary-encoder

elma-knobs

And now, here are some of the challenges a hobby builder faces in finding the right encoders to use.

Encoder Specs. There are a lot of specs associated with encoders and you need to make sure you order the right encoder configuration. There are not many companies who are selling the Dual Rotary Encoders that us flight sim builders need. There are very few in fact.

The other issue is price. I’ve seen dual rotary encoders sell for as much as $60.00 USD, plus shipping, and my project needs 5 of them. That’s $300.00 just for 5 of the 39 components that I need. Not cost-effective at all.

I recently found another source and I ordered one dual rotary encoder from them to see how it works and if it works. It actually arrived today and I have put it on my test breadboard shown below and I am getting back to my C language code and trying to get it to work. I’m not having any luck so far getting it to work the way I need it to work. It is working, but not the way I want. I have an email into the company asking for some configuration help.

These encoders are affordable so I am hoping I can get this one to work and then I can order 4 or 5 more! I’ll probably order at least 6 so I can have a couple of spares! Once I get it working, I will update this post with the website where I purchased it from and their price.

In the meantime, here is a picture of my rotary test breadboard all wired up with a 3.5 Teensy board and a 3.6 Teensy board. I’m testing a single rotary encoder on the right side, which is working great, and I’m now trying to get the code to make the dual rotary encoder work on the left board.

teensy-35-36

For those of you who don’t program or if you do but have not seen any Ardunio C code before, here is a snippet of my rotary encoder C code just to give you an idea of what it looks like.

I’m not going to post much of my code here because I want to keep the option open to sell the FS1000 FTD, therefore, it would become a commercial product and the code would be proprietary and not open source.

unsigned long currentTime;
unsigned long loopTime;
const int pin_A = 3;  // pin 3
const int pin_B = 4;  // pin 4
const int encoderSwitchPin = 5; //push button switch
unsigned char encoder_A;
unsigned char encoder_B;
unsigned char encoder_A_prev=0;

void setup()
{
  Serial.begin (9600);
  while (!Serial & millis() <4000)
  {
  }
  pinMode(pin_A, INPUT);
  pinMode(pin_B, INPUT);
  pinMode(encoderSwitchPin, INPUT);

  digitalWrite(pin_A, HIGH); //turn pullup resistor on
  digitalWrite(pin_B, HIGH); //turn pullup resistor on
  digitalWrite(encoderSwitchPin, HIGH); //turn pullup resistor on
  
  currentTime = millis();
  loopTime = currentTime;
}

Update: I was able to get the code working tonight, the way I wanted, for the Dual Rotary Encoder, including the push switch on the inner knob. This is great news as now one of the biggest challenges of this project, of all things, has been solved!

I said I would identify where I purchased these encoders from and their price so there it is:

https://www.propwashsim.com/node/15

The dual rotary encoders, fully assembled, are $12.50 USD plus shipping. The price includes the knobs.

Kyle provided very timely support to my emails and provided the help I needed to get the encoder working tonight. I just placed an order with them for 6 more!

Here is another picture of my breadboard test setup with the encoder fully wired up (its in the lower left corner):

dual-rotary-encoder-finished

And here is a close up of the Dual Rotary Encoder:

dual-encoder-close-up

 

Saving $$$ on Switches

I want to add a comment about buying cheap parts or inexpensive parts. Sometimes trying to save money will came back and bite you in the ass. For my push switches I bought some inexpensive switches…but they proved to be too cheap and a box of 10 I bought, 3 of them didn’t work. I had to replace two of them after they were installed and wired up. So my advice is, if you’re going to build a flight simulator, don’t always be tempted to buy the lowest cost parts.

On the other hand, in the case of the Elma E37 dual rotatory encoder, an expensive part, I found it to be unreliable. So I guess you never know!

Windows 10 Tablet

I bought an iRULU 10 inch Windows 10 tablet…because it was inexpensive. While it works, it is slow. In fact, upon starting up the Garmin G1000 Training software, I see a dialog box telling me the tablet does not have the minimum performance to run the trainer software. But it will run but very slow performance. So my point in telling you this is that if plan to build a similar G1000 training  device, spend the extra money and get a more powerful Windows 10 tablet than what I am using.