Welcome to Cockpitbuilders.com. Please login or sign up.

October 27, 2021, 03:22:11 PM

Login with username, password and session length

PROUDLY ENDORSING


Fly Elise-ng
24 Guests, 0 Users
Members
Stats
  • Total Posts: 57844
  • Total Topics: 7691
  • Online Today: 26
  • Online Ever: 582
  • (January 22, 2020, 08:44:01 AM)
Users Online
Users: 0
Guests: 24
Total: 24

COUNTDOWN TO WF2021


WORLDFLIGHT TEAM USA

Will Depart in...

Recent

Welcome

Encoders and Leo Bodnar Boards

Started by Joe Lavery, September 06, 2021, 09:12:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joe Lavery

September 06, 2021, 09:12:14 AM Last Edit: September 06, 2021, 09:14:33 AM by Joe Lavery
Hi all,

I'm having some trouble with some Chinese encoders attached to a Bodnar BU0836X board.
It's part of a Cessna panel project that is pretty much finished but the Encoders are not behaving as they should.

I have set six of them into the face of the panel, to be able to adjust the heading bug, VOR's etc.
I have added the encoders to the Bodnar board using their small utility, but I can't get hold of the specifications for these cheap EC11 encoders. So I'm not sure how significant that might be.

I'm using FSUIPC to interface them to P3D but again the information for encoders is a bit sketchy, or I can't find it.  8)
I know some of you have used these components successfully, so can you point me in the right direction?
I've attached an image of the offending unit.

Also I realise it would probably be easier to do this with an Arduino. But the project is the subject of an article designed for new users, so I thought the Bodnar board would be an easier option for them to begin with.

Thanks
Joe.
Life isn't about waiting for the storm to pass, it's about learning to dance in the rain

Journalist - writer for  PC Pilot Magazine


RayS

September 06, 2021, 01:55:16 PM #2 Last Edit: September 06, 2021, 01:55:56 PM by RayS
Hey Joe~

If you are still stuck, I'd suggest you go to what's called a Knitter Switch.

They are nearly identical to a rotary encoder, except the body is a little deeper.

They have 4 contacts: Rotate it one way and one set provides momentary pulses

Rotate it the other way and the other set of contacts provides momentary switch events as the knob goes through each detent.

The only drawback is they are extremely difficult to come by.

I have several from ALPHA, the only markings on it is: 9F2

If you want I can send you a few samples. They should work perfectly with the Leo card without any additional software/hardware (Except maybe a few pullup resistors)
Ray Sotkiewicz

Joe Lavery

Quote from: iwik on September 06, 2021, 12:28:09 PMJoe,
Data sheet here
https://docs.rs-online.com/abd7/0900766b80f4c221.pdf

Thanks for the data sheet Les, the encoders have 20 detents which is why I can't find to actual data. They are typical of eBay and Ali-express products that are difficult to identify.
My own fault for buying cheap...  :D 

Joe
Life isn't about waiting for the storm to pass, it's about learning to dance in the rain

Journalist - writer for  PC Pilot Magazine

ame

I bought some of those. Here's a link:

https://m.aliexpress.com/item/32778955771.html

They are called rotary pulse switches.

I wouldn't recommend them for beginners because they are much less common, harder to find, and more expensive. They look very similar to rotary encoder switches, but they work differently and there is very little information out there for beginners to latch on to. Of course, with statements like mine it becomes a self-fulfilling prophecy.

What exactly is wrong with the setup you have, Joe? Does it work at all? How have you connected the switches? How have you configured the Bodnar software?

Joe Lavery

Quote from: RayS on September 06, 2021, 01:55:16 PMIf you want I can send you a few samples. They should work perfectly with the Leo card without any additional software/hardware (Except maybe a few pullup resistors)


Thank you very much Ray for the info and your kind offer. I was aware of the Knitter Switch but as you say they are not widely available. My old mate Ian Sissons introduced me to them some time ago... How I miss chatting to him!  :-\

Since posting I have tried a number of different configurations and have managed to get then working, yet very slowly.
Using FSUIPC is not ideal because (I don't think) you can apply two setting for slow or fast turning of the encoder. It's easy to do with Mobiflight but that introduces another level of understanding for the new builder; which I'm trying to avoid.

I imagine someone will jump in and tell me it can be done... EASILY.  8)

Kind regards
Joe.
Life isn't about waiting for the storm to pass, it's about learning to dance in the rain

Journalist - writer for  PC Pilot Magazine

Joe Lavery

Quote from: ame on September 06, 2021, 03:14:59 PMI bought some of those. Here's a link:

https://m.aliexpress.com/item/32778955771.html

What exactly is wrong with the setup you have, Joe? Does it work at all? How have you connected the switches? How have you configured the Bodnar software?

Hi Ame,

Once again thanks for the link, I might send for a few of those just to play with.

At the moment they do work (sort of) but as I said very slowly. Which is fine if you're setting at 1 degree increments. But I would rather they were quicker.

In the Bodnar software they are defined as 1-1 with a pulse width of 48. In FSUIPC I'm using the 'Set for FS' with (for example) 'Heading Bug Inc' and 'Dec'. If I select instead 'Inc fast' and 'Dec fast', they jump 10-15 degrees at a time. So there's no happy medium.
I have tried using different combinations but have yet to find that sweet spot. ::)

Regards
Joe.
Life isn't about waiting for the storm to pass, it's about learning to dance in the rain

Journalist - writer for  PC Pilot Magazine

RayS

Yeah the speed is an issue, especially if you're going through the joystick buttons to do it.

I got around the speed issue by configuring a Teensy 3.2 (any microcontroller will work though that has a rotary encoder library.

I coded my Teensy to act as a keyboard, but using the rotaries to send key events. This ended up being super fast and I can spin the knobs as fast as possible with little to no lag or event drops.

I use this method on my Avidyne Entegra units. As long as your software can recognize keyboard events you should be good.

#include <Keypad.h>
#include <Encoder.h>
#include <Bounce.h>
#include <usb_keyboard.h>

const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char keys[ROWS][COLS] = {
  {'t','m','-', 'q'},
  {'o','l','H', '-'},
  {'s','a','B', '\\'},
  {'r','e','-', '-'}
};
byte rowPins[COLS] = {0, 1, 2, 3}; //connect to the row pinouts of the keypad
byte colPins[ROWS] = {4, 5, 6, 7}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

long positionRight  = 0;
long newRight;
Encoder knobRight(14, 15);

long positionLeft  = 0;
long newLeft;
Encoder knobLeft(17, 18); // 16, 17 for the co-pilot rotary

const int buttonRight = 19;
const int buttonLeft  = 20;

Bounce pushbuttonRight  = Bounce(buttonRight, 10);
Bounce pushbuttonLeft   = Bounce(buttonLeft, 10);


void setup()
{
  Serial.begin(9600);
  delay(1500);
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);

  pinMode(buttonRight, INPUT_PULLUP);
  pinMode(buttonLeft, INPUT_PULLUP);
}
void loop(){
char key = keypad.getKey();

//----------------------------------
// Process the Right Outer rotary
//----------------------------------
   delay(10);

   newRight  = knobRight.read();
   if (newRight-1  > positionRight){ positionRight = newRight;  Keyboard.print("5"); }
   if (newRight+1  < positionRight){ positionRight = newRight;  Keyboard.print("4"); }

   newLeft  = knobLeft.read();
   // Reverse 1 and 2 for co-pilot
   if (newLeft-1  > positionLeft){ positionLeft = newLeft;  Keyboard.print("1"); }
   if (newLeft+1  < positionLeft){ positionLeft = newLeft;  Keyboard.print("2"); }


//----------------------------------
// Process Rotary Pushbuttons
//----------------------------------

if (pushbuttonRight.update())
{
    if (pushbuttonRight.fallingEdge())
    {
      Keyboard.println("=");
    }
}

if (pushbuttonLeft.update())
{
    if (pushbuttonLeft.fallingEdge())
    {
      Keyboard.println("3");
    }
}


//----------------------------------
// Process Line-Select buttons
//----------------------------------

   if (key == 't') { Keyboard.press(KEY_F1);  delay(100); Keyboard.releaseAll();} //LSK 1
   if (key == 'q') { Keyboard.press(KEY_F2);  delay(100); Keyboard.releaseAll();} //LSK 2
   if (key == 'r') { Keyboard.press(KEY_F3);  delay(100); Keyboard.releaseAll();} //LSK 3
   if (key == 'e') { Keyboard.press(KEY_F4);  delay(100); Keyboard.releaseAll();} //LSK 4
   if (key == 'o') { Keyboard.press(KEY_F5);  delay(100); Keyboard.releaseAll();} //LSK 5
   if (key == 'a') { Keyboard.press(KEY_F6);  delay(100); Keyboard.releaseAll();} //LSK 6
   if (key == 's') { Keyboard.press(KEY_F7);  delay(100); Keyboard.releaseAll();} //LSK 7
   if (key == '\\') { Keyboard.press(KEY_F8);  delay(100); Keyboard.releaseAll();} //LSK 8

  // Brightness controls
   if (key == 'B') {Keyboard.print(key);}
   if (key == 'H') {Keyboard.print(key);}

//----------------------------------
// Process Line-Select buttons
//----------------------------------
/*
   if (key)
  {
     Keyboard.print(key);
  }
*/
}

Ray Sotkiewicz

Joe Lavery

Thanks again Ray,

To be honest I have used Arduino's in a limited way, switches, led's etc. But if I studied your code for a year I would be no wiser.. 8)

I take my hat off to you programming Guys (and Gals); its something that this old brain can't seem to grasp. Give me a drawing package and a 3D printer and I can design and make just about anything that will fit on the bed, But complex programming like this is beyond me.
I recognise some bits of code from my former tinkering but I think Mobiflight is about my limit.  ;)

Thank you all once again for your input, it's always appreciated.

Joe.
Life isn't about waiting for the storm to pass, it's about learning to dance in the rain

Journalist - writer for  PC Pilot Magazine

Reco

I am using CTS 288 encoders from Leo's web site. They are low profile and you can get detent or non detent.

They have the same issues regarding slow Turning when using for vor and hsi etc but work great for altimeter.

I have heard you can setup a lua file with fsuipc to speed then up but that's beyond my scope of knowledge

Rhys


Like the Website ?
Support Cockpitbuilders.com and Click Below to Donate