Hello Arduino world,
I am a complete newbie with Arduino. I am working on a project where I need to control a linear actuator with a built in potentiometer. Wiring and set up is not a problem for me. I need help with the sketch to make it work. I do not have the time on this project to completely learn the programing language. This is why I am reaching out. What i need to achieve is
Push button to start motion
have speed ramp in slowly to full then ramp down toward end of travel(based on pot values)
then push button again to reverse the same ramp in and out.
I can use a 2 button setup if necessary.
I also need to set up soft limits based on pot values.
Hopefully someone out there can give me an idea of how to make this work.
You will also need an external transistor to supply the motor. How do you reverse the motor?
This is easily doable with any Arduino.
You need a state machine. with at least these States:
WaitForButton
StartLeft
AccelerateLeft
FullSpeedLeft
DecelerateLeft
StopLeft
StartRight
AccelerateRight
FullSpeedRight
DecelerateRight
StopRight
And some sample psuedocode
loop()
{
pot = updatePotValue()
if (State == WaitForButton) {
if (button1 == HIGH) {
State = StartLeft
}
} else if (State == StartLeft) {
setMotorLeft
speed = 0
setMotorSpeed(speed)
state = AccelerateLeft
} else if (State == AccelerateLeft)
speed = speed+1
setMotorSpeed()
if (pot == leftEnd) {
// something is wrong!
state = StopLeft
}
if (speed == 255) {
state = FullSpeedLeft
}
Thank you both for the responses. I will start with this and see where it gets me. the IBT_2 motor controller should be the only needed link between the UNO and the Motor. It will do the reversing based on the output from the uno.