ranenbg / Arduino-FFB-wheel

Stand-alone DirectInput USB device recognized in Windows as a joystick with force feedback functionality, based on BRWheel by Fernando Igor from 2017.
158 stars 21 forks source link

ffb max output force? #44

Closed Notriatv closed 9 months ago

Notriatv commented 9 months ago

Hello! I wonder if there is a possibility of adding this feature? Because in some cases FFB is too strong, and the power supply ends up shutting off.(mostly on beamng or iracing colisions) I know that if I reduce the overall gain, I can solve this, but I don't want to lose the minimum forces.. what do you think? Thanks in advance :)

ranenbg commented 9 months ago

Hi, this is not a real issue of the firmware. You can't have both at the same time, there is allways some tradeoff. What you can do is use lower voltage for your motor when powering BTS7960, if you have a psu that has voltage output adjustment.

If your psu shuts down under heavy motor load then you don't have an appropriate psu for that motor, as simple as that. I have a 12V 40A psu and it works just fine with RS775 motor. Those are amp hungry beasts.

With firmware you can play with general gain and min pwm sliders. You can also try out different PWM frequencies. Just remember that lower PWM freq will give you more ffb resolution as PWM signal will have more steps inside one period.

The only way to prevent sharp ffb signal peaks is to use some kind of digital filtering or smoothing of ffb signal. Unfortunately there is not enough memory left to do this in firmware. However, some games do have such feature, for example RFactor2.

Notriatv commented 9 months ago

I see, for sure that's not an issue but I don't know another way to contact developers here on github lol I was just thinking about that because I saw this feature or something like that on EMC and AFFBWheelGUI (not tested here yet) in "cut force" description but I'm completely noob and don't know how you guys do the magic :) ok I'll keep playing with sliders to find perfect sets for every game.. I'm using a 200w dc spindle for CNC with 1:10 belt reduction and a 24v 500w(not real) psu I once tried running it with a 24v battery and ffb was great without turning off due to "ffb peaks" I'm currently running with 8khz for racing games since the engine sounds are louder than pwm noise and 16khz for ets2

Notriatv commented 9 months ago

oh yess another quick question.. is it possible to use some BL motors with your firmware? like those we find on hoverboards

ranenbg commented 9 months ago

Just as I thought, 24V 500W motor is scary :) EMC and AFFB have 8bit ffb with only a few effects, while mine has 16bit full ffb effect support and extensive configurability via serial port which takes a lot of memory, so that is why they were able to fit ffb filtering on it.

Believe it or not, I was not born with this knowledge, and I once was a complete noob with arduino programing and ffb. I'm working on this project since around 2017 and had a strong motivation to learn more. I got my 1st arduino board in 2016 and I only used sources available online. Ofc, it helped a lot that my hoby was electronics, also that I studdied physics and got PhD around that time when I started playing with arduino. There is quite some electronics, physics and math involved in this project, which are cruitial for understanding some basic concepts. But, I think given enough time and dedication, anyone can learn to do this, even without electronics/mechanics/programming university.

In the game you can always set ffb strenght in such a way that clipping does this job of cutting high peaks for you. If you set it on a higher side, such that there is no clipping under normal conditions, so ffb signal is most of the time close to 100%. When a sharp peak comes, it will be just clipped out as game can't send more than 100% ffb. You can use my realtime FFB monitor in GUI just click on a square button next to a general gain slider and run the game in windowed mode such that FFB graph is just behind and below a game window. Then do your normal driving and increase game ffb strenght just before clipping.

Howerboard motors, yes, for that reason I made a special pwm mode I called RCM. This is the same as the one used in RC cars for servo motors that you put on the front wheel for steering. Howerboard electronics can work with such pwm input signal. There were a few guys asking around about this and I made it upon their request. I'm not sure if they got it to work, they said there were problems with it concerning calibration of pwm input on the howerboard electronics side, there is some knock-off firmware for this board somewhere.

If you want to go the BLDC and howerboard motor path, then it's much better to use stm32F407 microcontroler and openFFboard firmware. Arduino leonardo/micro has a very small and slow mcu and it can only do this much. It's realy made for bts+dc motor+belt drive.

Notriatv commented 9 months ago

oh I see.. big thx for sharing your knowlege with rest of us 👍 for sure one day I'll try bldc just to satisfy my curiosity :) and learn to use that cliping window if you want to see something of my project that's my yt channel https://youtube.com/@NotriaTV?si=KOfzXNBMi3usPVOP thx again!!