Mr_Burns Posted July 14, 2018 Posted July 14, 2018 Hello, I bought these off ebay and was hoping someone could advise me on how to wire them up and hopefully if I can use DCS Bios. The are rotary encoders with a push button operation (key switch): https://www.ebay.com.au/itm/10pcs-12mm-switch-rotary-encoder-with-key-switch-L3I5/192315940922?epid=1881244434&hash=item2cc6ec603a:g:y~sAAOSwb7NZyG6E I want them to drive the up front controller in the F/A-18C so volume up and down, radio channels, brightness and probably also take off trim. Thanks in advance for any help.
BlacleyCole Posted July 14, 2018 Posted July 14, 2018 Go buy some leobednar game controllerboards read his wire guide for them then they will show up as controls in dcs you may need to configure the board thru software but that I’m not 100% sure yet since I’ve not got around to building a button box try. You might be able to wire them up to an andrino board also but I’m not sure. BlackeyCole 20years usaf XP-11. Dcs 2.5OB Acer predator laptop/ i7 7720, 2.4ghz, 32 gb ddr4 ram, 500gb ssd,1tb hdd,nvidia 1080 8gb vram New FlightSim Blog at https://blackeysblog.wordpress.com. Go visit it and leave me feedback and or comments so I can make it better. A new post every Friday.
Mr_Burns Posted July 14, 2018 Author Posted July 14, 2018 I went with the GGG type controllers and have 2 knocking around but not sure if they support these. I also bought some Arduino as I have a couple of LED switches for Master Warning and Fire so think this is the way to go? Thanks for the reply.
Ranma13 Posted July 14, 2018 Posted July 14, 2018 The two fat wavy pins on either side are locking pins used to secure it to a circuit board. The side with the 3 pins are the two 'buttons' that get momentarily pressed when the encoder is turned. The middle pin is the common, and the left and right pins are for the two directions the encoder can be turned. The two pins on the other side are for the push switch. The encoder can be thought of as 3 separate switches, one for the clockwise direction, one for the counter-clockwise direction, and one for the push. You can hook it up to any programmable microcontroller. Leo Bodnar is a popular choice, but personally I find it to be extremely expensive compared to either an Arduino or a Teensy, and it can't be integrated with DCS BIOS. If you're going to use DCS BIOS, it's not important whether the microcontroller can emulate a joystick or a keyboard, you just need to make sure that it has a serial port, which the vast majority of them have. You install DCS BIOS, then run the command-line app that comes with it, and it will handle the connection between the microcontroller's serial port and DCS BIOS.
Mr_Burns Posted July 14, 2018 Author Posted July 14, 2018 Thank you for that, I will have a play around tomorrow, glad its 3 separate switches, I thought perhaps the push was required to activate the directions.
frogger Posted July 14, 2018 Posted July 14, 2018 pretty basic to wire up but u might run into issues with rotation speed and also interference depending on the quality of the encoder. i wired some upto the Mirage2000 and i found that trying to set the hdg bug was really slow no matter how fast u turn it. real ones detect speed im sure and u can to fine adjustments or big movements while the dcs bios one only did fine adjustments.
WhoMadeWho Posted July 14, 2018 Posted July 14, 2018 Hello, I bought these off ebay and was hoping someone could advise me on how to wire them up and hopefully if I can use DCS Bios. The are rotary encoders with a push button operation (key switch): https://www.ebay.com.au/itm/10pcs-12mm-switch-rotary-encoder-with-key-switch-L3I5/192315940922?epid=1881244434&hash=item2cc6ec603a:g:y~sAAOSwb7NZyG6E I want them to drive the up front controller in the F/A-18C so volume up and down, radio channels, brightness and probably also take off trim. Thanks in advance for any help. I'm using the same rotary encoders. Here is my code. I'm using an OLED display so ignore that part... :smilewink: #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include <Fonts/dl/digital_counter_717pt7b.h> //Good fonts - FreeMono12pt7b FreeMonoBold12pt7b FreeSerif12pt7b #define OLED_RESET 4 Adafruit_SSD1306 display(OLED_RESET); DcsBios::RotaryEncoder hsiCrsKnob("HSI_CRS_KNOB", "-1000", "+7000", 7, 8); void setup() { display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32) // init done // Show image buffer on the display hardware. // Since the buffer is intialized with an Adafruit splashscreen // internally, this will display the splashscreen. display.clearDisplay(); display.display(); display.setFont(&digital_counter_717pt7b); display.setTextColor(WHITE); // display.setTextSize(2); display.setCursor(52,28); display.print("123"); display.display(); delay(0); DcsBios::setup(); } void onHsiCrsKnobChange(unsigned int newValue) { display.clearDisplay(); display.setFont(&digital_counter_717pt7b); display.setTextColor(WHITE); display.setCursor(52,28); display.print(newValue / 182); display.display(); } DcsBios::IntegerBuffer hsiCrsKnobBuffer(0x115a, 0xffff, 0, onHsiCrsKnobChange); void loop() { DcsBios::loop(); }
Ranma13 Posted July 14, 2018 Posted July 14, 2018 (edited) real ones detect speed im sure and u can to fine adjustments or big movements while the dcs bios one only did fine adjustments. You can set the speed of the rotary encoder. It's not in the documentation, but the rotary encoder allows you to set a stepsPerDetent value, which defaults to 4: https://github.com/dcs-bios/dcs-bios-arduino-library/blob/master/src/internal/Encoders.h#L58 You can decrease this value for a faster change. The steps per detent refers to how many values are in between each detent on the encoder. By default, most off-the-shelf rotary encoders will change by 4 values per detent, and DCS BIOS is configured to only trigger the button press after it detects that the value has increased or decreased by 4. By lowering this, DCS BIOS will respond by triggering it after the value has changed by 2 or 1, making it 2 to 4 times faster. Edited July 15, 2018 by Ranma13
Mr_Burns Posted September 1, 2018 Author Posted September 1, 2018 Thanks for all the responses guys, always a great help. One more question, I need to but caps for them, is it called a D shaft or something, all the ones I have seen are for grooved shaft with the cutout bit down the middle of it.
Ranma13 Posted September 1, 2018 Posted September 1, 2018 Yes, you need a D shaft knob, also known as a flatted shaft. Most likely you'll need a knob for a 6mm shaft, but you can tell for sure by measuring the diameter of the knob across the non-flatted part. You can also use a standard knob not intended for a D shaft if it has a set screw because the screw will bite down into the shaft to hold it in place.
hockeygoalie35 Posted March 11, 2019 Posted March 11, 2019 Thanks for all the responses guys, always a great help. Mr. Burns, did you end up getting your rotaries to work? For some reason, I can't get mine to fire....
rocketeer Posted March 11, 2019 Posted March 11, 2019 I use exactly the same type of encoder with a push button. The two highlighted lines are code for the same switch, the encoder part and push button part. One side with 3 pins, the middle is ground, the left and right determines clockwise or anti-clockwise rotation. The other side of the switch with 2 pins, one controls the push button, the other is ground. That's all to it. My A10C cockpit thread
hockeygoalie35 Posted March 12, 2019 Posted March 12, 2019 I was able to fix it. I had it wired correctly, but my rotary encoder code was in the loop, instead of before it. Oops!
Rick50 Posted April 13, 2019 Posted April 13, 2019 I don't have the Hornet, but I thought the takeoff trim was a button with only a few choices, for specific weight categories... press once, or twice or three times, to cycle to the correct takeoff weight/trim.
Pitufo Posted January 31, 2020 Posted January 31, 2020 Hi I'm also having a bit of a problem with push button rotaries... I'm using a Derek Speare board. The issue is that they seem a bit TOO sensitive. And also, seemingly randomly the opposite direction "click" will register. This DCS BIOS that was mentioned.. is that something additional i need to download? Also is there any fundamental difference to the encoders that come on a chip with 5 pins and the ones mentioned above in this thread? Thanks.
Sprool Posted July 7, 2020 Posted July 7, 2020 (edited) I read late last night the encoders accuracy is much better if the 2 sensor pins A & B (to detect clockwise or counterclockwise rotation) are wired into the controller board pins that have interrupt capability - on the teensy 2.0 thats pins 5 to 8. If there's not enough pins available (ior too many rotaries) then you can get 2nd best performance by wiring one of the rotary pins to an INT pin, the other to a standard analog pin. If youre just doing the knob for lighting level or radio volume then they dont need to be super-accurate. Having just started playing with R/E's on a teensy 2 board i have same issue with too much chatter & interference when buttons are picked up in the windows game controller. Maybe I need some better specific code Edited July 8, 2020 by Sprool
Sprool Posted July 9, 2020 Posted July 9, 2020 I'm using the same rotary encoders. Here is my code. I'm using an OLED display so ignore that part... :smilewink: #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" #include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #include <Fonts/dl/digital_counter_717pt7b.h> //Good fonts - FreeMono12pt7b FreeMonoBold12pt7b FreeSerif12pt7b #define OLED_RESET 4 Adafruit_SSD1306 display(OLED_RESET); DcsBios::RotaryEncoder hsiCrsKnob("HSI_CRS_KNOB", "-1000", "+7000", 7, 8); void setup() { display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C (for the 128x32) // init done // Show image buffer on the display hardware. // Since the buffer is intialized with an Adafruit splashscreen // internally, this will display the splashscreen. display.clearDisplay(); display.display(); display.setFont(&digital_counter_717pt7b); display.setTextColor(WHITE); // display.setTextSize(2); display.setCursor(52,28); display.print("123"); display.display(); delay(0); DcsBios::setup(); } void onHsiCrsKnobChange(unsigned int newValue) { display.clearDisplay(); display.setFont(&digital_counter_717pt7b); display.setTextColor(WHITE); display.setCursor(52,28); display.print(newValue / 182); display.display(); } DcsBios::IntegerBuffer hsiCrsKnobBuffer(0x115a, 0xffff, 0, onHsiCrsKnobChange); void loop() { DcsBios::loop(); } Can you get windows joystick controller to recognise the rotary encoders cleanly without chatter or interference?
Sprool Posted July 10, 2020 Posted July 10, 2020 (edited) Heres some code from a guy making a button box for racing sim, with 4 rotaries, you can see theres quite a lot of coding needd to get them to work ok I finally finished editing this to work off a Teensy 2.0 this evening, I have a 4 x 6 button matrix and 4 rotary encoders all working now. Using one of the buttons as a modifier allows me to give dual functions to each rotary encoder (mostly for lighting levels & radio vols). The code irons out jitter, bounce and latency so they work really smoothly with Windows Joystick COntroller. Only thing I didnt end up using is the push-button switch functionality of the rotaries.rotaries.txt Edited July 10, 2020 by Sprool
kingtintony Posted August 8, 2020 Posted August 8, 2020 You can set the speed of the rotary encoder. It's not in the documentation, but the rotary encoder allows you to set a stepsPerDetent value, which defaults to 4: https://github.com/dcs-bios/dcs-bios-arduino-library/blob/master/src/internal/Encoders.h#L58 You can decrease this value for a faster change. The steps per detent refers to how many values are in between each detent on the encoder. By default, most off-the-shelf rotary encoders will change by 4 values per detent, and DCS BIOS is configured to only trigger the button press after it detects that the value has increased or decreased by 4. By lowering this, DCS BIOS will respond by triggering it after the value has changed by 2 or 1, making it 2 to 4 times faster. Thank you for this info. It helped me out. There are two short sections on rotary encoders in the documentation that comes with DCS-BIOS. I've attached a screenshot. I got compile errors when using the syntax shown, though. After a bit of Googling I found this syntax works for me: DcsBios::RotaryEncoder priInstPnlBrtKnb("PRI_INST_PNL_BRT_KNB", "-3200", "+3200", 1, 0, DcsBios::TWO_STEPS_PER_DETENT);
Recommended Posts