I am a programmer by profession and new to Robotics. I have studied ECE, so know electronics, but not very familiar with mechanical aspects of robotics. I am working on a learning project with Dagu Rover 5 platform.

I am trying to control the 4 DC motors with PWM and want to use the optical encoders for feedback. I am looking for some algorithms, example code in C to effectively control the rover. I know how to control the GPIO, PWM and interrupts from the processor. I am more interested in learning the algorithm that controls the motors based on this. For now, i am working on a manual robot, controlled with up/down/left/right keys. In future, I would like to add sensors, camera etc and work on autonomous aspects. Any pointers would be helpful.

For reference, I am working on the Raspberry Pi platform to control the rover.

  • $\begingroup$ The word "control" can mean a lot of things in robotics. For instance are you asking how you send commands to the robot or how ensure the motors do what you intend them to do? $\endgroup$ Commented Sep 21, 2013 at 17:29
  • $\begingroup$ This question needs a bit more focus. What specific thing would you like the robot to do? That will guide the choice of algorithm. $\endgroup$
    – Ian
    Commented Sep 28, 2013 at 18:34
  • $\begingroup$ you could be more specific in the project you are creating? what are the skills you want the robot? logarithms are many that can be used. I would like to accompany you $\endgroup$ Commented Apr 14, 2016 at 0:54
  • $\begingroup$ On Robotics, we prefer practical, answerable questions based on actual problems that you face, so it is a good idea to include details of what what you would like to achieve, what you have tried, what you expected to see & what you actually saw. Please take a look at How to Ask & tour for more information on how stack exchange works and work through the Robotics question checklist to edit your question to make it clearer. $\endgroup$
    – Mark Booth
    Commented Apr 15, 2016 at 9:51

1 Answer 1


Specifically about control of motors by PWM, you should learn about the PID controller.

The sky's the limit for what you want to learn about. Find a robotics simulator to start playing around with algorithms -- otherwise you will find that you will spend all year building the robot instead.

For a mobile robot, motion planning or mapping algorithms would be a good start.

Real sensors are noisy and ambiguous, so machine learning (i.e. statistical, fuzzy learning) is a whole field you can look at if you're interested, with applications in control, motion planning, and vision processing. How much time do you have?

  • $\begingroup$ Thanks..! Can you point me to some online material which is good for beginners? $\endgroup$
    – Punit Soni
    Commented Sep 27, 2013 at 18:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.