Jump to content

Optical encoder, Arduino end DCS-Bios ?


Padonis
 Share

Recommended Posts

This is exactly the "Course Set Knob" encoder from HSI on the A-10C. The standard encoder (24-imp) is very slow.

 

DcsBios::RotaryEncoder hsiCrsKnob("HSI_CRS_KNOB", "-3200", "+3200", PIN_A, PIN_B);


Edited by padonis
Link to comment
Share on other sites

  • 2 weeks later...

I have been working on a good implementation of this on an off for a while - still not quite solved it.

 

What I have found so far

Using a 16 detent per revolution encoder from Bodnar (CTS288) connected to a Bodnar board then mapped in DCS, gives a step of about 7 or 8 degrees per click. Difficult to set an exact course so needs refining with the mouse.

 

Using the same encoder connected to an Arduino Nano and programmed with DCS BIOS ( thanks [FSF]Ian !) . Using Ian's values of + or - 3200 changes the value by about 3 degrees but only on every 4th click. Changing the value in the sketch to 1000 gives about 7/8th of a degree. Further experimentation with values needed to get exactly 1.

 

For completeness - my mouse wheel gives just under 1 deg per click, the keyboard gives about 8 per keypress - but you have to be quick to get your finger off the key.

 

Future thoughts - use an encoder with more steps per revolution ( 100 250 400?). Optical encoders are about 10GBP form China . Can anyone suggest how many steps per rev would be realistic? I assume it would work with the Nano and DCS BIOS?

Can the sketch be amended to give a change on each step? I have not looked at this yet but my programming skills are in their infancy.

 

Hope this help someone - let you know if I find out anything else useful

Link to comment
Share on other sites

Using the same encoder connected to an Arduino Nano and programmed with DCS BIOS ( thanks [FSF]Ian !) . Using Ian's values of + or - 3200 changes the value by about 3 degrees but only on every 4th click.

 

It sounds like your rotary encoder is one that advances one step per detent instead of four. The DCS-BIOS Arduino Library defaults to four steps per detent, as that is what the cheap chinese ones use.

 

Try this code:

DcsBios::RotaryEncoder hsiCrsKnob("HSI_CRS_KNOB", "-3200", "+3200", PIN_A, PIN_B, DcsBios::ONE_STEP_PER_DETENT);

Link to comment
Share on other sites

Thanks Ian - that works fine :thumbup:

I can see it now in encoders.h

I will have an experiment with the step values and see if I can work out what what equals a 1 deg step.

Can any RL pilots give an idea how sensitive the course knob should be ( how many degrees does 1 revolution represent) ?

Link to comment
Share on other sites

  • 3 weeks later...

Promised you an update on this.

New 100 step encoder arrived today :)

https://www.aliexpress.com/item/Photoelectric-rotary-encoder-100-pulse-AB-phase-5-24V-coupling-200-300-360-400-600-Pulse/32794421726.html?spm=2114.13010608.0.0.BBm7kh

 

Works fine with [FSF]Ians code above, but using 1125 instead of 3200 gives ALMOST 1 deg per step, close enough for me but it would be good to pin down the exact value.

The encoder is quite chunky ( 40mm x40mm body, + shaft) so it might be tricky to mount in a true replica cockpit. The sensitivity feels about right to me, but here is no click detent - smooth rotation.

Hope this helps someone

D

Link to comment
Share on other sites

Hi padonis,

thanks for the numbers - spot on :thumbup:

Looks like that encoder would work OK . 100 pulses per rev feels good to me - does not take too long to swing it all the at round if needed , sensitive enough to set to an exact number.

 

David

Link to comment
Share on other sites

  • 2 years later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...