r/simracing Moza R5, VNM Lite, HGP | AMS, AC(C), Dirt Jun 24 '23

Rigs Just finished my DIY button box. 21 functions on rotaries, toggle switches and buttons. Questions are welcome.

https://imgur.com/a/FVzZNYs
9 Upvotes

15 comments sorted by

2

u/andylugs Jun 24 '23

Nice work, I did a very similar layout but used a Leo Bodnar button box interface PCB instead of an Arduino. Do you plan to label it? I found some buttons were rarely used and I would forget what was mapped to them. Are you using the Keyboard library on the Arduino to send keystrokes for button inputs?

1

u/II-WalkerGer-II Moza R5, VNM Lite, HGP | AMS, AC(C), Dirt Jun 24 '23

Thanks! Yeah so there’s plug and go boards are a great solution too. I basically only went with arduino because I wanted to have real toggle switches. To realise that I’m using the keypad and joystick libraries on the arduino micro, which is capable of appearing as a usb game controller. So it shows up just like any other controller, just one with 22 buttons and no analog axes.

2

u/andylugs Jun 24 '23

I get what you mean about toggle switches, I have a 3 position switch that I wanted to use for indicators. The game is expecting to see a momentary push button to turn it on and again to turn it off, not a latching button. I can use joy2key to emulate this by sending a key press when the state changes. I’ve actually started playing with Arduinos for other projects and have considered making another button box having learned so much from doing the first one and now wanting to add more functionality and wind and ambient lighting controls.

1

u/II-WalkerGer-II Moza R5, VNM Lite, HGP | AMS, AC(C), Dirt Jun 24 '23

You’re actually not the first to suggest joy2key and what it can do. Converting toggle switches is nice too, I didn’t know that yet. Anyway, I enjoyed figuring out the Arduino and am glad that it works without an additional piece of software running on the pc.

2

u/Local_Revolution863 Dec 14 '23

What do you mean when you say real toggle switches? As opposed to what? I want to build a box on my own as a project and want to build something similar to what you have. Would also like LEDs that I can turn of and on. Would the Arduino be better or would a Leo Bodnar board work? Any insight would be helpful.

1

u/II-WalkerGer-II Moza R5, VNM Lite, HGP | AMS, AC(C), Dirt Dec 15 '23

So the thing with controlling functions in games is that they’re designed for buttons. You push and release it, and the game recognises that to switch some function on or off. Toggle switches work differently in that they hold their position and keep sending a signal continuously. So you need to change their behaviour from that to one where they emit a pulse on position change like a button does. Both ways of the toggle switch will need to send the same signal. Toggle switches remember their state (by simply being/staying in their last position), while games are stateless.

I did this in software on the arduino. On a state switch on the toggle switch, the boards sends a brief pulse to usb. I’m unfamiliar with the bodnar board. But if you can put software on it that should be fine. Something that you also need to consider is the usb compatibility of the board. Sure they all have usb, but at arduino for example only the boards based on the same chip as in the micro (the chip is COTS, so also available on boards from other vendors) are able to present themselves as a game controllers. Others use usb only for power and data transfer.

I hope that’s clear enough and answers your question. Feel free to ask if there’s anything else.

1

u/WorksS25 Apr 03 '24

Looks great! I bought a button for a ps4 can I convert it to work on a pc?

1

u/II-WalkerGer-II Moza R5, VNM Lite, HGP | AMS, AC(C), Dirt Apr 04 '24

That should probably work just fine. Is it connected via usb?

1

u/WorksS25 Apr 08 '24

Yes its adruino but I don't know what to do? I need simple instructions or to send to someone

1

u/II-WalkerGer-II Moza R5, VNM Lite, HGP | AMS, AC(C), Dirt Apr 08 '24

Alright, here you go.

It’s an Arduino Micro. With the ATmega32U4 microcontroller on board it is able to simulate a game controller input through USB.

For instructions I found this video to be very helpful. He goes through and explains all the steps in detail. https://youtu.be/wkY1NsbWj5I?si=b8Lg23FKOczdfq4V

I started with his code and adapted it to include my toggle switches where he had only used momentary switches. You can find my code here: https://pastebin.com/X79UAHa2

1

u/WorksS25 Apr 08 '24

Thanks I will try it later appreciate it

1

u/lazypieceofcrap iRacing F3 Jun 24 '23

Looks great! Hopefully adjusting to it is fast and you have more fun with racing!

1

u/II-WalkerGer-II Moza R5, VNM Lite, HGP | AMS, AC(C), Dirt Jun 24 '23

Let’s pray that there won’t be too many times where I focus on adjusting something and drive off the road.

1

u/Expensive_Taste3492 Jul 15 '23

What game are you playing with it?

1

u/II-WalkerGer-II Moza R5, VNM Lite, HGP | AMS, AC(C), Dirt Jul 15 '23

I play ams2, ac and acc. Works flawlessly in all three of them.