Newbie needs help!! One Switch controlled to motors. Time delayed.

Dear Arduino Community,

I am a complete newbie and would need some advice. I have a clear project in mind and am currently reading into the whole area of microprocessors. I have come to the conclusion that the best start is Arduino, still I am looking for some help.

Background. I am currently working on project where I want two things to happen when I press a switch. When the switch is turned “on” then these two things shall happen:

1) A little hatch opens and 2) 2) a little box comes out. So two separate motors have to be controlled separately and timely delayed.

When the switch is turned off, the two steps have to revers.

All this is in an 12V environment.

As I said, I am completely new and very thankful for any tips where I should focus when looking into this.

Thanks!

Hi papperlapub,

Yes, that sounds perfectly possible with Arduino. Servo motors may be the way to go.

Paul

Hi,

All this is in an 12V environment.

You will need something called a "motor driver" to control the motors at 12V. You can use ICs like L293 to make your own motor driver or use a motor driver shield (which I think is the quicker and easier option as you are beginner). You can also use an h-bridge to do control the anticlockwise and clockwise motions of the motors. You will also need to understand how to interface motors using an Arduino through the motor driver or h-bridge.

As for the coding part you can use the following procedure:

if the switch is on
{
    move first motor (the one controlling the hatch)
    wait for some time (use the delay() function)
    move the second motor
    wait again
}
else (i.e. if the switch is off)
{
    move the first motor in opposite direction
    wait.....
    move the second motor in opposite direction
    wait again
}

I'm assuming that you are using DC motors. If you are using servos or steppers just post it and people will help you out.