# AFFBWheel **Repository Path**: iamyhw/AFFBWheel ## Basic Information - **Project Name**: AFFBWheel - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-10-17 - **Last Updated**: 2023-10-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # AFFBWheel (Arduino Force FeedBack Wheel) [![Russian Federation](https://raw.githubusercontent.com/stevenrskelton/flag-icon/master/png/16/country-4x3/ru.png "Russian Federation") Описание на русском](readme_rus.md) This is project of Arduino based wheel controller with force feedback. To configure the controller parameters, you need to use the graphical interface **[AFFBWheelGUI](https://github.com/vsulako/AFFBWHeelGUI/blob/master/README_RU.md)** - 8 axes: steering(X), accelerator(Y), brake(Z), clutch(Rx), and 4 additional(Ry, Rz, Slider, Dial - e.g. for thumbstick, handbrake, etc). - 32 buttons. - FFB effects: constant/ramp/square/sine/triangle/sawtooth/spring/damper/inertia/friction - Wheel range can be changed on the fly: 1080/900/360/270/180 degree or any other value. Unfortunately, there isn't much information about conditional FFB effects, my implementation can be incorrect. However, modern games typically use only constant force to emulate other effects. ## Hardware: - Arduino Atmega32U4 board (Leonardo, ProMicro, Micro, etc) - incremental encoder or TLE5010/AS5600 sensor for steering axis. - potentiometers for analog axes - 4x shift registers 74HC165 (alternately - I2C expanders MCP23017) - BTS7960 driver - DC motor - 12-24v DC power source for motor - 5v DC power source for Arduino 5v (optional - can be powered from USB) - optional: ADC MCP3204, ADS1015, or analog multiplexer 74HC4051/74HC4052/74HC4067 + shift register 74HC164 Project uses USB HID communication code from [VNWheel](https://github.com/hoantv/VNWheel) project (great thanks to hoantv's work). ## Instructions for the firmware 1. Download the project from github as *zip*:
![](images/firmware-instructions/github_download.png)
And unzip the archive to any convenient folder. 2. Download [Arduino IDE](https://www.arduino.cc/en/software). Version **[1.8.19](https://downloads.arduino.cc/arduino-1.8.19-windows.exe)** is recommended, later versions may have errors. 3. Download additional libraries: - [digitalWriteFast](https://github.com/NicksonYap/digitalWriteFast) - [avdweb_AnalogReadFast](https://github.com/avandalen/avdweb_AnalogReadFast) - [Encoder](https://github.com/PaulStoffregen/Encoder) 4. Install the downloaded libraries: - 4.1. Download the library as *zip*. - 4.2. Open *Arduino IDE*, then click **Sketch > Include Library > Add .ZIP Library....** and select *zip* with downloaded library. [Instruction in English](https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries):
![](images/firmware-instructions/install_arduino_lib_en.png) 5. Open the folder where you unpacked the project archive, go to the **[AFFBWheel](AFFBWheel/)** folder and open the **[AFFBWheel.ino](AFFBWheel/AFFBWheel.ino)** file in *Arduino IDE*. 6. Make the necessary changes to the **[config.h](AFFBWheel/config.h)** file for customization. 7. Connect the *Arduino* board to your PC. 8. Select your board type *Arduino* **Tools > Board** (Leonardo, ProMicro, Micro, etc.):
![](images/firmware-instructions/select_board_type_en.png) 9. Select the port on which *Arduino* is detected **Tools > Port**:
![](images/firmware-instructions/select_arduino_port_en.png) 10. Click the upload button:
![](images/firmware-instructions/firmware_arduino_en.png) 11. Wait for the firmware process to finish. All is ready! ### Wiring diagram: ![](images/base_encoder.png) *The connection diagram is shown on the example of **Arduino Pro Micro**, for the rest of the boards, the pinout is exactly the same with the same numbers. There are slight differences for **[Arduino Leonardo](#leonardo-instead-of-promicro)** in the location of pins on the board.* *There are also several options **[motor driver connection](#motor-control)**.* There are two separate lines of shift registers, 16 buttons each. Thus, 16 buttons can be placed on wheel, and 16 more on wheelbase or gearbox. #### Decoupling ![](images/decoupling.png) For lowering noise it is recommended to add decoupling capacitors (ceramic 100nf...1uf between VCC and GND) to all bare IC's (TLE5010, 74HC165, 74HC4052, MCP2304...) close as possible to IC. Modules already have these. #### Encoder PPR Set encoder PPR in config.h, in line `#define ENCODER_PPR 400`. #### Blocking unneeded analog axes. If analog axis pin is not connected to potentiometer, axis will produce noise. To avoid that, either pull axis pin to GND with 1-10kOhm resistor, or disable axis output with command `axisdisable`. So, axis will always report same value and will not mess up when detecting axes in games. Also, 4 additional axes (AUX1-AUX4) can be disabled in config.h. Just comment out line `#define PIN_AUXN ..`. Disabled axis will be excluded from polling (saving ~45us of computing time) and will always report 0%. #### If a game does not support DIY wheels You can try to use controller emulator [GIMX](https://gimx.fr/). You will need an Atmega32U4 board (Leonardo/promicro/teensy2/etc) and CP1202 USB-UART adapter. #### [Alternate hardware configurations](#althw). ### Testing software: - [VKB joystick tester](https://vkbcontrollers.com/?page_id=4609) - [VKB button tester](https://vkbcontrollers.com/?page_id=4609) - [FEdit](https://gimx.fr/wiki/index.php?title=Force_Feedback) ## Configuration. Configuration options are in config.h, mostly for different hardware configurations (see [below](#althw)). ## Settings and commands. Changeable settings can be changed on the fly using [GUI](https://github.com/vsulako/AFFBWHeelGUI) or commands on serial port. For most commands, if no value is given, command prints current setting. - `center` Set current wheel position as center. - `centerbtn` `centerbtn