int pwmOutput = 128 + P * error + D * (error - oldError) + I * accumulatedError;analogWrite(outputPin, (pwmOutput < 0) ? 0 : (pwmOutput > 255) ? 255 : pwmOutput);
int pwmOutput = 128 + P * error + D * (error - oldError) + I * accumulatedError;
analogWrite(outputPin, (pwmOutput < 0) ? 0 : (pwmOutput > 255) ? 255 : pwmOutput);
A couple of MM??? What??? is impossible... it will be around 1/3 cm...
I don't understand...why 3 mm?
it will be around 1/3 cm.
you may better describe the three variables P D and I?
Magnetic force decrease at square of the distance.
i'm going to make a STRONG electromagnet to use in this project...any suggestions
However, as you will want to be able to turn it off quickly then as few turns as possible. This points to using as high a voltage as you can. One problem you will find is that you can't just turn on an off a field it takes time to build up as the current builds up in the inductor. Make this inductive time constant short compared with the mechanical movement of your target.
You can get a faster current decay by putting a resistor in series with the flyback diode,
So by slowing down the rate the inverse current decays you get faster decay?
This effect of the diode causing a slow current decay is noticeable with some relays. With a diode connected directly across the relay coil, if you know the switch on/off times, you can often sense the delay between the current switching off and the click of the relay opening.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16