Padonis Posted May 22, 2017 Share Posted May 22, 2017 Did any of you use an optical encoder (64-128 imp) with Arduino and DCS-Bios. I want to use it for "Course Set Knob". Link to comment Share on other sites More sharing options...
FSFIan Posted May 22, 2017 Share Posted May 22, 2017 Do you have a datasheet for the encoder you want to use? I am sure we can come up with a sketch to make it work. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
Padonis Posted May 22, 2017 Author Share Posted May 22, 2017 (edited) 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 May 22, 2017 by padonis Link to comment Share on other sites More sharing options...
FSFIan Posted May 22, 2017 Share Posted May 22, 2017 What do you mean by "24-imp"? An imp is a mythical creature... If you want to increase the amount of movement caused by rotating your encoder one detent, change the "+3200" and "-3200" values. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
Padonis Posted May 22, 2017 Author Share Posted May 22, 2017 Sorry, i mean resolution: 24 pulse of 24 step. Link to comment Share on other sites More sharing options...
davidjb Posted May 31, 2017 Share Posted May 31, 2017 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 More sharing options...
FSFIan Posted June 1, 2017 Share Posted June 1, 2017 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); DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
davidjb Posted June 1, 2017 Share Posted June 1, 2017 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 More sharing options...
davidjb Posted June 19, 2017 Share Posted June 19, 2017 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 More sharing options...
Padonis Posted June 20, 2017 Author Share Posted June 20, 2017 (edited) I have 1 deg = 1 step with values: DcsBios::RotaryEncoder hsiCrsKnob("HSI_CRS_KNOB", "-1144", "+1144", 8, 9); I wonder if the magnetic encoder also works? It's small in size http://www.akcesoria-cnc.pl/pdf/RMS20_E.pdf Edited June 21, 2017 by padonis Link to comment Share on other sites More sharing options...
davidjb Posted June 21, 2017 Share Posted June 21, 2017 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 More sharing options...
Padonis Posted June 21, 2017 Author Share Posted June 21, 2017 Now I have 24 pulses and this is acceptable. I will look for such 64-100 pulses, 250 pulses too much, not very precise Link to comment Share on other sites More sharing options...
BULLITT83 Posted February 18, 2020 Share Posted February 18, 2020 hi padonis, i've the same problem as you , do you confirm that you managed to do it with a 24 pulse rotary encoder ? or did you buy a 64 , or a 100 ? Link to comment Share on other sites More sharing options...
Padonis Posted February 21, 2020 Author Share Posted February 21, 2020 Yes, I have a 24 step encoder. Everything works very well. I have 1 degree = 1 step with values: DcsBios :: RotaryEncoder hsiCrsKnob ("HSI_CRS_KNOB", "-1144", "1144", 8, 9); Link to comment Share on other sites More sharing options...
Recommended Posts