Open cartaio opened 1 year ago
I think it can be adapted.
here is branch with quick changes: https://github.com/vsulako/AFFBWheel/tree/pwmdir
in config.h uncomment #define MODE_PWMDIR
PWM (pulse) is pin 9, DIR pin 10.
if necessary, dir and pwm logic can be inverted.
If it will work well, I'll add changes to main branch.
thanks... i should have an arduino laying around somewhere... i'll try asap and try to make some prototype to share this summer! if it works should be a cheap build... the servo is around 250€ with included drive...
Hi just had a couple of hours to dedicate to the project... in pulse and direction i have problem with holding torque... just too high to use it... i think the solution should be to use analog input for torque and a direction pin... same question as above... is it doable or i need to program it my self?
so i tried with a manual pwm signal on the analog in and the drive doesn't like it... tried with a potenziometer to regulate from 0 and +5 and it works so i think with a dac should work pretty easly... i should have a mcp4725 somewhere... the direction pin works fortunatly so should be only to send instead of the pwm signal, i need a value to send to the dac to scale from 0 to +5/10 the drive have a parameter to scale it up... so even 5v is ok
Sorry, I don't understand. Did not work with servo motors. What is "analog input for torque"? Servo allows to control torque with analog signal on separate pin? If drive does not like PWM, but works with analog, may be a simple capacitor or RC lowpass filter will do?
Yes the drive i have has pwm for position control and analog for speed or torque control... i tried using something but as a read online, to have a clean signal and a good force feedback you need a dac unfortunately... if you want i can send you the manual of the drive...
I think it is possible to use I2c DAC like MCP4725, but I don't have any to test if it will work with my bitbang I2c implementation.
I assume, torque value should be equal to pwm value? FFB produces only one value - force, there is no separate speed and torque values. So, it is not possible to order "rotate slow, but with high torque", or vise versa - "fast, but with low torque".
Well i searched online and other project like yours just send the force and direction when using a servo... and i discovered that a lot of high end direct drives are build with a custom servo controlled in torque(force) and direction... tomorrow i will look to adapt the software to use i2c... i have a pin for direction like before and i will have a value to send to the dac... is 12 bit so 4096 max unfortunately... in the future maybe a 14 bit one would be perfect but i will need a voltage boost to have a vref of 10v to take advantage of the extra resolution. But in the end this 12bit one should be perfect
I updated pwmdir branch to use MCP4725 (according to datasheet, not tested). Force value is sent to DAC, scaled to 12 bit. Try if it works.
note that i2c connection here is on pins set in config.h (2,7), not arduino i2c pins (2,3).
I made it work with pwm... i found a parameter on the drive that smooth the signal but it works more or less... i think woth the dac should be perfect... i have a strange behavior when everything is off(wheel check and game closed) i get the wheel to bounce left and right, with wheel check set to simple spring i get vibrations around 0 point... is there a parameter for a deadzone?
NOW i'm more than sure that is some way it will work... the force seams really good on the shaft...
No, wheel axis does not have deadzone. May be force is too strong, and even very low FFB force near center cause axis to move? try to lower effect gain.
I will try tomorrow, i 3d printed an adapter for a wheel now and tomorrow with the dac should be better... thank you for your time!
the DAC is outputing always 0v despite the force value... i tried a new software with the adafruit library and it works... then i used bb i2c and it does not... i'm trying to find why... i'll keep you updated.
no luck for today... i made some research, and i'll try to do something later... some info i found on the dac attached...
void writeDAC(uint16_t value)
{
value &= 0x0FFF; //clear first 4 bits for fast & normal modes
Wire.begin();
Wire.setClock(400000);
Wire.beginTransmission(MCP4725_ADDR);
Wire.write(value>>8);
Wire.write((uint8_t)value);
Wire.endTransmission();
Wire.end();
}
Update! I removed part of the serial output in the main program, fitted the code and it works perfectly... now i will adapt my old pedals bolt the wheel and try it in game... the dac remove the noise that the motor had with pwm... do you have some standard parameter to put in the gui for FF? Or 1024 everywhere is a good starting point?... thanks for the help!
1024 for FFB effect gains is default starting point. It means coefficient 1:1, i.e.: if force is 50%, output PWM value will be also 50%. Most games use only constant force effect.
Hi i work a lot with servo motors and i have one that could be used as a wheelbase... but they are controlled with a DIR+/- pin and a PULSE+/- pin... can your code be adapted? or do i need to write all by myself?