Programming DC motor with encoder

Hi guys,
I am super new to this. But I was wondering if there a way to use a DC motor with an encoder that connects to a blue tooth button. My goal is to have the motor so a quarter turn clockwise when the button is hit then do a quarter turn counterclockwise when the button is hit again. I need it to be a continuous cycle so it can keep doing alternating counterclockwise and clockwise quarter turns. The button also needs to have a wireless connection with the DC motor. If anyone has suggestions on how to do this that would be great.

Thanks,
Sam

Could you use an RC servo instead, like an SG90?

With a free running DC motor, you’ll have problems unless it’s geared down.

The encoder is a nice touch, but for a repetitive fixed motion, probably overkill.

Look at a geared dc motor, stepper, or servo, and limit switches.
Much easier to implement.

The problem with that is I need it to stay at the quarter turn position until the button is pressed again. I’m not totally sure but doesn’t a servo need constant power to keep from returning to its original position?

No. If you shut the power off it stays where it is. If you stop sending data it stays where it is. If you send the same data it locks to where it is.

Oh ok that is definitely less complicated thanks!

If I use a servo how would i go about programming it to turn a certain amount of degrees one way when a wireless button is pressed and then back to another position once it’s pressed again? It won’t be connected to a computer so I’m wondering if there’s a way to make it remember that it does this when the button is pressed?

Look at the servo examples. You hook it up to a pwm pin then you just tell it what position to go to and it goes.

A servo can use any digital pin. It does not have to be a PWM pin.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.