Hello everyone! So I wanted to make a racing steering wheel with ffb. So I made it with a potentiometer, a dc motor, a motor driver and an arduino leonardo. So I installed the joystick ffb library and I've ran into a bit of a problem. So for example I would launch into the game and go quite fast and then when I would let go of the wheel what happens is the motor would turn the wheel right and because my wheel is quite heavy it has quite a bit of inertia so it would go back left and right into a cycle. I see for some people damping and pid controllers have fixed the problems, but neither the pid controller nor damping worked for me. I used a pd controller since I didn't really understand integrate (I). The problem is inertia and frankly I really don't know how to fix it. I really don't want to get the expensive Servo motors since I've blown quite a lot of money on this project already. I might've as well bought a new wheel. So any ideas on how to fix the problem. I've been brainstorming for a while and the only thing I've been able to think of are some wild concept ideas about complex current feedback loops. So any Ideas? Any help is appreaciated!
Stop using "so." You will thank me when you have a paper to write, and apply for a job.
For better control of your motor, you might want to consider using buttons or a rotary encoder. Make sure to debounce the buttons to prevent false triggering. The analogWrite(uint8_t pin, uint8_t val);
function allows for 256 possible PWM values, ranging from 0 to 255. This gives you control that is limited by the input resolution and the 8-bit resolution of the PWM signal. The average voltage output of the PWM can be calculated as:
val÷255×Vcc
whereas Vcc is the supply voltage to the Arduino.
I hope this helps.
No the problem is inertia of the wheel. Not inertia as a part of ffb the physical weight of the steering wheel. As I explained the wheel is quite heavy and what would happen is when the motor reaches peak speed and when it tries to slow down the wheel doesn't slow down because of its inertia. Then the game makes the wheel turn into the other direction because it overshot the point where its position is supposed to be. So it goes into the other direction and the same thing happens and it goes into an oscillation.
Then you might try reversing the motor for a short time to cause it to stop. Seems like right now your code just stop feeding current to the motor.
that can be fixed by using plastic/rubber light-weight wheels.
or if you didn't use motors with an internal gear box, use them, I recommend them because they help make the car more controllable.
as for control, you might want to use a remote control as remote controls are wireless.
...or you can just reverse the motor for a short time, just like Pail_KD7HB said.
I hope this helps you with the project!
sorry for zoning out of your first post, my bad.
well at least I can help you out now!
Well I though of that but how do I do that?
Very likely, both were done incorrectly.
Yeah, probably I never understood neither.
I think the pd controller has been done somewhat correctly as far as I know but it just isn't enough to solve the issue. I mean I didn't explain the problem well. The pid controller did work but when I turned the Kp and the Kd to a number that solved the initial problem the wheel just moved super slowly which completely destroys the point of ffb.
Obviously not, from what you describe. Look up "PID tuning" for tutorials on how to adjust PID controllers correctly.
I did do look up but, I just can't understand it. This is my controller:
P = error;
I = I + error;
D = error-previousError;
PIDvalue = (Kp*P) + (Ki*I) + (Kd*D);
previousError = error;
Because I didn't understand I I set Ki to 0.
After carefully going through some PID tuning tutorials, you will understand, and if you follow instructions, may succeed.
I didn't know how to adapt it. Because when the game sends force feedback it doesn't say where the wheel should exactly stop.
The ranenbegs ffb firmware tries to roughly calculate it but it varies by the speed of the car.
It just sends a value from 0 to 500 for how much voltage to apply. Nothing else.
Then you need to do some more analysis, in order to get the information needed to understand and solve problem.
You haven't posted any useful information about your project, so forum members can't help much. Have a look at the "How to get the best out of this forum" post, linked at the head of every forum category, and follow the instructions.
What kind of information do you exactly need?
I would need the same information that you need to solve the problem.