ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

DC motor +Raspberry pi3+ROS

asked 2017-01-21 11:29:25 -0600

Abhinav Sonone gravatar image

Hello everyone, I want to control simple dc motors using R-pi3 and Ros, Is it possible? Not enough tutorials are available!

edit retag flag offensive close merge delete

5 Answers

Sort by ยป oldest newest most voted

answered 2017-02-12 05:34:36 -0600

duck-development gravatar image

this is also a nice motor drive an there is Raspberry Robot wich use it

edit flag offensive delete link more

answered 2017-01-21 12:59:07 -0600

NEngelhard gravatar image

You will need a motor driver (like the DRV8835) and the corresponding driver library This gives you a python application that talks to the motors. Now add a bit of ROS and you have moving robot.

edit flag offensive delete link more


I have a LM298 motor driver. IS the corresponding library available?

Abhinav Sonone gravatar image Abhinav Sonone  ( 2017-01-22 23:15:54 -0600 )edit

the Problem with the LM298 is that i use 5V Logic Voltage it can kill you PI.

duck-development gravatar image duck-development  ( 2017-02-12 05:26:53 -0600 )edit

answered 2017-02-11 16:08:45 -0600

If the motor has <400 mA max current draw and you are ok with it turning one direction, you can use the Pi pin to directly drive the base pin of a 2222 NPN transistor to drive a motor. PWM via RPIO may even work in modulating the speed. It's a simple alternative to getting a motor driver.

Let me know if you have questions, happy to expand on details.

Cheers Jack

edit flag offensive delete link more

answered 2017-01-22 09:44:38 -0600

updated 2017-01-22 15:00:09 -0600

It will depend on the DC motors. Are they brushed or brushless motors? What voltage is required? What amperage is required?

One option is to use an I2C PWM hat or shield and an electronic speed control (ESC) for each motor. This also allows up to 16 motors (more by combining shields).

The PWM + ESC allows for a wide range of voltages and amperages, depending on the ESC. Some common ESCs are 4.8-11V and 9-16v. There are some for even higher. ESCs are also rated by current units available for very high current such as 120A or more.

Here is documentation for an I2C PWM package for ROS:

edit flag offensive delete link more

answered 2017-01-22 22:01:24 -0600

hmchung gravatar image

The simplest way I can think of: Hardware: RPi3 -> Arduino -> Speed Controller -> Motor Software: - In RPi3: rosserial - In Arduino: rosserial, servo_lib

edit flag offensive delete link more


You might also consider ros_arduino_bridge. I've found that rosserial uses a lot of memory, so is not as appropriate for a 2Kb RAM Arduino. (Larger MCs like the Mega or Teensy should be fine with rosserial.)

Mark Rose gravatar image Mark Rose  ( 2017-01-25 13:48:23 -0600 )edit

I use the rosserial with an Arduino Nano, it has merory to controll two Steppers, and the IMU may also work. but the arduino is near to full

duck-development gravatar image duck-development  ( 2017-02-12 05:29:23 -0600 )edit

Question Tools

1 follower


Asked: 2017-01-21 11:29:25 -0600

Seen: 3,549 times

Last updated: Feb 12 '17