Extracting rotary encoder data to control the position of a servo

Hello,

I am working on a project that involves a DC motor, rotary encoder, and servo motor. I would like to use a rotary encoder on a continuously running DC motor to obtain position data. For each revolution of the DC motor, the servo should go through a desired set of positions(0-90-0). I would like the change from 0 to 90 degrees and back to be gradual. Is there a way to extract rotary encoder data so it can be used to tell the servo when to move to a desired position? Any information or example codes would be greatly appreciated!

  • Grant2018

Yes, I understand that reading an encoder is a very simple task for Arduino. I am looking to use the encoder data so that at various pulses throughout the revolution of the DC motor, I can tell the servo to go to a desired position. I searched the internet a good amount before coming to this forum for help. Any example codes that use the data obtained from the encoder to control a servo, would be helpful.

The specifications are done! I didn't want to put too much detail into the post because I'm not asking for someone to write it for me. I searched around and couldn't find help on this. I am just looking for a sample code that would help me understand the basics of this operation so that I can work on this myself.

Hello,
I am working on a project that involves a DC motor, rotary encoder, and servo motor. I would like to use a rotary encoder on a continuously running DC motor to obtain position data. For each revolution of the DC motor, the servo should go through a desired set of positions. Is there a way to use extracted rotary encoder data so it can be used to tell the servo when to move to a desired position? I searched the web and have not found any help. Any information or example codes would be greatly appreciated!

DON'T CROSS POST!!!!!!!!!!!!!!!!!!!!
http://forum.arduino.cc/index.php?topic=520522
I HAVE REPORTED THIS THREAD TO THE MODERATORS

You're already being helped in the other thread. Why would you post this again?

This is my first time posting. I thought this thread would provide better help.

If you want to have a thread moved to a different section of the forum you should click the "report to moderator" link and ask nicely for it to be moved instead of creating a duplicate post. However, it's best to take the time to find the best forum section before you post because the moderators already have plenty of work dealing with spam.

Thank you, i'm a newbie after all.

Have you looked at YouTube for examples?

I am just looking for a sample code that would help me understand the basics of this operation

Google "arduino control DC motor", "arduino rotary encoder" or "arduino control servo" for thousands of tutorials and sample code examples.

Threads merged.