-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BTS7960 + DC Motor for FFB Wheel #43
Comments
I have 775 DC motor driven by BTS7960 and it works perfectly. Drive motors whit this code. I have the two enable pins connected to the same pin on Arduino. that's way I only cal out right or left in the code.
if(forces[0] > 0){ |
Thanks for the response crimzzon92. I'm still new to all this so I'm a bit confused how to wiring would look like for your example. So in the code I would have something like: const int bts_R_PWM = 3; pinMode(3, OUTPUT); //Connected to BTS7960 Pin 1 - Right PWM if(forces[0] > 0){ |
I should work. I have the pins signed like this const int PITCH_R_EN = 16; Another tips are to make the PWM frequency higher on the arduino. the default is 950 Hz & 500 Hz for the PWM pins on the Arduino pro micro. I had a really bad noise coming from the dc motors. So I find an old library that allows you to change the frequency in fixed ranges. The only useable range is 4000Hz because the max is 31000 Hz but the BTS7960 only handles up to 25000Hz. but 4000Hz makes a big difference in the sound coming from the motors. #include <PWMFrequency.h> void setup(){ Link to Library: https://github.com/TheDIYGuy999/PWMFrequency |
Thanks for the help crimzzon92! My last question how did you setup your Joystick? For my current setup which doesn't use FFB I use: Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,JOYSTICK_TYPE_MULTI_AXIS, From what I understand I need to enable X Y Axis for the FFB to work so would I just simply use: Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,JOYSTICK_TYPE_MULTI_AXIS, My complete code is below: ` Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID,JOYSTICK_TYPE_MULTI_AXIS, //Setup steering, brake and accel pins //BTS7960 Pins (RPWM / LPWM) (Right / Left Pulse Width Modulation) //Setup Values //Setup FFB Gains void setup() { //Initialise button pins //set X Axis gains //set Y Axis gains //Steering Options - X Axis or Steering //Brake Options - Y Axis or Brake //Accelerator Options - Z Axis or Acceleratro //Enable FFB gains //Start Joystick //Start loop void SteerWheel(){ void BrakePedal(){ void AccelPedal(){ void FFB(){ //FFB - Send HID data to PC //FFB - Receive HID-PID data from PC and calculate forces |
Yes, you need X & Y to be true for FFB to work. Then change JOYSTICK_TYPE_MULTI_AXIS to JOYSTICK_TYPE_JOYSTICK. fore some reason. when using Multi_Axis windows won't see your device. then put in all the forces gain into the code. If I did not, the forces acted weird on me. you can just set the ones you don't want to 0. Remember to set the gain value low when testing whit motor. if your motor is powerful you can get hurt. a 775 dc motor on 100% is strong. I have everything set to around 20-30%. but that value depends on gearing a so one. mygains[0].rampGain = 100;//0-100 Hope its helps! |
Hello, I would like to ask, have you ever encountered a situation where the force feedback done by this library causes the game to drop frames in the game? I'm also having a similar issue, I seem to have fixed the issue with force feedback acquisition, but it's causing my game to drop frames very badly! |
I'm using BTS7960 too, and can report that below actually works in my setup! It's out of range at 31kHz but it's completely inaudible and so far the driver hasn't caught fire.
|
Hi all
First of all thanks YukMingLaw for creating this, I think this will be the final piece to finish my racing arcade cabinet project.
I've got my arcade wheel, pedals and 6 speed shifter working using the standard Joystick library and I'm now trying to get FFB working. I'm still new to Arduino and coding so my logic and explanation will be very basic.
My steering wheel uses a potentiometer and is connected to A0 on the Leonardo. As far as I know the BTS7960 motor drive has two input pins Right PWM and Left PWM which I've connected to pin 3 and 4.
My question is would this setup work with this library? I saw that the example has 3 outputs which I'm not sure how they would work with the BTS7960. I'm guessing in the example (SingleJoystickFFB.ino) Pin 6 and 7 would connect to the BTS7960 motor drive Right and Left PWM?
Any help/links would be appreciated.
Cheers
The text was updated successfully, but these errors were encountered: