Welcome to the Sim Racing Button Controller repository!
This project is built around an ATmega328P microcontroller, which is configured to manage a button matrix tailored for sim racing setups. The system uses I2C communication, where the Arduino Micro acts as the master and the ATmega328P functions as the slave (Address standard 8). This ensures precise control and synchronization between the components.
The ATmega328P transmits a 16-bit signal representing the states of up to 16 buttons only when requested by the Arduino Micro. This on-demand communication minimizes latency and ensures efficient data transfer. Additionally, the PCB includes support for a joystick connection, expanding its versatility.
This project complements MySimRacingCore, which serves as the brain of the entire sim racing system. Together, they deliver a modular and high-performance solution for sim racing enthusiasts.
- Support for up to 16 buttons in a matrix configuration
- Seamless I2C communication with the Arduino Micro for precise control
- Fast and effective button state management with Keypad Library
- Joystick integration via the PCB's RJ45 jack, reducing wiring complexity
- ATmega328P Microcontroller
- 16 Mhz Oscilator
- 12..22 pF Condansator
- 100 µF Condansator for supply stability
- Button Matrix: Up to 16 buttons
- The PCBA from master project: MySimRacingCore
- PlatformIO: Used for programming the ATmega328P microcontroller.
- Wire.h: for I2C communication
- AVR Lib: standard lib with PlatformIO.
- Keypad Library: Used for the 4x4 Matrix
You can either use the precompiled HEX file or compile the firmware yourself.
-
Install PlatformIO
- Set up PlatformIO in your preferred development environment (e.g., VSCode or Atom) by following the official installation guide.
-
Clone the Repository
git clone https://github.com/lusmdl/MySimRacingButtonBox.git
3. Open the Project
- Open the cloned repository in your PlatformIO environment.
- Update the line
#define I2C_ADDR 8in ProjectConfig.hpp to match your I²C master device configuration.
The default address is 8. If you intend to connect this device twice, use addresses 8 and 9. The master will handle the rest.
-
Build and Upload
- Prepare your ATmega328P-based PCB for flashing. It’s recommended to first flash the firmware onto an Arduino Uno and then transfer the chip to your custom environment.
- Build and upload the code using PlatformIO:
pio run --target upload
- Assemble the PCB according to the provided design.
- Ensure all components, such as the button matrix and joystick, are correctly connected.
-
Hardware Connection
- Connect the button matrix to the ATmega328P as per the configuration.
- Establish an I2C connection between the ATmega328P and the Arduino Micro.
-
Running the Firmware
- Power on your system.
- The ATmega328P will only send a 16-bit signal to the Arduino Micro when requested over I2C, ensuring efficient communication.
- Software: doc/software/html/index.html
We welcome contributions from the community!
First, read the general contributing conventions for projects from me.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature-branch). - Create a new Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
