    source /opt/ros/dashing/setup.bash
    ros2 run rviz2 rviz2 -d $(ros2 pkg prefix nav2_bringup)/share/nav2_bringup/launch/nav2_default_view.rviz


Already on GitHub? [ Sign in ](/login?return_to=%2Fros-
planning%2Fnavigation2%2Fissues%2Fnew%2Fchoose) to your account


###  Recent questions tagged ` nav2_bringup ` at **[ Robotics Stack Exchange
](https://robotics.stackexchange.com/) **


* Some discussions about performance improvement of composed bringup could be found here: [ https://discourse.ros.org/t/nav2-composition/22175 ](https://discourse.ros.org/t/nav2-composition/22175) .


No test statistics available for this package.")
**Released** |  RELEASED
**Tags** |  _No category tags._
**Contributing** |  [ Help Wanted (  0  ) ](/r/nav2_platform/#indigo-
contribute-lists-help-wanted)
[ Good First Issues (  0  ) ](/r/nav2_platform/#indigo-contribute-lists-good-
first-issue)
[ Pull Requests to Review (  0  ) ](/r/nav2_platform/#indigo-contribute-lists-
pull-requests)

###  Package Description


_No direct system dependencies._


[ API Docs ](http://docs.ros.org/en/dashing/p/nav2_bringup "View API
documentation on docs.ros.org") [ Browse Code ](https://github.com/ros-
planning/navigation2/tree/dashing-devel/nav2_bringup "View source code on
repository")


  * Gazebo installed on the system
  * gazebo_ros_pkgs for ROS2 installed on the system
  * A Gazebo world for simulating the robot (see Gazebo tutorials)
  * A map of that world saved to a map.pgm and map.yaml (see ROS Navigation tutorials)


###  Wiki Tutorials


CHANGELOG


_No additional links._


planning-navigation2) [ navigation2 ](/p/navigation2/github-ros-planning-
navigation2)
---|---

github-ros-planning-navigation2


from launch import LaunchDescription
from launch.actions import (
    DeclareLaunchArgument,
    GroupAction,
    IncludeLaunchDescription,
    SetEnvironmentVariable,
)
from launch.conditions import IfCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration, PythonExpression
from launch_ros.actions import Node
from launch_ros.actions import PushROSNamespace
from launch_ros.descriptions import ParameterFile
from nav2_common.launch import ReplaceString, RewrittenYaml


Name  |  Repo  |  Deps  |  [ rtabmap_demos ](/p/rtabmap_demos/github-introlab-
rtabmap_ros#iron) |  [ github-introlab-rtabmap_ros ](/r/rtabmap_ros/github-
introlab-rtabmap_ros) |  [ ](/p/rtabmap_demos/github-introlab-
rtabmap_ros#iron-deps)
---|---|---
[ nav2_system_tests ](/p/nav2_system_tests/github-ros-planning-
navigation2#iron) |  [ github-ros-planning-navigation2
](/r/navigation2/github-ros-planning-navigation2) |  [
](/p/nav2_system_tests/github-ros-planning-navigation2#iron-deps)
[ sm_dance_bot ](/p/sm_dance_bot/github-robosoft-ai-SMACC2#iron) |  [ github-
robosoft-ai-SMACC2 ](/r/smacc2/github-robosoft-ai-SMACC2) |  [
](/p/sm_dance_bot/github-robosoft-ai-SMACC2#iron-deps)
[ sm_dance_bot_strikes_back ](/p/sm_dance_bot_strikes_back/github-robosoft-ai-
SMACC2#iron) |  [ github-robosoft-ai-SMACC2 ](/r/smacc2/github-robosoft-ai-
SMACC2) |  [ ](/p/sm_dance_bot_strikes_back/github-robosoft-ai-SMACC2#iron-
deps)
[ sm_dance_bot_warehouse ](/p/sm_dance_bot_warehouse/github-robosoft-ai-
SMACC2#iron) |  [ github-robosoft-ai-SMACC2 ](/r/smacc2/github-robosoft-ai-
SMACC2) |  [ ](/p/sm_dance_bot_warehouse/github-robosoft-ai-SMACC2#iron-deps)
[ sm_dance_bot_warehouse_2 ](/p/sm_dance_bot_warehouse_2/github-robosoft-ai-
SMACC2#iron) |  [ github-robosoft-ai-SMACC2 ](/r/smacc2/github-robosoft-ai-
SMACC2) |  [ ](/p/sm_dance_bot_warehouse_2/github-robosoft-ai-SMACC2#iron-
deps)
[ sm_dance_bot_warehouse_3 ](/p/sm_dance_bot_warehouse_3/github-robosoft-ai-
SMACC2#iron) |  [ github-robosoft-ai-SMACC2 ](/r/smacc2/github-robosoft-ai-
SMACC2) |  [ ](/p/sm_dance_bot_warehouse_3/github-robosoft-ai-SMACC2#iron-
deps)

###  Launch files


**Checkout URI** |  [ https://github.com/ros-planning/navigation2.git
](https://github.com/ros-planning/navigation2.git)
---|---
**VCS Type** |  git
**VCS Version** |  iron
**Last Updated**

2024-04-04  |  **Dev Status** |  DEVELOPED
**CI status** |  No Continuous Integration
**Released** |  RELEASED
**Tags** |  _No category tags._
**Contributing** |  [ Help Wanted (  0  ) ](/r/navigation2/#iron-contribute-
lists-help-wanted)
[ Good First Issues (  0  ) ](/r/navigation2/#iron-contribute-lists-good-
first-issue)
[ Pull Requests to Review (  0  ) ](/r/navigation2/#iron-contribute-lists-
pull-requests)

###  Package Description


_No plugins found._


    declare_map_yaml_cmd = DeclareLaunchArgument(
        'map', default_value='', description='Full path to map yaml file to load'
    )


Failed to get question list, you can ticket an issue [ here
](https://github.com/ros-infrastructure/rosindex/issues/new)


No version for distro **kinetic** . Known supported distros are highlighted in
the buttons above.


For


###  Terminal 1: Launch Gazebo


---

[
API Docs ](http://docs.ros.org/en/foxy/p/nav2_bringup "View API documentation
on docs.ros.org") [
Browse Code ](https://github.com/ros-planning/navigation2/tree/foxy-
devel/nav2_bringup/bringup "View source code on repository")


Query


ros2 launch nav2_bringup unique_multi_tb3_simulation_launch.py


###  Services


####  Package Summary


###  [ nav2_bringup ](/p/nav2_bringup) package from [ navigation2
](/r/navigation2/github-ros-planning-navigation2) repo


#  Saved searches


_No additional links._


    * [ Learning Pathways  ](https://resources.github.com/learn/pathways/)
    * [ White papers, Ebooks, Webinars  ](https://resources.github.com/)
    * [ Customer Stories ](/customer-stories)
    * [ Partners  ](https://partner.github.com/)


Sign up for GitHub


Set the World Model and the two costmap nodes to use simulation time


_No message files found._


    # Specify the actions
    bringup_cmd_group = GroupAction(
        [
            PushROSNamespace(condition=IfCondition(use_namespace), namespace=namespace),
            Node(
                condition=IfCondition(use_composition),
                name='nav2_container',
                package='rclcpp_components',
                executable='component_container_isolated',
                parameters=[configured_params, {'autostart': autostart}],
                arguments=['--ros-args', '--log-level', log_level],
                remappings=remappings,
                output='screen',
            ),
            IncludeLaunchDescription(
                PythonLaunchDescriptionSource(
                    os.path.join(launch_dir, 'slam_launch.py')
                ),
                condition=IfCondition(slam),
                launch_arguments={
                    'namespace': namespace,
                    'use_sim_time': use_sim_time,
                    'autostart': autostart,
                    'use_respawn': use_respawn,
                    'params_file': params_file,
                }.items(),
            ),
            IncludeLaunchDescription(
                PythonLaunchDescriptionSource(
                    os.path.join(launch_dir, 'localization_launch.py')
                ),
                condition=IfCondition(PythonExpression(['not ', slam])),
                launch_arguments={
                    'namespace': namespace,
                    'map': map_yaml_file,
                    'use_sim_time': use_sim_time,
                    'autostart': autostart,
                    'params_file': params_file,
                    'use_composition': use_composition,
                    'use_respawn': use_respawn,


##  Comments


#  Search code, repositories, users, issues, pull requests...


_See[ ROS Wiki Tutorials ](http://wiki.ros.org/nav2_bringup/Tutorials) for
more details. _


###  Package Dependencies


**Required Info:**


In RViz: * You should see the map * Localize the robot using “2D Pose
Estimate” button. * Make sure all transforms from odom are present.
(odom->base_link->base_scan) * Send the robot a goal using "Nav2 Goal” button.
Note: this uses a ROS2 Action to send the goal, and a pop-up window will
appear on your screen with a 'cancel' button if you wish to cancel


Before running the command make sure you are sourcing the ` ROS2 ` workspace,
setting the path to the Gazebo model and defining the TB3 robot model to use.


_No launch files found_


No questions yet, you can ask one [ here
](https://robotics.stackexchange.com/questions/tagged/nav2_bringup+hydro) .


_No direct system dependencies._


_No additional authors._


_No plugins found._


    source /opt/ros/dashing/setup.bash
    export TURTLEBOT3_MODEL=waffle
    ros2 launch turtlebot3_bringup turtlebot3_state_publisher.launch.py use_sim_time:=True


def generate_launch_description():
    # Get the launch directory
    bringup_dir = get_package_share_directory('nav2_bringup')


To view the robot model in RViz: * Add "RobotModel", set "Description Source"
with "File", set "Description File" with the name of the urdf file for your
robot (example: turtlebot3_burger.urdf)"


    declare_use_namespace_cmd = DeclareLaunchArgument(
        'use_namespace',
        default_value='false',
        description='Whether to apply a namespace to the navigation stack',
    )


    declare_use_composition_cmd = DeclareLaunchArgument(
        'use_composition',
        default_value='False',
        description='Use composed bringup if True',
    )


###  Terminal 2 : Launch RVIZ


No questions yet, you can ask one [ here
](https://robotics.stackexchange.com/questions/tagged/nav2_bringup+crystal) .


###  Wiki Tutorials


  * [ github-paulbovbel-nav2_platform ](/p/nav2_bringup/github-paulbovbel-nav2_platform)
  * [ github-ros-planning-navigation2 ](/p/nav2_bringup/github-ros-planning-navigation2)


_No service files found_


###  Plugins


    export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:<full/path/to/my_robot/models>
    gazebo --verbose -s libgazebo_ros_init.so <full/path/to/my_gazebo.world>


##  Launch


return ld


###  Advanced: single-terminal launch


  * Overview
  * 0  Assets
  * 12  Dependencies
  * 0  Tutorials
  * 0  Q & A


_No additional links._


    # Declare the launch options
    ld.add_action(declare_namespace_cmd)
    ld.add_action(declare_use_sim_time_cmd)
    ld.add_action(declare_params_file_cmd)
    ld.add_action(declare_autostart_cmd)
    ld.add_action(declare_use_composition_cmd)
    ld.add_action(declare_container_name_cmd)
    ld.add_action(declare_use_respawn_cmd)
    ld.add_action(declare_log_level_cmd)
    # Add the actions to launch all of the navigation nodes
    ld.add_action(load_nodes)
    ld.add_action(load_composable_nodes)


CHANGELOG


###  Pre-requisites:


_No README found._ _[ See repository README. ](/r/nav2_platform/github-
paulbovbel-nav2_platform/#indigo) _


    declare_use_composition_cmd = DeclareLaunchArgument(
        'use_composition',
        default_value='True',
        description='Whether to use composed bringup',
    )


Resources


A convenience file is provided to launch Gazebo, RVIZ and Navigation2 using a
single command:


No questions yet, you can ask one [ here
](https://robotics.stackexchange.com/questions/tagged/nav2_bringup+humble) .


###  Messages


    source turtlebot3_ws/install/setup.bash
    export TURTLEBOT3_MODEL=waffle
    ros2 launch turtlebot3_bringup turtlebot3_state_publisher.launch.py use_sim_time:=True


` ros2 launch nav2_bringup nav2_bringup_launch.py map:=<full/path/to/map.yaml>
map_type:=occupancy `


  * Overview
  * 3  Assets
  * 5  Dependencies
  * 0  Tutorials
  * 0  Q & A


* Publish all the transforms from your robot from base_link to base_scan


    declare_use_sim_time_cmd = DeclareLaunchArgument(
        'use_sim_time',
        default_value='false',
        description='Use simulation (Gazebo) clock if true',
    )


    ros2 launch nav2_bringup nav2_bringup_launch.py map:=<full/path/to/map.yaml> use_sim_time:=True
    ros2 param set /world_model use_sim_time True; ros2 param set /global_costmap/global_costmap use_sim_time True; ros2 param set /local_costmap/local_costmap use_sim_time True


In RViz: * You should see the map * Localize the robot using “2D Pose
Estimate” button. * Make sure all transforms from odom are present.
(odom->base_link->base_scan) * Send the robot a goal using “Navigation2 Goal”
button. Note: this uses a ROS2 Action to send the goal, and a pop-up window
will appear on your screen with a 'cancel' button if you wish to cancel


[ ![@crdelsey](https://avatars.githubusercontent.com/u/39749483?s=40&v=4)
](/crdelsey) [ crdelsey ](/crdelsey) closed this as [ completed ](/ros-
planning/navigation2/issues?q=is%3Aissue+is%3Aclosed+archived%3Afalse+reason%3Acompleted)
Nov 13, 2018


####  Additional Links


Older


###  Pre-requisites:


**Tags** |  _No category tags._
---|---
**Version** |  0.2.6
**License** |  Apache-2.0
**Build type** |  AMENT_CMAKE
**Use** |  RECOMMENDED

###  Repository Summary


    declare_params_file_cmd = DeclareLaunchArgument(
        'params_file',
        default_value=os.path.join(bringup_dir, 'params', 'nav2_params.yaml'),
        description='Full path to the ROS2 parameters file to use for all launched nodes',
    )


ros2 launch nav2_bringup tb3_simulation_launch.py <settings>


    declare_container_name_cmd = DeclareLaunchArgument(
        'container_name',
        default_value='nav2_container',
        description='the name of conatiner that nodes will load in if use composition',
    )


_No additional links._


[ crdelsey ](/crdelsey) opened this issue  Nov 13, 2018  · 1 comment


#  nav2_bringup


In RVIZ: * Make sure all transforms from odom are present.
(odom->base_link->base_scan) * Localize the robot using “2D Pose Estimate”
button.


#  Provide feedback


  * Michael Jeronimo
  * Steve Macenski
  * Carlos Orduno


[ ](https://github.com/)


Contributor


_No plugins found._


  * [ Notifications ](/login?return_to=%2Fros-planning%2Fnavigation2)
  * [ Fork  1.1k  ](/login?return_to=%2Fros-planning%2Fnavigation2)
  * [ Star  2.1k  ](/login?return_to=%2Fros-planning%2Fnavigation2)


To view the robot model in RViz: * Add "RobotModel", set "Description Source"
with "File", set "Description File" with the name of the urdf file for your
robot (example: turtlebot3_burger.urdf)"


[ ](https://lunrjs.com/guides/searching.html "Help to Search")


    load_composable_nodes = GroupAction(
        condition=IfCondition(use_composition),
        actions=[
            SetParameter('use_sim_time', use_sim_time),
            LoadComposableNodes(
                target_container=container_name_full,
                composable_node_descriptions=[
                    ComposableNode(
                        package='nav2_controller',
                        plugin='nav2_controller::ControllerServer',
                        name='controller_server',
                        parameters=[configured_params],
                        remappings=remappings + [('cmd_vel', 'cmd_vel_nav')],
                    ),
                    ComposableNode(
                        package='nav2_smoother',
                        plugin='nav2_smoother::SmootherServer',
                        name='smoother_server',
                        parameters=[configured_params],
                        remappings=remappings,
                    ),
                    ComposableNode(
                        package='nav2_planner',
                        plugin='nav2_planner::PlannerServer',
                        name='planner_server',
                        parameters=[configured_params],
                        remappings=remappings,
                    ),
                    ComposableNode(
                        package='nav2_behaviors',
                        plugin='behavior_server::BehaviorServer',
                        name='behavior_server',
                        parameters=[configured_params],
                        remappings=remappings + [('cmd_vel', 'cmd_vel_nav')],
                    ),
                    ComposableNode(
                        package='nav2_bt_navigator',
                        plugin='nav2_bt_navigator::BtNavigator',
                        name='bt_navigator',
                        parameters=[configured_params],


###  Dependant Packages


    source navigation2_ws/install/setup.bash
    ros2 run rviz2 rviz2 -d $(ros2 pkg prefix nav2_bringup)/share/nav2_bringup/launch/nav2_default_view.rviz


Please refer to below examples.


Notes: * Setting use_sim_time has to be done dynamically after the nodes are
up due to this bug: [ https://github.com/ros2/rclcpp/issues/595
](https://github.com/ros2/rclcpp/issues/595) * Sim time needs to be set in
every namespace individually. * Sometimes setting use_sim_time a second time
is required for all the nodes to get updated * IF you continue to see WARN
messages like the ones below, retry setting the use_sim_time parameter


  * fix dependencies and building
  * Contributors: Paul Bovbel


Failed to get question list, you can ticket an issue [ here
](https://github.com/ros-infrastructure/rosindex/issues/new)


  * [ launch/nav2_amcl.launch ](https://github.com/paulbovbel/nav2_platform/tree/hydro-devel/nav2_bringup/launch/nav2_amcl.launch)
    * __
    *       * **map_path**
      * **use_external_map** _[default: true]_
  * [ launch/nav2_gmapping.launch ](https://github.com/paulbovbel/nav2_platform/tree/hydro-devel/nav2_bringup/launch/nav2_gmapping.launch)
    * __
    *       * **use_external_map** _[default: true]_
  * [ launch/nav2_robot.launch ](https://github.com/paulbovbel/nav2_platform/tree/hydro-devel/nav2_bringup/launch/nav2_robot.launch)
    * __
    *       * **use_external_map** _[default: false]_
      * **robot_address**
      * **robot_port** _[default: 5010]_
      * **use_external_map** _[default: $(arg use_external_map)]_


_No additional links._


###  Terminal 3: Launch Nav2


####  Unique


Bringup scripts and configurations for the navigation2 stack


  * fix dependencies
  * Contributors: Paul Bovbel


    stdout_linebuf_envvar = SetEnvironmentVariable(
        'RCUTILS_LOGGING_BUFFERED_STREAM', '1'
    )


The ` nav2_bringup ` package is an example bringup system for Nav2
applications.


**Checkout URI** |  [ https://github.com/paulbovbel/nav2_platform.git
](https://github.com/paulbovbel/nav2_platform.git)
---|---
**VCS Type** |  git
**VCS Version** |  hydro-devel
**Last Updated**

2014-09-13  |  **Dev Status** |  MAINTAINED
**CI status** |  [ Continuous Integration ](devel-hydro-nav2_platform "Latest
build information: Fri, 28 Aug 2015 11:45:28 GMT


###  Pre-requisites:


![](/assets/package.png) |


Where ` <settings> ` can used to replace any of the default options, for
example:


####  Authors


` sudo apt install ros-<ros2_distro>-nav2-bringup `


###  Package Dependencies


###  Multi-robot Simulation


ROS launch files for Nav2 Robot Platform bringup


###  [ nav2_bringup ](/p/nav2_bringup) package from [ nav2_platform
](/r/nav2_platform/github-paulbovbel-nav2_platform) repo


    world:=<full/path/to/gazebo.world>
    map:=<full/path/to/map.yaml>
    rviz_config_file:=<full/path/to/rviz_config.rviz>
    simulator:=<gzserver or gazebo>
    bt_xml_file:=<full/path/to/bt_tree.xml>


Copy link


#  nav2_bringup


---

[
API Docs ](http://docs.ros.org/en/humble/p/nav2_bringup "View API
documentation on docs.ros.org") [
Browse Code ](https://github.com/ros-
planning/navigation2/tree/humble/nav2_bringup "View source code on
repository")


* Solutions


_No plugins found._


###  Terminal 2 : Launch RVIZ


####  Maintainers


Run the launch file with a custom map as below


    declare_namespace_cmd = DeclareLaunchArgument(
        'namespace', default_value='', description='Top-level namespace'
    )


The ` nav2_bringup ` package is an example bringup system for navigation2
applications.


Name  |  Repo  |  Deps  |  [ turtlebot3_navigation2
](/p/turtlebot3_navigation2/github-ROBOTIS-GIT-turtlebot3#galactic) |  [
github-ROBOTIS-GIT-turtlebot3 ](/r/turtlebot3/github-ROBOTIS-GIT-turtlebot3) |
[ ](/p/turtlebot3_navigation2/github-ROBOTIS-GIT-turtlebot3#galactic-deps)
---|---|---
[ nav2_system_tests ](/p/nav2_system_tests/github-ros-planning-
navigation2#galactic) |  [ github-ros-planning-navigation2
](/r/navigation2/github-ros-planning-navigation2) |  [
](/p/nav2_system_tests/github-ros-planning-navigation2#galactic-deps)
[ sm_dance_bot ](/p/sm_dance_bot/github-robosoft-ai-SMACC2#galactic) |  [
github-robosoft-ai-SMACC2 ](/r/smacc2/github-robosoft-ai-SMACC2) |  [
](/p/sm_dance_bot/github-robosoft-ai-SMACC2#galactic-deps)
[ sm_dance_bot_strikes_back ](/p/sm_dance_bot_strikes_back/github-robosoft-ai-
SMACC2#galactic) |  [ github-robosoft-ai-SMACC2 ](/r/smacc2/github-robosoft-
ai-SMACC2) |  [ ](/p/sm_dance_bot_strikes_back/github-robosoft-ai-
SMACC2#galactic-deps)
[ sm_dance_bot_warehouse ](/p/sm_dance_bot_warehouse/github-robosoft-ai-
SMACC2#galactic) |  [ github-robosoft-ai-SMACC2 ](/r/smacc2/github-robosoft-
ai-SMACC2) |  [ ](/p/sm_dance_bot_warehouse/github-robosoft-ai-
SMACC2#galactic-deps)
[ sm_dance_bot_warehouse_2 ](/p/sm_dance_bot_warehouse_2/github-robosoft-ai-
SMACC2#galactic) |  [ github-robosoft-ai-SMACC2 ](/r/smacc2/github-robosoft-
ai-SMACC2) |  [ ](/p/sm_dance_bot_warehouse_2/github-robosoft-ai-
SMACC2#galactic-deps)
[ sm_dance_bot_warehouse_3 ](/p/sm_dance_bot_warehouse_3/github-robosoft-ai-
SMACC2#galactic) |  [ github-robosoft-ai-SMACC2 ](/r/smacc2/github-robosoft-
ai-SMACC2) |  [ ](/p/sm_dance_bot_warehouse_3/github-robosoft-ai-
SMACC2#galactic-deps)
[ turtlebot4_navigation ](/p/turtlebot4_navigation/github-turtlebot-
turtlebot4#galactic) |  [ github-turtlebot-turtlebot4 ](/r/turtlebot4/github-
turtlebot-turtlebot4) |  [ ](/p/turtlebot4_navigation/github-turtlebot-
turtlebot4#galactic-deps)

###  Launch files


    source /opt/ros/dashing/setup.bash
    ros2 launch nav2_bringup nav2_bringup_launch.py use_sim_time:=True autostart:=True \
    map:=<full/path/to/map.yaml>


_See[ ROS Wiki Tutorials ](http://wiki.ros.org/nav2_bringup/Tutorials) for
more details. _


    file 'map:=/home/crdelsey/map.yaml' was not found in the share directory of package 'nav2_bringup' which is at '/home/crdelsey/src/ros_dev_workspace/navigation2_ws/install/nav2_bringup/share/nav2_bringup'

---

The text was updated successfully, but these errors were encountered:


` [ [AMRFM-1535] Add checking path for vehicles to free space navigation (
](/logivations/navigation2/commit/f3aa154c4b81094b2bb3de9c9ff371dc45168f47
"\[AMRFM-1535\] Add checking path for vehicles to free space navigation
\(#319\)") [ r… ](https://github.com/ros-planning/navigation2/issues/319) ` …


[ crdelsey ](/crdelsey) opened this issue  Nov 13, 2018  · 1 comment


_No message files found._


###  Terminal 1: Launch Gazebo


##  0.0.1 (2014-04-15)


In RVIZ: * Make sure all transforms from odom are present.
(odom->base_link->base_scan) * Localize the robot using “2D Pose Estimate”
button.


**Tags** |  _No category tags._
---|---
**Version** |  1.1.14
**License** |  Apache-2.0
**Build type** |  AMENT_CMAKE
**Use** |  RECOMMENDED

###  Repository Summary


  * [ Code  ](/ros-planning/navigation2)
  * [ Issues  61  ](/ros-planning/navigation2/issues)
  * [ Pull requests  25  ](/ros-planning/navigation2/pulls)
  * [ Actions  ](/ros-planning/navigation2/actions)
  * [ Projects  0  ](/ros-planning/navigation2/projects)
  * [ Security  ](/ros-planning/navigation2/security)
  * [ Insights  ](/ros-planning/navigation2/pulse)


####  Package Summary


[ nav2_bringup/README.md ](https://github.com/ros-
planning/navigation2/tree/dashing-devel/nav2_bringup/README.md "Open in git
repository")


Failed to get question list, you can ticket an issue [ here
](https://github.com/ros-infrastructure/rosindex/issues/new)


###  Plugins


##  0.0.7 (2014-09-13)


  * Overview
  * 0  Assets
  * 11  Dependencies
  * 0  Tutorials
  * 0  Q & A


###  Services


    # Declare the launch options
    ld.add_action(declare_namespace_cmd)
    ld.add_action(declare_use_namespace_cmd)
    ld.add_action(declare_slam_cmd)
    ld.add_action(declare_map_yaml_cmd)
    ld.add_action(declare_use_sim_time_cmd)
    ld.add_action(declare_params_file_cmd)
    ld.add_action(declare_autostart_cmd)
    ld.add_action(declare_use_composition_cmd)
    ld.add_action(declare_use_respawn_cmd)
    ld.add_action(declare_log_level_cmd)


_Not currently indexed._


Before running the command make sure you are sourcing the ` ROS2 ` workspace,
setting the path to the Gazebo model and defining the TB3 robot model to use.


If you want to bringup more than two robots, you should modify the `
unique_multi_tb3_simulation_launch.py ` script.


  * add port argument
  * refactor launch structure
  * initial commit for support packages
  * Contributors: Paul Bovbel


Development


In RVIZ: * Make sure all transforms from odom are present.
(odom->base_link->base_scan) * Localize the robot using “2D Pose Estimate”
button. * Send the robot a goal pose using “2D Nav Goal” button.


###  [ nav2_bringup ](/p/nav2_bringup) package from [ navigation2
](/r/navigation2/github-ros-planning-navigation2) repo


` ros2 run rviz2 rviz2 `


    source /opt/ros/dashing/setup.bash
    ros2 run rviz2 rviz2 -d $(ros2 pkg prefix nav2_bringup)/share/nav2_bringup/launch/nav2_default_view.rviz


No questions yet, you can ask one [ here
](https://robotics.stackexchange.com/questions/tagged/nav2_bringup+iron) .


Closed


_No additional authors._


###  Pre-requisites:


[ Search syntax tips ](https://docs.github.com/search-github/github-code-
search/understanding-github-code-search-syntax)


###  Recent questions tagged ` nav2_bringup ` at **[ Robotics Stack Exchange
](https://robotics.stackexchange.com/) **


  * [ Install Gazebo ](http://gazebosim.org/tutorials?tut=install_ubuntu&cat=install)
  * gazebo_ros_pkgs for ROS2 installed on the system


Deps  |  |  Name  |  [ ](/p/nav2_common#humble-deps) |  [ 1
](/packages/nav2_common) |  [ nav2_common ](/p/nav2_common#humble)
---|---|---
[ ](/p/navigation2#humble-deps) |  [ 1 ](/packages/navigation2) |  [
navigation2 ](/p/navigation2#humble)
[ ](/p/launch_ros#humble-deps) |  [ 2 ](/packages/launch_ros) |  [ launch_ros
](/p/launch_ros#humble)
[ ](/p/ament_cmake#humble-deps) |  [ 1 ](/packages/ament_cmake) |  [
ament_cmake ](/p/ament_cmake#humble)
[ ](/p/slam_toolbox#humble-deps) |  [ 1 ](/packages/slam_toolbox) |  [
slam_toolbox ](/p/slam_toolbox#humble)
[ ](/p/ament_lint_common#humble-deps) |  [ 1 ](/packages/ament_lint_common) |
[ ament_lint_common ](/p/ament_lint_common#humble)
[ ](/p/ament_lint_auto#humble-deps) |  [ 1 ](/packages/ament_lint_auto) |  [
ament_lint_auto ](/p/ament_lint_auto#humble)
[ ](/p/ament_cmake_gtest#humble-deps) |  [ 1 ](/packages/ament_cmake_gtest) |
[ ament_cmake_gtest ](/p/ament_cmake_gtest#humble)
[ ](/p/ament_cmake_pytest#humble-deps) |  [ 1 ](/packages/ament_cmake_pytest)
|  [ ament_cmake_pytest ](/p/ament_cmake_pytest#humble)
[ ](/p/launch#humble-deps) |  [ 1 ](/packages/launch) |  [ launch
](/p/launch#humble)
[ ](/p/launch_testing#humble-deps) |  [ 1 ](/packages/launch_testing) |  [
launch_testing ](/p/launch_testing#humble)

###  System Dependencies


` [ f3aa154
](/logivations/navigation2/commit/f3aa154c4b81094b2bb3de9c9ff371dc45168f47) `


* Learn more about how to use Navigation 2 with SLAM to create maps;


Where ` <settings> ` can used to replace any of the default options, for
example:


###  Wiki Tutorials


* Paul Bovbel


_No launch files found_


` ros2 launch nav2_bringup nav2_bringup_2nd_launch.py use_sim_time:=True `


Labels


  * [ github-paulbovbel-nav2_platform ](/p/nav2_bringup/github-paulbovbel-nav2_platform)
  * [ github-ros-planning-navigation2 ](/p/nav2_bringup/github-ros-planning-navigation2)


Notes: (June 2019, Dashing Release) * We recommend doing this on a Ubuntu
18.04 installation. We have build issues on 16.04. (see [
https://github.com/ros-planning/navigation2/issues/353
](https://github.com/ros-planning/navigation2/issues/353) ) * This stack and
ROS2 are still in heavy development and there are some bugs and stability
issues being worked on, so please do not try this on a robot without taking
_heavy_ safety precautions. THE ROBOT MAY CRASH! * It is recommended to start
with simulation using Gazebo before proceeding to run on a physical robot


* Install your robot specific package (ex: [ Turtlebot 3 ](http://emanual.robotis.com/docs/en/platform/turtlebot3/ros2/) )


  * [ About ](/about)
  * Index
    * [ Package List ](/packages/page/1/time/)
    * [ Repository List ](/repos/page/1/time/)
    *     * [ Nodes ](/srvs/)
    * [ Messages ](/msgs/)
    * [ Services ](/srvs/)
    * [ Plugins ](/srvs/)
    *     * [ System Dependencies ](/deps/)
  * [ Contribute ](/contribute)
  * [ Stats ](/stats)


#  Package Summary
Documented
ROS Serial is a point-to-point version of ROS communications over serial,
primarily for integrating low-cost microcontrollers (Arduino) into ROS. ROS
serial consists of a general p2p protocol, libraries for use with Arduino, and
nodes for the PC/Tablet side (currently in both Python and Java).
  * Author: Maintained by Michael Ferguson, Adam Stambler
  * License: BSD
  * Source: hg [ https://kforge.ros.org/rosserial/hg ](https://kforge.ros.org/rosserial/hg) (branch: default)
_**rosserial** : [ rosserial_arduino ](/rosserial_arduino?distro=fuerte) | [
rosserial_client ](/rosserial_client?distro=fuerte) | [
rosserial_embeddedlinux ](/rosserial_embeddedlinux?distro=fuerte) | [
rosserial_msgs ](/rosserial_msgs?distro=fuerte) | [ rosserial_python
](/rosserial_python?distro=fuerte) | [ rosserial_xbee
](/rosserial_xbee?distro=fuerte) _
**Package Links**
  * [ Tutorials ](/rosserial/Tutorials)
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:rosserial/page:1/)
  * [ Change List ](/rosserial/ChangeList)
  * [ Reviews ](/rosserial/Reviews)
** Dependencies  (4) **
  * [ common_msgs ](/common_msgs?distro=fuerte)
  * [ geometry ](/geometry?distro=fuerte)
  * [ ros ](/ros?distro=fuerte)
  * [ ros_comm ](/ros_comm?distro=fuerte)
** Used by  (1) **
  * [ kingfisher ](/kingfisher?distro=fuerte)
#  Package Summary
Documented
ROS Serial is a point-to-point version of ROS communications over serial,
primarily for integrating low-cost microcontrollers (Arduino) into ROS. ROS
serial consists of a general p2p protocol, libraries for use with Arduino, and
nodes for the PC/Tablet side (currently in both Python and Java).
  * Author: Maintained by Michael Ferguson, Adam Stambler
  * License: BSD
  * Source: hg [ https://kforge.ros.org/rosserial/hg ](https://kforge.ros.org/rosserial/hg) (branch: default)
_**rosserial** : [ rosserial_client ](/rosserial_client?distro=groovy) | [
rosserial_msgs ](/rosserial_msgs?distro=groovy) | [ rosserial_python
](/rosserial_python?distro=groovy) _
**Package Links**
  * [ Tutorials ](/rosserial/Tutorials)
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:rosserial/page:1/)
  * [ Change List ](/rosserial/ChangeList)


The following table shows which direction the motor will turn based on the digital values of IN1 and IN2.


Project parts list


[ 2\. How to drive a DC motor without a motor driver module
](https://techexplorations.com/guides/arduino/motors/dc-motor-with-
transistor/)
[ 3\. What is "microstepping"?
](https://techexplorations.com/guides/arduino/motors/microstep-easydriver/)
[ 4\. Direct current motor
](https://techexplorations.com/guides/arduino/motors/direct-current-motor/)
[ 5\.  Project 1: Control two DC motors with your Arduino and the L298N
controller  ](https://techexplorations.com/guides/arduino/motors/dc-motor-
lm298n-arduino-project1/)
[ 6\. Project 2: Control speed and direction with a potentiometer
](https://techexplorations.com/guides/arduino/motors/dc-motor-speed-direction-
lm298n-arduino-project2/)
[ 7\. Project 3: DC motor control with a distance sensor
](https://techexplorations.com/guides/arduino/motors/project-3-dc-motor-
control-distance-sensor/)
[ 8\. Project 1: Control a servo motor with a potentiometer
](https://techexplorations.com/guides/arduino/motors/project-1-servo-motors-
control-arduino-potentiometer/)
[ 9\. Project 2: Servo motor control with VarSpeedServo
](https://techexplorations.com/guides/arduino/motors/project-2-arduino-servo-
control-varspeedservo/)


![Liz
Miller](https://secure.gravatar.com/avatar/c55e4e26e63766c66bcd3dfdf70e612a?s=128&d=robohash&r=g)


If you’re anything like me, then you enjoy [ building mobile robots
](https://www.learnrobotics.org/product/build-arduino-
robots/?utm_source=blog&utm_medium=motor_controllers_rpi_arduino) . As I’m
sure you’re aware, mobile robots are comprised of 5 parts: chassis, motors,
controllers, sensors, and power. To cover three of these groups, you’ll need
to properly wire the motors to the controllers (motor and master) and then add
your power supply.


4x analog or digital servo control, with precision 16-bit timers.
2 x bi-directional brushed DC motor control, 1 Amp current-limited each, with 8-bit PWM speed control (or one stepper).
4 x high-current “Darlington” 500mA drive outputs with kick-back diode protection. For solenoids, relays, large LEDs, or one uni-polar stepper.
4 x capacitive touch input sensors with alligator pads.
8 x signal pins, which can be used as digital in/out or analog inputs.
1 x NeoPixel driver with 5V level shifter – this is connected to the seesaw chip, not the Raspberry Pi, so you won’t be giving up pin 18. It can drive over 100 pixels.
1 x Class D, 4-8 ohm speaker, 3W-max audio amplifier – this is connected to the I2S pins on the Raspberry Pi for high-quality digital audio. Works on any Pi, even Zeros that don’t have an audio jack!
Built-in USB to serial converter. The USB port on the HAT can be used to update the seesaw firmware on the Crickit with the drag-n-drop bootloader, or you can plug into your computer; it will also act as a USB converter for logging into the console and running command lines on the Pi.
It uses a python library but since I2C is used, I could see easy integration with Node Red.


For easy navigation, you can click the links below to find the wiring diagram
on this page.


###  Arduino Nano L293D Wiring Diagram


###  L293D Raspberry Pi Wiring Diagram


###  [ The Best Computer for Robotics Engineering (2024 Guide)
](https://www.learnrobotics.org/blog/best-computer-for-robotics-engineering/)


Website


[ Click for Raspberry Pi Zero W pinouts ](https://i.stack.imgur.com/KBD5v.jpg)


[ April Scholarships ](https://www.learnrobotics.org/robotics-
certification/?utm_source=navbar&utm_medium=img&utm_campaign=scholarship)


The buffer sizes, and numbers of Publisher/Subscriber for [ rosserial_arduino
](/rosserial_arduino) now vary depending on the chip used:
**AVR Model**
|
**Input/Output buffer sizes**
|
**Publishers/Subscribers**

---|---|---

ATMEGA168
|
150/150 bytes
|
6/6

ATMEGA328P
|
280/280 bytes
|
25/25

All others
|
512/512 bytes
|
25/25

You can change these numbers and sizes, refer to tutorial [ NodeHandle and
ArduinoHardware
](/rosserial_arduino/Tutorials/NodeHandle%20and%20ArduinoHardware) for more
informaiton.

    typedef NodeHandle_<HardwareType, MAX_PUBLISHERS, MAX_SUBSCRIBERS, IN_BUFFER_SIZE, OUT_BUFFER_SIZE> NodeHandle;
You should, however, be careful not to consume too much of the limited SRAM
found in the Arduino. If the Arduino ran out of SRAM, it will simply hang with
no debug information.
Messages larger than the buffer size is not transmitted. A ROS error message
will be relayed telling whether the message was coming from, or going to, the


TotallyInformation
Regular
Jan 2019
Arduino may be the answer in the end. With firmata, I can control a servo with no additional motor shield. For robotics, Arduino gives you the option of running your 'firmware' program so Node Red just needs to send a message like 'go to x, y position'. Then Arduino handles the PID to accelerate and then decelerate to arrive at the desired position. Also, Arduino has no shortage of motor shields and controllers.


L298N ENA to GPIO18
L298N IN1 to GPIO4
L298N IN2 to GPIO17
L298N IN3 to GPIO27
L298N IN4 to GPIO22
L298N ENB to GPIO12


The L298N motor controller is a low cost and simple way to control two DC
motors at the same time. It works well with the Arduino, and once you learn
how to use it, you will be able to apply it on a wide range of DC motors.


Behind the Largest Family of Automotive Multi-Channel Temperature Sensors
by Arjun Nijhawan


  * [ Education  ](https://techexplorations.com/maker-education/)
  * [ Arduino  ](https://techexplorations.com/arduino/)
  * [ ESP32  ](https://techexplorations.com/esp32/)
  * [ Raspberry Pi  ](https://techexplorations.com/raspberrypi/)
  * [ KiCad  ](https://techexplorations.com/kicad/)
  * [ More Guides  ](https://techexplorations.com/oscilloscope/)
    * [ Node-RED  ](https://techexplorations.com/node-red/)
    * [ MicroPython  ](https://techexplorations.com/micropython/)
    * [ Blynk  ](https://techexplorations.com/blynk/)
    * [ Oscilloscopes  ](https://techexplorations.com/oscilloscope/)


**Disclosure:** Some of the links in this post are affiliate links. This means
that, at zero cost to you, Learn Robotics will earn an affiliate commission if
you click through the link and finalize a purchase. Learn Robotics is a
participant in the Amazon Services LLC Associates Program, an affiliate
advertising program designed to provide a way for websites to earn advertising
revenues by advertising and linking to Amazon.com.


More about us
CONNECT WITH US
Contact Us
Advertise
Write For Us
MORE FROM OUR NETWORK
SIGN UP
Enter your email address
Register
© EETech Media, LLC. All rights reserved
Privacy Policy
·
Terms of Service
·
User Agreement


/*setting pwm of the motor to 255
we can change the speed of rotaion
by chaning pwm input but we are only
using arduino so we are using higest
value to driver the motor  */


  * [ rosserial_client ](/rosserial_client?distro=jade)
  * [ rosserial_msgs ](/rosserial_msgs?distro=jade)
  * [ rosserial_python ](/rosserial_python?distro=jade)
#  Package Summary
Released
Continuous Integration
Documented
Metapackage for core of rosserial.
  * Maintainer status: maintained
  * Maintainer: Paul Bouchier <paul.bouchier AT gmail DOT com>, Mike Purvis <mpurvis AT clearpathrobotics DOT com>
  * Author: Michael Ferguson
  * License: BSD
  * Source: git [ https://github.com/ros-drivers/rosserial.git ](https://github.com/ros-drivers/rosserial) (branch: jade-devel)
_**rosserial** : [ rosserial_client ](/rosserial_client?distro=kinetic) | [
rosserial_msgs ](/rosserial_msgs?distro=kinetic) | [ rosserial_python
](/rosserial_python?distro=kinetic) _
**Package Links**
  * [ Tutorials ](/rosserial/Tutorials)
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:rosserial/page:1/)
  * [ Changelog ](http://docs.ros.org/en/kinetic/changelogs/rosserial/changelog.html)
  * [ Change List ](/rosserial/ChangeList)
  * [ Reviews ](/rosserial/Reviews)
** Dependencies  (4) **
  * [ catkin ](/catkin?distro=kinetic)
  * [ rosserial_client ](/rosserial_client?distro=kinetic)
  * [ rosserial_msgs ](/rosserial_msgs?distro=kinetic)
  * [ rosserial_python ](/rosserial_python?distro=kinetic)
#  Package Summary
Released
Continuous Integration
Documented
Metapackage for core of rosserial.
  * Maintainer status: maintained
  * Maintainer: Paul Bouchier <paul.bouchier AT gmail DOT com>, Mike Purvis <mpurvis AT clearpathrobotics DOT com>
  * Author: Michael Ferguson
  * License: BSD
  * Source: git [ https://github.com/ros-drivers/rosserial.git ](https://github.com/ros-drivers/rosserial) (branch: jade-devel)
_**rosserial** : [ rosserial_client ](/rosserial_client?distro=lunar) | [
rosserial_msgs ](/rosserial_msgs?distro=lunar) | [ rosserial_python
](/rosserial_python?distro=lunar) _


Well you could control motors direct from a Pi which will run Node-RED. To be honest though, I never try using the Pi GPIO, I've always found it much better to use an Arduino with custom code and a simple serial interface.


Batto
Jan 2019
Hi,
I just made a prototype for controlling a window blind with nodered.


  * [ Reviews ](/rosserial/Reviews)
** Dependencies  (4) **
  * [ catkin ](/catkin?distro=groovy)
  * [ rosserial_client ](/rosserial_client?distro=groovy)
  * [ rosserial_msgs ](/rosserial_msgs?distro=groovy)
  * [ rosserial_python ](/rosserial_python?distro=groovy)
#  Package Summary
Released
Continuous Integration
Documented
Metapackage for core of rosserial.
  * Maintainer status: developed
  * Maintainer: Michael Ferguson <mferguson AT willowgarage DOT com>
  * Author: Michael Ferguson
  * License: BSD
  * Source: git [ https://github.com/ros-drivers/rosserial.git ](https://github.com/ros-drivers/rosserial) (branch: groovy-devel)
_**rosserial** : [ rosserial_client ](/rosserial_client?distro=hydro) | [
rosserial_msgs ](/rosserial_msgs?distro=hydro) | [ rosserial_python
](/rosserial_python?distro=hydro) _
**Package Links**
  * [ Tutorials ](/rosserial/Tutorials)
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:rosserial/page:1/)
  * [ Changelog ](http://docs.ros.org/en/hydro/changelogs/rosserial/changelog.html)
  * [ Change List ](/rosserial/ChangeList)
  * [ Reviews ](/rosserial/Reviews)
** Dependencies  (4) **
  * [ catkin ](/catkin?distro=hydro)
  * [ rosserial_client ](/rosserial_client?distro=hydro)
  * [ rosserial_msgs ](/rosserial_msgs?distro=hydro)
  * [ rosserial_python ](/rosserial_python?distro=hydro)
** Used by  (2) **
  * [ elevator ](/elevator?distro=hydro)
  * [ wheeled_robin_guided... ](/wheeled_robin_guided_tour?distro=hydro)
#  Package Summary
Released
Continuous Integration
Documented
Metapackage for core of rosserial.
  * Maintainer status: maintained
  * Maintainer: Paul Bouchier <paul.bouchier AT gmail DOT com>, Mike Purvis <mpurvis AT clearpathrobotics DOT com>


![](https://techexplorations.com/wp-
content/uploads/2020/11/2020-11-20_10-00-34.png)


###  Arduino Nano L298N Wiring Diagram


device.
###  Float64
The Arduino does not support 64-bit float datatypes. The
serialization/deserialization code generated by make_library will
automatically convert 64-bit floats into 32-bit datatypes, however, it should
be noted that a loss of precision may occur!
###  Strings
To conserve precious AVR memory, strings are not stored inside a message
instance, instead an ` unsigned char * ` is stored. This has two impacts:
When publishing, you must assign store the string data elsewhere and set the
pointer:

       1 std_msgs::String str_msg;
       2 unsigned char hello[13] = "hello world!";
       3
       4 str_msg.data = hello;

When subscribing to a message containing a string datatype, the string itself
will not be copied from the deserialization buffer. Therefore, while it will
be valid during the callback function, it will disappear when any other
message is deserialized. If you need to keep the value of the string outside
the callback, you must manually copy the string elsewhere.
###  Arrays
Arrays have similar limitations to strings, however, since there is no easy
way to find the termination of an array (analogous to the \0 found at the end
of a string), we need to specify the size of the array. An extra variable is
added to the class definition to accomplish this. For instance, the
geometry_msgs/PoseArray is declared as:

    Header header
    geometry_msgs/Pose[] poses
On the Arduino, this will translate to a class:

       1 class PoseArray
       2 {
       3   Header header;
       4   int poses_length;


  * [ Tuition  ](https://www.learnrobotics.org/plans/?utm_source=footer&utm_medium=link&utm_campaign=tuition-plans)
  * [ Success Stories  ](https://www.learnrobotics.org/testimonials/?utm_source=footer&utm_medium=link&utm_campaign=success-stories)


[ 03/15/2024 at 5:32 PM  ](https://www.learnrobotics.org/blog/motor-
controller-raspberry-pi-arduino-configurations/#comment-864740)


Reply


####  Enrollment


This site uses Akismet to reduce spam. [ Learn how your comment data is
processed ](https://akismet.com/privacy/) .


Finally, pin "GND" is for ground, and should be connected to one of Arduino’s
GND pins so that both the Arduino and the module share the same ground voltage
level.


Sketch for project 1


Follow these instructions to make the connections and build your circuit.
Refer to the annotated photograph of the L298N module above for the pin names.


* __ [ Arduino ](https://www.learnrobotics.org/blog/tag/arduino/) , [ circuits ](https://www.learnrobotics.org/blog/tag/circuits/) , [ L293D ](https://www.learnrobotics.org/blog/tag/l293d/) , [ L298N ](https://www.learnrobotics.org/blog/tag/l298n/) , [ mobile robot ](https://www.learnrobotics.org/blog/tag/mobile-robot/) , [ Raspberry Pi ](https://www.learnrobotics.org/blog/tag/raspberry-pi/) , [ Wifi ](https://www.learnrobotics.org/blog/tag/wifi/)


10. ****Inspect the wiring and ensure they are correct.** **


3. Connect the **positive wire** from the battery pack to **pin +12V** on the module.


####  PODCASTS


[ ![](https://techexplorations.com/wp-
content/uploads/2020/11/2020-11-20_10-18-49-1024x572.png)
](https://techexplorations.com/wp-
content/uploads/2020/11/2020-11-20_10-18-49.png)


[ Share  0  ](javascript:void\(0\))


In this article, I’ve compiled the most popular or common configurations for
connecting Motor Controllers [ L298N ](https://amzn.to/2Go1VeE) ( [ Datasheet
](https://www.sparkfun.com/datasheets/Robotics/L298_H_Bridge.pdf) ) and [
L293D ](https://amzn.to/2Gonrjw) ( [ Datasheet
](https://www.arduino.cc/documents/datasheets/H-bridge_motor_driver.PDF) ) to
the Raspberry Pi and Arduino ( [ Uno ](https://amzn.to/2t4L4FP) , [ Nano
](https://amzn.to/2WKd7In) , [ NodeMCU ](https://amzn.to/2t7R8xm) ). I
compiled this guide to keep all the resources and wiring diagrams in one
place.


3. A [ motor controller module ](https://amzn.to/38ZPBQc) with the L298N chip.


IN1	IN2	MOTOR
0	0	BRAKE
1	0	FORWARD
0	1	BACKWARD
1	1	BRAKE
IN1 pin of the L298 IC is connected to pin 8 of the Arduino while IN2 is connected to pin 9. These two digital pins of Arduino  control the direction of the motor. The EN A pin of IC is connected to the PWM pin 2 of Arduino. This will control the speed of the motor.


7. Connect **Arduino pin 4** to **module pin In2.**


We have a full section (Section 16) with 10 lectures dedicated to this topic.


To enable the Arduino to safely control the motors, you will use the [ L298N
motor controller module ](https://amzn.to/38ZPBQc) .


One approach I'm playing around is having a python program running on a Pi to do the heavy lifting of controlling H-bridges, steppers etc and use MQTT to receive commands and publish sensor updates to Node-RED


  * [ Join our team  ](https://techexplorations.com/st/join-team/)
  * [ Become an affiliate  ](https://techexplorations.com/st/affiliates/)
  * [ Schools & Libraries  ](https://techexplorations.com/st/institutions/)
  * [ Course Assembly:
We’ll create your next course  ](https://courseassembly.com/)


The NodeMCU requires an additional [ Voltage Regulator
](https://amzn.to/2GqfsSQ) (L7805 – 5V 1.5A), an [ Electrolytic Capacitor
](https://amzn.to/2MR20c7) (1uF/50V), and a [ Ceramic Capacitor
](https://amzn.to/2MR20c7) (100nF – 0603). The signal pins between the NodeMCU
and L298N are given as follows:


Please log in before you can comment.
Log in to comment


![Motor Controller L293D NodeMCU diagram](/wp-
content/uploads/2019/02/NodeMCU-L293D.png)


6. Connect **Arduino pin 5** to **module pin In1** .


thanks,


  1. Connect the **first motor** to motor controller module **Out1** and **Out2** . The order does not matter.
  2. Connect the **first motor** to motor controller module **Out3** and **Out4** . The order does not matter.


Infineon Rolls Out Magnetic Position Sensor Using TMR Technology
by Aaron Carman


Every time that the block in this loop runs, we first set the direction of
spin for both motors by writing a HIGH value to pins M1 and M2 (Arduino pins 4
and 7 respectively), and then we set the spin by using the PWM function
**analogWrite** . The value we write to these pins is controlled by the “for”
loop.


void loop()
{
//For Clock wise motion , in_1 = High , in_2 = Low


You can power your Raspberry Pi using a 5V 2A battery pack.


Lastly, you can use the TB6612 with the Raspberry Pi if you want to use an
external DC Motor power source. Here’s how it’s wired:


If you would like to learn how to use DC motors with your Arduino, consider
enrolling to [ Arduino Step by Step Getting Serious
](https://app.techexplorations.com/courses/arduino-step-by-step-getting-
serious/) .


##  Arduino Motor Controller Wiring Diagrams


###  NodeMCU L293D Wiring Diagram


In this article you will learn how to control two [ 5V DC motors
](https://amzn.to/36LXrdm) with your Arduino.


[ Share  0  ](javascript:void\(0\))


![Motor Controller L298N NodeMCU diagram](/wp-
content/uploads/2019/02/NodeMCU-L298N.png)


[ ![](https://techexplorations.com/wp-
content/uploads/2016/03/BlackLogo20mm_500DPI_no_url.png)
](https://techexplorations.com/)


![](https://techexplorations.com/wp-
content/uploads/2020/11/2020-11-20_10-18-49.png)


If you really must control the motor direct from a Pi, you will need to take care as the Pi GPIO is unbuffered and it is pretty easy to blow the Pi. So take care how you wire things.


 Like. Reply
E
EdFone
October 31, 2015
Try this.


Improvements : hardware is not adapted : a shield with a A4988 driver would be more practical and compact. An absolute positionning system would be welcome for initialisation and cumulate user direct interaction and remote control (I think about a magnetic sensor).


You’ll power your Raspberry Pi using a 5V 2A battery pack.


©  2024  Tech Explorations


Comment  *


Hardware = esp32 board + stepper + TB6560
Software = simple MQTT messaging


Learn about Wi-Fi, BLE and radio, motors (servo, DC and stepper motors with
various controllers), LCD, OLED and TFT screens with buttons and touch
interfaces, control large loads like relays and lights, and much much MUCH
more.


  * [ Courses  ](https://techexplorations.com/pc)
  * [ Blog  ](https://techexplorations.com/blog/)
  * [ STEM  ](https://techexplorations.com/stem/)
  * [ Sign Up  ](https://app.techexplorations.com/register/)
  * [ Log In  ](https://app.techexplorations.com/wp-login.php)


[ ![best fpv drones article](https://www.learnrobotics.org/wp-
content/uploads/2023/11/drone-man-drone-pilot-3453361-300x195.jpg)
](https://www.learnrobotics.org/blog/best-fpv-drones/)


RELATED CONTENT
How to Defeat Heat with Peltier Devices
DC-DC Converter Testing with Precision Bench SMUs
Servo Control with Arduino Through MATLAB
Servo Motor Control with an Arduino
How to Use Relays to Control High-Voltage Circuits with an Arduino
How to Add More Value to Your Motor Control System
Learn More About:
ARDUINO
DC MOTORS
COMMENTS
25 Comments


**In2** and **In4** control the speed for each motor.


//For providing logic to L298 IC to choose the direction of the DC motor


If you’re not using Raspberry Pi, you can check out the Arduino Motor
Controller diagrams for your project. I’ve compiled drawings for Arduino [ Uno
](https://amzn.to/2t4L4FP) , [ Nano ](https://amzn.to/2WKd7In) , and [ NodeMCU
](https://amzn.to/2t7R8xm) .


Batto
Jan 2019
For flows it's nothing more than an MQTT Publish (I just input the value from an inject or Slider from UI-Dashboard). The ESP32 (programmed with Arduino) just get the value from MQTT and apply it.


  * [ Books and Courses  ](https://techexplorations.com/pc/)
  * [ For teachers  ](https://techexplorations.com/pc/teachers/)
  * [ For Makers  ](https://techexplorations.com/st/hobbyists/)
  * [ Course hardware lists  ](https://techexplorations.com/parts/course-list-of-parts/)
  * [ Raspberry Pi  ](https://techexplorations.com/pc/raspberry-pi/)
  * [ Arduino  ](https://techexplorations.com/pc/arduino/)
  * [ ESP32  ](https://techexplorations.com/pc/esp32/)
  * [ Node-Red  ](https://techexplorations.com/so/nodered/)
  * [ Micropython  ](https://techexplorations.com/so/micropython-with-the-esp32/)
  * [ Projects  ](https://techexplorations.com/pc/projects/)


You can also use an L293D with your NodeMCU. Here’s how to connect the signal
pins:


[ __ Apply Now  ](?utm_source=navbar&utm_medium=button&utm_campaign=apply-
now#quick-apply)


PRODUCTS
Latest
Analog
Connectors
Cooling
Digital IC’s
EDA Tools
Electromechanical
Embedded
IC Design
Memory
Optoelectronics
Passives
PCB’s
Power
RISC-V
Sensors
Test & Measurement
Wireless/RF
View All
APPLICATIONS
AI/Neural Networks
Audio
Automotive
Cloud Computing
Consumer Electronics
Cybersecurity / Identification
Digital Signal Processing
Industrial Automation
IOT
IT / Networking
Lighting
Medical & Fitness
Military / Aero / Space
Motor Control
Smart Grid / Energy
Telecom
View All
CONTENT
BOM Tool


void loop()
{
int value;
for(value = 0 ; value <= 255; value+=1)
{
digitalWrite(M1,HIGH);
digitalWrite(M2,HIGH);
analogWrite(E1, value); //PWM Speed Control
analogWrite(E2, value); //PWM Speed Control
delay(30);
}
}


Video


       5   Pose * poses;
       6 }

Therefore, to send an array message, we have to set the length and pointer.
When deserializing, we cannot deserialize in-place like the string (since the
bytes of the message are actually packed, unlike a string which is passed in
plain form). Therefore, the deserialization function will automatically
allocate enough storage using ` realloc() ` , attempting to reuse the memory
location whenever possible and only expanding it when the new message received
is larger than the largest previous message.
Some array types containing other array types will not deserialize correctly,
as all elements of the child type will point to the same memory. This
limitation may be addressed in the future.
##  Protocol
The [ rosserial ](/rosserial) protocol is aimed at point-to-point ROS
communications over a serial transmission line. We use the same
serialization/de-serialization as standard ROS messages, simply adding a
packet header and tail which allows multiple topics to share a common serial
link. This page describes the low-level details of the packet header and tail,
and several special topics used for synchronization.
###  Packet Format

      1st Byte - Sync Flag (Value: 0xff)
      2nd Byte - Sync Flag / Protocol version
      3rd Byte - Message Length (N) - Low Byte
      4th Byte - Message Length (N) - High Byte
      5th Byte - Checksum over message length
      6th Byte - Topic ID - Low Byte
      7th Byte - Topic ID - High Byte
      x Bytes  - Serialized Message Data
      Byte x+1 - Checksum over Topic ID and Message Data
The Protocol version byte was ` 0xff ` on ROS Groovy, ` 0xfe ` on ROS Hydro,
Indigo, and Jade.
Topics ID 0-100 are reserved for system functions, as defined in the [
rosserial_msgs/TopicInfo
](http://docs.ros.org/en/api/rosserial_msgs/html/msg/TopicInfo.html) message.
The checksums on the length and data are used to make sure that a particular
packet has not been corrupted.
The checksum over the message length is computed as follows:


Then, let me know what you think of this post in the comments section below.
And, if you have a suggestion or correction for any of these wiring diagrams,
be sure to include that in your comment as well.


Arduino may be the answer in the end. With firmata, I can control a servo with no additional motor shield. For robotics, Arduino gives you the option of running your 'firmware' program so Node Red just needs to send a message like 'go to x, y position'. Then Arduino handles the PID to accelerate and then decelerate to arrive at the desired position. Also, Arduino has no shortage of motor shields and controllers.


digitalWrite(in_1,HIGH) ;
digitalWrite(in_2,LOW) ;
analogWrite(pwm,255) ;


👇 Click below to claim this deal.


##  Learn more


Node-RED
home

about

blog

documentation

forum

flows

github
Skip to main content
Node-RED Forum


2. ![](https://secure.gravatar.com/avatar/094ba88a125fcace27b3a1d0a274bc03?s=42&d=robohash&r=g) **Bert Hector** says:


Then, attach the motor leads to the L293D, followed by the power between
Arduino, motor controller, and battery pack.


Start by unplugging the Arduino from your computer so that it is not in
operation.


Reply


Therefore, it is convenient to use a module that contains the L298N and all of
the required components on a single board, like as the one in this image
below.


1. ![](https://secure.gravatar.com/avatar/c55e4e26e63766c66bcd3dfdf70e612a?s=42&d=robohash&r=g) **Liz Miller** says:


The L293D is wired similarly. You’ll need to [ use a breadboard
](https://www.learnrobotics.org/blog/how-to-wire-a-breadboard/) to wire up the
L293D. Here are the signal pins between the controllers.


The DC motor controller module


Exclusive Limited Offer for Serious Beginners Ready to take their Hobby to
Engineering Internships, $100k+ Careers, and Beyond!


To set the values of Arduino pins 8 and 9, we will use the digitalWrite() function, and to set the value of pin 2, we will use the using analogWrite() function.


[ Tweet  0  ](javascript:void\(0\))


![Motor Controller L293D Raspberry Pi diagram](/wp-
content/uploads/2019/02/Raspberry-Pi-L293D.png)


As we are using DC motors, the higher the voltage differential between the
pins in those pairs, the faster the motors will spin. If you want to reverse
the motors, you must change the polarity of these pins. This is something that
the L298N will do for you with the appropriate signal in the input pins.


Give this project a try for yourself! Get the BOM.


[ Jki-facebook-light  __ ](https://facebook.com/learnrobotics) [ Twitter  __
](https://twitter.com/learnroboticsx) [ Instagram  __
](https://instagram.com/learnrobotics) [ Youtube  __
](https://youtube.com/learnrobotics)


  * [ devel ubuntu bionic amd64 ](https://build.ros.org/view/Mdev/job/Mdev__rosserial__ubuntu_bionic_amd64)
  * [ doc ](https://build.ros.org/view/Mdoc/job/Mdoc__rosserial__ubuntu_bionic_amd64)
#  Package Summary
Released
Continuous Integration:  12 / 12
  * Build history (last 5 of 21 builds):
  * [ #21  21-Aug-2020 21:11  12 / 12  ](http://build.ros.org//job/Mdev__rosserial__ubuntu_bionic_amd64/21/)
  * [ #20  17-Apr-2020 17:11  12 / 12  ](http://build.ros.org//job/Mdev__rosserial__ubuntu_bionic_amd64/20/)
  * [ #19  16-Apr-2020 20:11  12 / 12  ](http://build.ros.org//job/Mdev__rosserial__ubuntu_bionic_amd64/19/)
  * [ #18  15-Apr-2020 15:11  12 / 12  ](http://build.ros.org//job/Mdev__rosserial__ubuntu_bionic_amd64/18/)
  * [ #17  15-Apr-2020 02:11  12 / 12  ](http://build.ros.org//job/Mdev__rosserial__ubuntu_bionic_amd64/17/)
Documented
Metapackage for core of rosserial.
  * Maintainer status: maintained
  * Maintainer: Paul Bouchier <paul.bouchier AT gmail DOT com>, Mike Purvis <mpurvis AT clearpathrobotics DOT com>
  * Author: Michael Ferguson
  * License: BSD
  * Source: git [ https://github.com/ros-drivers/rosserial.git ](https://github.com/ros-drivers/rosserial) (branch: melodic-devel)
_**rosserial** : [ rosserial_client ](/rosserial_client?distro=noetic) | [
rosserial_msgs ](/rosserial_msgs?distro=noetic) | [ rosserial_python
](/rosserial_python?distro=noetic) _
**Package Links**
  * [ Tutorials ](/rosserial/Tutorials)
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:rosserial/page:1/)
  * [ Changelog ](http://docs.ros.org/en/noetic/changelogs/rosserial/changelog.html)
  * [ Change List ](/rosserial/ChangeList)
  * [ Reviews ](/rosserial/Reviews)
** Dependencies  (4) **
  * [ catkin ](/catkin?distro=noetic)
  * [ rosserial_client ](/rosserial_client?distro=noetic)
  * [ rosserial_msgs ](/rosserial_msgs?distro=noetic)
  * [ rosserial_python ](/rosserial_python?distro=noetic)
** Jenkins jobs  (10) **
  * [ source debian buster ](https://build.ros.org/view/Nsrc_dB/job/Nsrc_dB__rosserial__debian_buster__source)
  * [ source ubuntu focal ](https://build.ros.org/view/Nsrc_uF/job/Nsrc_uF__rosserial__ubuntu_focal__source)
  * [ binary debian buster amd64 ](https://build.ros.org/view/Nbin_db_dB64/job/Nbin_db_dB64__rosserial__debian_buster_amd64__binary)
  * [ binary debian buster arm64 ](https://build.ros.org/view/Nbin_dbv8_dBv8/job/Nbin_dbv8_dBv8__rosserial__debian_buster_arm64__binary)
  * [ binary ubuntu focal amd64 ](https://build.ros.org/view/Nbin_uF64/job/Nbin_uF64__rosserial__ubuntu_focal_amd64__binary)
  * [ binary ubuntu focal armhf ](https://build.ros.org/view/Nbin_ufhf_uFhf/job/Nbin_ufhf_uFhf__rosserial__ubuntu_focal_armhf__binary)
  * [ binary ubuntu focal arm64 ](https://build.ros.org/view/Nbin_ufv8_uFv8/job/Nbin_ufv8_uFv8__rosserial__ubuntu_focal_arm64__binary)


  * [ Stemiverse  ](https://techexplorations.com/st/stemiverse/)
  * [ Tech Explorations Podcast  ](https://techexplorations.com/st/tech-explorations-podcast/)
  * [ Subscribe on iTunes  ](https://itunes.apple.com/au/podcast/stemiverse-podcast/id1231898439?mt=2)


#  Project 1: Control two DC motors with your Arduino and the L298N controller


Related Topics
Topic	Replies	Views	Activity
Servo’s on Node-Red
General
8	6.3k	Mar 2019
Communication with the Arduino Robot
General
8	1.1k	Jan 2019
Node-RED controlling Robot via MQTT
Share Your Projects
16	5.9k	Apr 2019
Website Source for node-red and arduino
General
3	427	Jul 2018
[Industrial Automation] How to code better? plz give me some advice
Industrial
4	328	Sep 2023


Circuit assembly process


Bert


![NodeMCU Motor Controller Mobile Robot](/wp-content/uploads/2019/02/mobile-
robot.png)


Reply


  * [ Help & Contact Us  ](https://connect.techexplorations.com/create-a-support-ticket)
  * [ About Us  ](https://techexplorations.com/st/aboutus)
  * [ Community  ](https://community.techexplorations.com/)
  * [ FAQ  ](https://techexplorations.com/st/faq)
  * [ Website status  ](https://status.techexplorations.com/)
  * [ Get our Free PDF guides  ](https://connect.techexplorations.com/?ff_landing=11)
  * [ Course enrollment tiers  ](https://techexplorations.com/st/course-enrollment-tiers/)
  * [ Udemy and Tech Explorations  ](https://techexplorations.com/st/udemy-vs-tech-explorations/)
  * [ Buy on Udemy  ](https://techexplorations.com/st/purchase-courses-on-udemy)
  * [ Log In  ](https://app.techexplorations.com/login/)


L298N ENA to D2
L298N IN1 to D1
L298N IN2 to D3
L298N IN3 to D4
L298N IN4 to D6
L298N ENB to D5


[ **Join Tech Explorations**
](https://connect.techexplorations.com/?ff_landing=11)


[ **Make a Career Move!** Launch or Elevate Your Tech Career with Robotics!
_Apply Now_ → ](https://www.learnrobotics.org/robotics-
certification/?utm_source=navbar&utm_medium=banner&utm_campaign=scholarship)


![Motor Controller L293D Arduino Nano diagram](/wp-
content/uploads/2019/02/Nano-L293D.png)


###  Arduino Uno L298N Wiring Diagram


Learn more


Even though you could connect a small DC motor directly to the Arduino, it is
not a good idea.


For this application, you’ll connect the L298N signal pins as follows:


Ya, when you get a chance, I would love to see pictures and flows.
On your esp32 board, did you just use Arduino IDE to program it?


  * [ Terms of Service  ](https://www.learnrobotics.org/terms-of-service/?utm_source=footer&utm_medium=link&utm_campaign=terms-of-service)
  * [ Privacy Policy  ](https://www.learnrobotics.org/privacy-policy/?utm_source=footer&utm_medium=link&utm_campaign=privacy-policy)


L298 Pinout (top view)


###  L298N Raspberry Pi Wiring Diagram


Create a smaller Arduino Robot using the Arduino Nano and L298N motor
controller. Connect the signal pins as follows:


##  Have you built any of these configurations?


[ 1\. Unipolar vs bipolar stepper motors
](https://techexplorations.com/guides/arduino/motors/unipolar-vs-bipolar-
stepper-motors/)


![Liz
Miller](https://secure.gravatar.com/avatar/c55e4e26e63766c66bcd3dfdf70e612a?s=128&d=robohash&r=g)


Code
const int pwm = 2 ;	//initializing pin 2 as pwm
const int in_1 = 8 ;
const int in_2 = 9 ;


[ ](javascript:void\(0\))


//Clockwise for 3 secs
delay(3000) ;


The L298N is a pretty common controller used with the Arduino Uno. Connect the
signal pins as follows:


**Out3** and **Out4** control motor 2.


Lastly, you’ll want to verify your wiring and keep the controller powered off
while downloading code. It’s good practice to add in a power switch off the
battery pack to make wiring easier. The cool thing about these configurations,
is once you have tried a few of them, you can make a mobile robot out of just
about anything! Some projects include [ Tiny Robot Cars ](/tiny-robot-car) , [
Robotic Tanks, ](https://amzn.to/2DTH0OL) Robot Cars, and more.


5. A bunch of [ jumper wires ](https://amzn.to/36TZFHt) .


  * [ Robotics Mentorship  ](https://www.learnrobotics.org/robotics-career/?utm_source=footer&utm_medium=link&utm_campaign=robotics-mentorship)
  * [ Robotics Certification  ](https://www.learnrobotics.org/robotics-certification/?utm_source=footer&utm_medium=link&utm_campaign=robotics-certification)


Search


[ 01/24/2022 at 10:19 AM  ](https://www.learnrobotics.org/blog/motor-
controller-raspberry-pi-arduino-configurations/#comment-848440)


##  Project parts list


This course is packed with high-quality video, mini-projects, and everything
you need to learn Arduino from the ground up. We'll help you get started and
at every step with top-notch instruction and our super-helpful course
discussion space.


In virtually all real-life applications, you should provide external power to
the motor.


You can use discrete transistors to make this circuit, but for this tutorial, we will be using the L298 H-Bridge IC. The L298 can control the speed and direction of DC motors and stepper motors and can control two motors simultaneously. Its current rating is 2A for each motor. At these currents, however, you will need to use heat sinks.


**Out1** and **Out2** control the speed and direction of motor 1. ****


**Enroll now, and earn your first robotics certificate in the next 7 days.**


  * __
  * __
  * __
  * __
  * __


  1. Two [ 5V DC motors ](https://amzn.to/36LXrdm) .
  2. An [ Arduino Uno ](https://amzn.to/2IVeNfZ) .


[ ![five arduino kits worth buying arduino and
breadboard](https://www.learnrobotics.org/wp-content/uploads/2017/05/arduino-
and-breadboard-300x200.jpeg) ](https://www.learnrobotics.org/blog/best-
arduino-robot-kits/)


![](https://techexplorations.com/wp-
content/uploads/2020/11/2020-11-20_10-00-34.png)


Hardware Required
1 x L298 bridge IC
1 x DC motor
1 x Arduino Mega2560
1 x breadboard
10 x jumper wires


Like these articles? Support the work we do by [ enrolling in an online course
](https://www.learnrobotics.org/courses?utm_source=blog&utm_medium=motor_controllers_rpi_arduino)
or [ signing up for a monthly membership
](https://www.learnrobotics.org/membership?utm_source=blog&utm_medium=motor_controllers_rpi_arduino)
. Our site is 100% powered on our growing community, so thank you for your
continued support!


[ ](javascript:void\(0\))


 Like. Reply
M
mertcapanoglu
August 27, 2015
This article doesn’t say anything about the Vs(supply voltage) of the IC, just the logic supply. I’m guessing using a high power dc motor would fry the usb and possibly the motherboard of the computer.


It’s easy to [ wire up a motor controller
](https://www.learnrobotics.org/blog/how-to-program-the-l298n-with-arduino/) ,
but it can be challenging to [ power it for mobile applications
](https://www.learnrobotics.org/blog/how-to-power-your-arduino-mobile-robot/)
. These examples show wiring diagrams for a pair of [ 3-6V DC motors
](https://amzn.to/2GqlQth) powered by a 7.4V battery pack ( [ 2X 18650
batteries ](https://amzn.to/2u6gf3T) ). Pick your controllers from the list,
and use the wiring diagrams to complete your project. For convenience, you can
also bookmark this page, and visit it the next time you’re building a mobile
robot.


Also, don't forget that you could go to an ESP8266/ESP32 based solution instead and then have wireless control. You can still program it using Arduino IDE if you like though there are one or two alternatives as well. Even a JavaScript version, LUA or Python.


To control the direction of the spin of DC motor, without changing the way that the leads are connected, you can use a circuit called an H-Bridge. An H bridge is an electronic circuit that can drive the motor in both directions. H-bridges are used in many different applications, one of the most common being to control motors in robots. It is called an H-bridge because it uses four transistors connected in such a way that the schematic diagram looks like an "H."


###  Done with the basics? Looking for more advanced topics?


L293D Enable 1 to GPIO18
L293D IN1 to GPIO4
L293D IN2 to GPIO17
L293D IN3 to GPIO27
L293D IN4 to GPIO22
L293D Enable 2 to GPIO12


[ Free e __ __ Books ](https://connect.techexplorations.com/?ff_landing=11)


Calculators
Datasheets
Giveaways
Industry Articles
Industry Tech Days
Virtual Workshops
Industry Webinars
IC Design Center
New Products
News
Part Search
Podcast
Projects
Tech Chats
Partner Content Hub
Technical Articles
Test Equipment
Textbook
Video Lectures
Worksheets
WHO WE ARE


[ Learn more  ](https://techexplorations.com/so/asbsgsr1/)


8. **** Connect **Arduino pin 3** to **module pin In3.**


The schematic above shows how to connect the L298 IC to control two motors. There are three input pins for each motor, including Input1 (IN1), Input2 (IN2), and Enable1 (EN1) for Motor1 and Input3, Input4, and Enable2 for Motor2.


2
Jan 2019
This just showed up in my email.
Adafruit just came out with a very cool robotics hat for the Pi:
Crickit HAT 72
It is very cool!


WillWelker


Download PDF
PROJECT
How To Control a DC Motor with an Arduino
July 07, 2018 by Tim Youngblood
By connecting an L298 bridge IC to an Arduino, you can control a DC motor.
By connecting an L298 bridge IC to an Arduino, you can control a DC motor.


Semidynamics Provides All-In-One AI IP to Facilitate AI Chip Design
by Jake Hertz


Browse this article


###  Adafruit TB6612 with Raspberry Pi


The pinouts for the L298 are shown below. You can find a datasheet the L298 at http://www.tech.dmu.ac.uk/~mgongora/Resources/L298N.pdf.


![](https://techexplorations.com/wp-
content/uploads/2020/11/2020-11-20_10-18-49.png)


Motors guide series


##  The DC motor controller module


support for STM32 MCUs, based on STM32CubeMX HAL

[ ros-teensy ](https://github.com/mcgill-robotics/ros-teensy)
|
support for teensy platforms

Refer to [ Adding Support for New Hardware
](/rosserial_client/Tutorials/Adding%20Support%20for%20New%20Hardware) for
details on how to add a new hardware platform.
###  ROS-side Interfaces
Devices running ` rosserial ` code require a node on the host machine to
bridge the connection from the serial protocol to the more general ROS
network:
[ rosserial_python ](/rosserial_python)
|
A Python-based implementation (recommended for PC usage).

---|---

[ rosserial_server ](/rosserial_server)
|
A C++ implementation based on [ the ShapeShifter message
](http://docs.ros.org/api/topic_tools/html/classtopic__tools_1_1ShapeShifter.html)
, some limitations compared to rosserial_python but recommended for high-
performance applications.

###  Examples and Use Cases
We have created a number of extensions and examples:
  * [ rosserial_arduino Tutorials ](/rosserial_arduino/Tutorials) \- contains a number of examples of using various sensors and actuators with Arduino. This is the most well documented tutorial, and many of the feature depicted there can be extended into other platforms.
  * [ rosserial_xbee ](/rosserial_xbee) \- tools for creating sensor networks using XBEE devices and Arduino.
  * [ rosserial_embeddedlinux Tutorials ](/rosserial_embeddedlinux/Tutorials) contains a number of examples of various sensors and actuators with an embedded linux system which cannot run full-blown ROS.
  * [ rosserial_mbed Tutorials ](/rosserial_mbed/Tutorials) \- contains a number of examples of using various sensors and actuators with and Mbed platform.
  * [ rosserial_tivac Tutorials ](/rosserial_tivac/Tutorials) \- Various examples for programming TI's TivaC Launchpad with Energia IDE or catkinized projects.
##  Limitations
###  Maximum Size of a Message, Maximum Number of Publishers/Subscribers
The number of Publishers and Subscribers are limited at 25, and the size of
serialization and deserialization buffers are limited at 512 bytes by default
for [ rosserial_client ](/rosserial_client) .
However, those numbers and sizes are too big for microcontroller with limited
[ SRAM ](https://learn.adafruit.com/memories-of-an-arduino?view=all#sram) .


A direct current, or DC, motor is the most common type of motor. DC motors normally have just two leads, one positive and one negative. If you connect these two leads directly to a battery, the motor will rotate. If you switch the leads, the motor will rotate in the opposite direction.


[ ![](https://techexplorations.com/wp-
content/uploads/2020/11/2020-11-20_10-00-34.png)
](https://techexplorations.com/wp-
content/uploads/2020/11/2020-11-20_10-00-34.png)


The Arduino can only provide a very small amount of current to external
devices. Only the tiniest of motors would be satisfied with that.


####  WORK WITH US


#  Motor Controller Raspberry Pi & Arduino Configurations


Below is a photo of the set up.


[ Website Terms & Conditions
](https://techexplorations.com/l/termsconditions/) | [ Privacy and cookies
policy ](https://techexplorations.com/l/privacy-policy-english/) [ | Copyright
Notice ](https://techexplorations.com/l/copyright/) [ | Affiliate partners
terms and conditions ](https://techexplorations.com/l/affilate-terms-
conditions/) [ | Disclaimer ](https://techexplorations.com/l/disclaimer/) [ |
Refunds policy ](https://techexplorations.com/l/refunds/)


//For brake
digitalWrite(in_1,HIGH) ;
digitalWrite(in_2,HIGH) ;
delay(1000) ;


I will be using two geared DC motors from a toy tank that I stole from my kids
(they originally stole it from me).


[ ](javascript:void\(0\))


If you’d rather use Arduino, you can check out this set of common Arduino
Motor Controller wiring diagrams. To learn how to build a mobile robot using
Arduino, [ check out this popular tutorial
](https://www.learnrobotics.org/blog/how-to-build-a-mobile-robot-using-
arduino-part-1/) . You can also opt into our [ Robotics eCourse
](https://www.learnrobotics.org/product/build-arduino-
robots/?utm_source=blog&utm_medium=motor_controllers_rpi_arduino) to learn
more about mobile robots, programming, electronics, and compete in autonomous
challenges. [ Enroll in the course here.
](https://www.learnrobotics.org/product/build-arduino-
robots/?utm_source=blog&utm_medium=motor_controllers_rpi_arduino)


pololu.com


###  Related Articles


##  Circuit assembly process


Clint Zang
June 27, 2015
OK. Understandable, however I want to beef it up to control a treadmill motor. Anybody done that with success? I’d like to know how.


###  Table of Contents


In the **loop()** function, we have a “for” loop that cycles from 0 to 255, so
it covers all the possible PWM values that can be written to pins E1 and E2
(Arduino pins 5 and 6 respectively).


L293D Enable 1 to 3
L293D IN1 to 2
L293D IN2 to 4
L293D IN3 to 6
L293D IN4 to 7
L293D Enable 2 to 5


[ ![Best Computer for Robotics Engineering](https://www.learnrobotics.org/wp-
content/uploads/2018/08/Best-Computer-for-Robotics-thumbnail-300x169.png)
](https://www.learnrobotics.org/blog/best-computer-for-robotics-engineering/)


Save my name, email, and website in this browser for the next time I comment.


Can you help me?


WillWelker
Jan 2019
TB6560


##  Report a Bug
Report bugs, ask questions in the issues list on [ github/rosserial
](https://github.com/ros-drivers/rosserial)
Wiki: rosserial (last edited 2018-10-01 21:17:03 by  [ RomainReignier
](/RomainReignier "RomainReignier @ 79.58.7.93.rev.sfr.net\[93.7.58.79\]") )
Except where otherwise noted, the ROS wiki is licensed under the
[ Creative Commons Attribution 3.0
](http://creativecommons.org/licenses/by/3.0/)
* * *
[ ![](/custom/images/brought_by_horiz.png) ](https://www.openrobotics.org/)


Future Electronics at Embedded World 2024
In Partnership with Future Electronics


We publish fresh content each week. Read how-to's on Arduino, ESP32, KiCad,
Node-RED, drones and more. Listen to interviews. Learn about new tech with our
comprehensive reviews. Get discount offers for our courses and books. Interact
with our community. One email per week, no spam; unsubscribe at any time


![](https://techexplorations.com/wp-
content/uploads/2020/11/2020-11-20_10-18-49.png)


Next, attach the motor leads to the side pins on the L298N. Then, wire up the
power and ground leads to the breadboard. Be sure to connect power & ground
for the nano, motor controller, and battery pack.


![Motor ControlleL298N Arduino Nano diagram](/wp-
content/uploads/2019/02/Nano-L298N.png)


L298N ENA to Digital 5
L298N IN1 to Digital 2
L298N IN2 to Digital 3
L298N IN3 to Digital 4
L298N IN4 to Digital 7
L298N ENB to Digital 6


//For Anti Clock-wise motion - IN_1 = LOW , IN_2 = HIGH
digitalWrite(in_1,LOW) ;
digitalWrite(in_2,HIGH) ;
delay(3000) ;


[ ![Learn Robotics Logo](https://www.learnrobotics.org/wp-
content/uploads/2021/10/LR-Box-4x1-1.png)
](https://www.learnrobotics.org/?utm_source=learnrobotics&utm_medium=navbar&utm_campaign=logo)


This post is really useful, this is the configuration I am using with my
PiWars entry for this year, but I am using two L293Ds one for each motor
because of the current requirements.


L293D Enable 1 to D2
L293D IN1 to D1
L293D IN2 to D3
L293D IN3 to D4
L293D IN4 to D6
L293D Enable 2 to D5


![Motor Controller Raspberry Pi diagram](/wp-content/uploads/2019/02/Pi-Motor-
Controller-Adafruit.png)


###  Wait,


9. Connect ****Arduino pin 2** ** to  ****module pin In4.** **


Skip to content


[ ![Learn Robotics Logo](https://www.learnrobotics.org/wp-
content/uploads/2021/10/LR-Box-4x1-1.png) ](https://www.learnrobotics.org)


AFAIK, there are no javascript nodes to directly control the H-bridges motor controllers on the Pi


I hope you find this article useful for your next mobile robot project! Tag us
in your robotics projects on [ Facebook ](https://facebook.com/learnrobotics)
and [ Instagram ](https://instagram.com/learnrobotics) !


WillWelker
Jan 2019
I think Node Red has broad applications in robotics and I was wondering if anyone can recommend some good motor shields that play nice with Node Red. Currently I am using Arduino over serial which works but it would be nice to have a more direct solution to control servos, steppers and motors.


  * Author: Michael Ferguson
  * License: BSD
  * Source: git [ https://github.com/ros-drivers/rosserial.git ](https://github.com/ros-drivers/rosserial) (branch: hydro-devel)
_**rosserial** : [ rosserial_client ](/rosserial_client?distro=indigo) | [
rosserial_msgs ](/rosserial_msgs?distro=indigo) | [ rosserial_python
](/rosserial_python?distro=indigo) _
**Package Links**
  * [ Tutorials ](/rosserial/Tutorials)
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:rosserial/page:1/)
  * [ Changelog ](http://docs.ros.org/en/indigo/changelogs/rosserial/changelog.html)
  * [ Change List ](/rosserial/ChangeList)
  * [ Reviews ](/rosserial/Reviews)
** Dependencies  (4) **
  * [ catkin ](/catkin?distro=indigo)
  * [ rosserial_client ](/rosserial_client?distro=indigo)
  * [ rosserial_msgs ](/rosserial_msgs?distro=indigo)
  * [ rosserial_python ](/rosserial_python?distro=indigo)
** Used by  (1) **
  * [ forte_rc_driver ](/forte_rc_driver?distro=indigo)
#  Package Summary
Released
Continuous Integration
Documented
Metapackage for core of rosserial.
  * Maintainer status: maintained
  * Maintainer: Paul Bouchier <paul.bouchier AT gmail DOT com>, Mike Purvis <mpurvis AT clearpathrobotics DOT com>
  * Author: Michael Ferguson
  * License: BSD
  * Source: git [ https://github.com/ros-drivers/rosserial.git ](https://github.com/ros-drivers/rosserial) (branch: indigo-devel)
_**rosserial** : [ rosserial_client ](/rosserial_client?distro=jade) | [
rosserial_msgs ](/rosserial_msgs?distro=jade) | [ rosserial_python
](/rosserial_python?distro=jade) _
**Package Links**
  * [ Tutorials ](/rosserial/Tutorials)
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:rosserial/page:1/)
  * [ Changelog ](http://docs.ros.org/en/jade/changelogs/rosserial/changelog.html)
  * [ Change List ](/rosserial/ChangeList)
  * [ Reviews ](/rosserial/Reviews)
** Dependencies  (4) **
  * [ catkin ](/catkin?distro=jade)


0:00 / 0:00
PODCAST
LATEST
SUBSCRIBE
ARTICLES
FORUMS
EDUCATION
TOOLS
VIDEOS
DATASHEETS
GIVEAWAYS
PARTNER CONTENT HUB
All About Circuits
PROJECT
How To Control a DC Motor with an Arduino
25
 Home
Projects
How To Control a DC Motor with an Arduino
FEATURED RESOURCE
WHITE PAPERS
Advanced Industrial Motor Control for Increased Power Efficiency
Optimized design of industrial motor control systems using IPM and PIMs has a direct impact on power efficiency. This white paper from onsemi will help you tackle the challenges of boosting efficiency in industrial motor control system designs.


void setup()
{
pinMode(pwm,OUTPUT) ;  	//we have to set PWM pin as output
pinMode(in_1,OUTPUT) ; 	//Logic pins are also set as output
pinMode(in_2,OUTPUT) ;
}


![Motor ControlleL298N Arduino Uno diagram](/wp-
content/uploads/2019/02/Arduino-Uno-L298N.png)


 Like. Reply
Load more comments
YOU MAY ALSO LIKE


**In1** and **In3** control the direction of spin for motor 1 and motor 2
respectively.


Sign Up
Log In

Motor Shields and Node Red
General
Jan 2019
Jan 2019


  * [ Learner Log In  ](https://www.learnrobotics.org/sign-in/?utm_source=footer&utm_medium=link&utm_campaign=log-in)
  * [ Buy Your Lab Kit  ](https://www.learnrobotics.org/kits/?utm_source=footer&utm_medium=link&utm_campaign=robotics-kit)


//For brake
digitalWrite(in_1,HIGH) ;
digitalWrite(in_2,HIGH) ;
delay(1000) ;
 }


####  PRODUCTS


Hallo,
I are a new builder fot this projrct.
My project is a crane.
I use 3 dc motors and one switch on/off.
I have 1 RPI 3b en 2 motormodules L298N.
Control smartphone android app with wifi .


  * [ Careers  ](https://www.learnrobotics.org/careers/?utm_source=footer&utm_medium=link&utm_campaign=careers)
  * [ Disclaimer  ](https://www.learnrobotics.org/disclaimer/?utm_source=footer&utm_medium=link&utm_campaign=disclaimer)


Pololu Dual MC33926 Motor Driver for Raspberry Pi (Partial Kit) 43
This add-on board enables a compatible Raspberry Pi (Model B+ or newer), including the Pi 3 Model B+ and Model A+, to drive a pair of brushed DC motors. Its dual MC33926 motor drivers operate from 5 V to 28 V and can deliver a continuous 3 A (5 A...


Once you connect this circuit and run the loop, you will have your motors
starting from zero speed, speeding up gradually until they reach their maximum
rotational speed, before they suddenly stop to a halt and then repeating the
same processes again, until power is switched off.


void setup()
{
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
}


Pin "+12V" receives power from an external power source. In this experiment,
the safest option is to use an AA battery pack. If you use alkaline batteries,
you will have 4 x 1.5V = 6V. This is sufficient to drive our two motors.


[
![Image](https://imagedelivery.net/EzErua5FfjxwIvZXiki_dA/c4c23b77-9759-490a-e0fc-90b91d129a00/public)
](https://techexplorations.com/partners/)


L298N ENA to Digital 3
L298N IN1 to Digital 2
L298N IN2 to Digital 4
L298N IN3 to Digital 6
L298N IN4 to Digital 7
L298N ENB to Digital 5


5. Connect the **GND pin** of the module to the **GND pin** of the Arduino.


![Motor Controller L298N Raspberry Pi diagram](/wp-
content/uploads/2019/02/Raspberry-Pi-L298N.png)


###  NodeMCU L298N Wiring Diagram


1. ![](https://secure.gravatar.com/avatar/276c7b308fab804e5599653cbef80502?s=42&d=robohash&r=g) **[ Philip McGaw ](https://philipmcgaw.com/projects/piwars-robot/) ** says:


Here’s the sketch for Demo 1:


As a reminder, the Raspberry Pi uses both **Broadcom and Physical pin**
numbers for the GPIO pins. Broadcom pins are the GPIOXX reference and Physical
Pins are the numbers corresponding to each pin’s physical location on the
header. We will reference the Broadcom GPIOXX pins in the wiring diagrams
below. So with that said, here’s a collection of popular Motor Controller
Raspberry Pi wiring diagrams.


https://nodered.org/docs/hardware/arduino 159


To do this, I am going to use a popular motor driver module that contains the
[ L298N ](https://www.st.com/resource/en/datasheet/l298.pdf) motor driver
“bridge”. This integrated circuit (IC) can provide enough current to our
motors, so we can use them in power-hungry applications. The L298N IC can't be
used on its own. It requires several other components to operate properly,
such as capacitors and diodes, a [ heatk sink
](https://en.wikipedia.org/wiki/Heat_sink) etc.


##  Leave a Reply  [ Cancel reply ](/blog/motor-controller-raspberry-pi-
arduino-configurations/#respond)


  * __
  * __
  * __


To change the direction of rotation, just change the value you write to either
M1 or M2 pins to LOW, and upload the sketch. You will see the corresponding
motor shaft moving the opposite way compared to the original sketch.


###  New to the Arduino?


[ ![](https://techexplorations.com/wp-
content/uploads/2020/01/DSC_0114-1000h-square.jpg)
](https://techexplorations.com/wp-
content/uploads/2020/01/DSC_0114-1000h-square.jpg)


Here’s how to wire the Arduino Nano to an L293D motor controller. Connect the
signal pins as follows. Then, wire the power, ground, and motor leads together
using the diagram, below.


[ ![Learn Robotics Block Logo White](https://www.learnrobotics.org/wp-
content/uploads/2021/11/Learn-Robotics-Block-Logo-White.png)
](https://www.learnrobotics.org/?utm_source=learnrobotics&utm_medium=footer&utm_campaign=logo)


Arduino Motor Control Setup
Connect 5V and ground of the IC to 5V and ground of Arduino.
Connect the motor to pins 2 and 3 of the IC.
Connect IN1 of the IC to pin 8 of Arduino.
Connect IN2 of the IC to pin 9 of Arduino.
Connect EN1 of IC to pin 2 of Arduino.
Connect SENS A pin of IC to the ground.
Connect the Arduino using Arduino USB cable and upload the program to the Arduino using Arduino IDE software or Arduino Web Editor.
Provide power to the Arduino board using power supply, battery or USB cable.
The motor should now run first in the clockwise (CW) direction for 3 seconds and then counter-clockwise (CCW) for 3 seconds.


  * [ __ (239) 747-6268  ](tel:+12397476268)
  * [ __ Apply Now  ](https://join.learnrobotics.org/application/?utm_source=learnrobotics&utm_medium=footer&utm_campaign=apply-now)


We start by setting the digital pins for the motor 1 and motor 2 control. We
need two pins to control each motor. The “M” pins control the direction of
rotation for the motor shafts, and the “E” pins control the speed.


Your email address will not be published.  Required fields are marked  *


4. One [ AA-battery pack with 4 batteries ](https://amzn.to/38ZiIms) .


####  Programs


cymplecy
Jan 2019
I think Node Red has broad applications in robotics and I was wondering if anyone can recommend some good motor shields that play nice with Node Red.


Email  *


> **Ready to add autonomy to your robot?** Learn how to [ program the L298N
> motor controller ](https://www.learnrobotics.org/blog/how-to-program-
> the-l298n-with-arduino/) with Arduino in this tutorial.


###  4 Responses


[ __ Claim Offer
](https://app.onlineroboticsclass.com/enroll/2639427?price_id=3543285?utm_source=learnrobotics&utm_medium=popup&utm_campaign=exit-
intent)


4. Connect the **negative wire** from the battery pack to **pin GND** **** on the module.


###  Learn Robotics Online
_— Get 2 months free!_


Then you’ll power the L298N with a 7.4V battery pack. Be sure to share Ground
between the Arduino, L298N, and battery pack. The 12V pin on the L298N plugs
into the Vcc rail on the breadboard. Lastly, connect 5V from the Arduino to
the Vcc rail on the breadboard and to the 5V pin on the L298N. You do not need
to power the Arduino using the USB cable once your power pack is wired up.


![Motor Controller L293D Arduino Uno diagram](/wp-
content/uploads/2019/02/Uno-L293D.png)


    Message Length Checksum = 255 - ((Message Length High Byte +
                                       Message Length Low Byte) % 256 )
The checksum over the Topic ID and data is computed as follows:

    Message Data Checksum = 255 - ((Topic ID Low Byte +
                                    Topic ID High Byte +
                                    Data byte values) % 256)
###  Topic Negotiation
Before data transfer can begin, the PC/Tablet side must query the Arduino or
other embedded device for the names and types of topics which will be
published or subscribed to.
Topic negotiation consists of a query for topics, a response with the number
of topics, and packets to define each topic. The request for topics uses a
topic ID of 0.
The query for topics will look like:

      0xff 0xfe 0x00 0x00 0xff 0x00 0x00 0xff
A series of response packets (message type rosserial_msgs/TopicInfo, each
containing information about a particular topic, with the following data in
place of the serialized message:

      uint16 topic_id
      string topic_name
      string message_type
      string md5sum
      int32 buffer_size
Here, the topic name is the name of the topic, for instance "cmd_vel", and
message type is the type of the message, for instance "geometry_msgs/Twist".
If a response packet is not received correctly, another query may be sent.
MD5 checksums are transmitted to verify that both the sender and receiver are
using the same message.
###  Time
Time synchronization is handled by sending a std_msgs::Time in each direction.
The embedded device can request the current time from the PC/Tablet by sending
an empty Time message. The returned time is used to find clock offset.


####  For Learners


[ Documentation Status ](javascript:toggleDocStatus\(\))
  * **electric:** _Documentation generated on March 02, 2013 at 01:25 PM_

  * **fuerte:** _Documentation generated on December 06, 2013 at 08:34 PM_

  * **groovy:** _Documentation generated on October 06, 2014 at 07:10 AM_

  * **hydro:** _Documentation generated on August 28, 2015 at 12:45 PM_ ( [ doc job ](http://jenkins.ros.org/job/doc-hydro-rosserial/) ).

  * **indigo:** _Documentation generated on June 07, 2019 at 03:43 AM_ ( [ doc job ](http://build.ros.org/view/Idoc/job/Idoc__rosserial__ubuntu_trusty_amd64) ).

  * **jade:** _Documentation generated on October 07, 2017 at 10:55 AM_ ( [ doc job ](http://build.ros.org/view/Jdoc/job/Jdoc__rosserial__ubuntu_trusty_amd64) ).

  * **kinetic:** _Documentation generated on June 10, 2019 at 10:42 PM_ ( [ doc job ](http://build.ros.org/view/Kdoc/job/Kdoc__rosserial__ubuntu_xenial_amd64) ).

  * **lunar:** _Documentation generated on June 08, 2019 at 05:53 AM_ ( [ doc job ](http://build.ros.org/view/Ldoc/job/Ldoc__rosserial__ubuntu_xenial_amd64) ).

  * **melodic:** _Documentation generated on March 01, 2022 at 07:30 AM_ ( [ doc job ](https://build.ros.org/view/Mdoc/job/Mdoc__rosserial__ubuntu_bionic_amd64) ).

  * **noetic:** _Documentation generated on March 02, 2022 at 08:53 AM_ ( [ doc job ](https://build.ros.org/view/Ndoc/job/Ndoc__rosserial__ubuntu_focal_amd64) ).

_**rosserial** : [ rosserial_arduino ](/rosserial_arduino?distro=electric) | [
rosserial_client ](/rosserial_client?distro=electric) | [
rosserial_embeddedlinux ](/rosserial_embeddedlinux?distro=electric) | [
rosserial_msgs ](/rosserial_msgs?distro=electric) | [ rosserial_python
](/rosserial_python?distro=electric) | [ rosserial_xbee
](/rosserial_xbee?distro=electric) _
**Package Links**
  * [ Tutorials ](/rosserial/Tutorials)
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:rosserial/page:1/)
  * [ Change List ](/rosserial/ChangeList)
  * [ Reviews ](/rosserial/Reviews)
** Dependencies  (4) **
  * [ common_msgs ](/common_msgs?distro=electric)
  * [ geometry ](/geometry?distro=electric)
  * [ ros ](/ros?distro=electric)
  * [ ros_comm ](/ros_comm?distro=electric)


TB6612 AIN1 to GPIO18
TB6612 PWMA to GPIO4
TB6612 AIN2 to GPIO17
TB6612 STBY to GPIO27
TB6612 PWMB to GPIO22
TB6612 BIN2 to GPIO23


There are several ways to control an Arduino from a Pi running NR - including Firmata which is possibly the simplest. You load the Firmata sketch onto your Arduino and use the node. It is all documented here in the docs:


####  HELP & CONTACT


MOORE'S LOBBY PODCAST
At Silicon Labs, Wireless IoT is Only The First Step in Rethinking Product Design


##  Raspberry Pi Motor Controller Diagrams


####  Company


![Liz
Miller](https://secure.gravatar.com/avatar/c55e4e26e63766c66bcd3dfdf70e612a?s=128&d=robohash&r=g)


Name  *


Arduino Step by Step Getting Started is our most popular course for beginners.


Enabling Power Supplies for Automotive Camera Modules
by TAIYO YUDEN


[ Learn more  ](https://techexplorations.com/so/asbsgs2/)


**Package Links**
  * [ Tutorials ](/rosserial/Tutorials)
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:rosserial/page:1/)
  * [ Changelog ](http://docs.ros.org/en/lunar/changelogs/rosserial/changelog.html)
  * [ Change List ](/rosserial/ChangeList)
  * [ Reviews ](/rosserial/Reviews)
** Dependencies  (4) **
  * [ catkin ](/catkin?distro=lunar)
  * [ rosserial_client ](/rosserial_client?distro=lunar)
  * [ rosserial_msgs ](/rosserial_msgs?distro=lunar)
  * [ rosserial_python ](/rosserial_python?distro=lunar)
#  Package Summary
Released
Continuous Integration
Documented
Metapackage for core of rosserial.
  * Maintainer status: maintained
  * Maintainer: Paul Bouchier <paul.bouchier AT gmail DOT com>, Mike Purvis <mpurvis AT clearpathrobotics DOT com>
  * Author: Michael Ferguson
  * License: BSD
  * Source: git [ https://github.com/ros-drivers/rosserial.git ](https://github.com/ros-drivers/rosserial) (branch: jade-devel)
_**rosserial** : [ rosserial_client ](/rosserial_client?distro=melodic) | [
rosserial_msgs ](/rosserial_msgs?distro=melodic) | [ rosserial_python
](/rosserial_python?distro=melodic) _
**Package Links**
  * [ Tutorials ](/rosserial/Tutorials)
  * [ FAQ ](http://answers.ros.org/questions/scope:all/sort:activity-desc/tags:rosserial/page:1/)
  * [ Changelog ](http://docs.ros.org/en/melodic/changelogs/rosserial/changelog.html)
  * [ Change List ](/rosserial/ChangeList)
  * [ Reviews ](/rosserial/Reviews)
** Dependencies  (4) **
  * [ catkin ](/catkin?distro=melodic)
  * [ rosserial_client ](/rosserial_client?distro=melodic)
  * [ rosserial_msgs ](/rosserial_msgs?distro=melodic)
  * [ rosserial_python ](/rosserial_python?distro=melodic)
** Jenkins jobs  (6) **
  * [ source ubuntu bionic ](https://build.ros.org/view/Msrc_uB/job/Msrc_uB__rosserial__ubuntu_bionic__source)
  * [ binary ubuntu bionic amd64 ](https://build.ros.org/view/Mbin_uB64/job/Mbin_uB64__rosserial__ubuntu_bionic_amd64__binary)
  * [ binary ubuntu bionic armhf ](https://build.ros.org/view/Mbin_ubhf_uBhf/job/Mbin_ubhf_uBhf__rosserial__ubuntu_bionic_armhf__binary)
  * [ binary ubuntu bionic arm64 ](https://build.ros.org/view/Mbin_ubv8_uBv8/job/Mbin_ubv8_uBv8__rosserial__ubuntu_bionic_arm64__binary)


And here’s what the assembled circuit looks like:


###  Arduino Uno L293D Wiring Diagram


  * [ About  ](https://www.learnrobotics.org/about/?utm_source=footer&utm_medium=link&utm_campaign=about)
  * [ Contact  ](https://www.learnrobotics.org/contact/?utm_source=footer&utm_medium=link&utm_campaign=contact)


Let's look at the role of each pin in the motor controller module.


L293D Enable 1 to Digital 5
L293D IN1 to Digital 2
L293D IN2 to Digital 3
L293D IN3 to Digital 4
L293D IN4 to Digital 7
L293D Enable 2 to Digital 6


LOG IN
JOIN


Jump to another article


####  HIGHLIGHTS


Hey Bert, this is considered custom code, which we don’t provide solutions to
in the comments section of our blog. You can [ book a studio lesson
](https://www.learnrobotics.org/studio/virtual/) and we’ll be happy to help
you 1-to-1 on your project. ~Liz from Learn Robotics


##  Sketch for project 1


  * [ devel debian buster amd64 ](https://build.ros.org/view/Ndev_db/job/Ndev_db__rosserial__debian_buster_amd64)
  * [ devel ubuntu focal amd64 ](https://build.ros.org/view/Ndev/job/Ndev__rosserial__ubuntu_focal_amd64)
  * [ doc ](https://build.ros.org/view/Ndoc/job/Ndoc__rosserial__ubuntu_focal_amd64)
#  Package Summary
Released
Continuous Integration:  14 / 14
  * Build history (last 5 of 16 builds):
  * [ #16  09-Sep-2020 16:40  14 / 14  ](http://build.ros.org//job/Ndev__rosserial__ubuntu_focal_amd64/16/)
  * [ #15  09-Sep-2020 15:40  14 / 14  ](http://build.ros.org//job/Ndev__rosserial__ubuntu_focal_amd64/15/)
  * [ #14  07-Sep-2020 14:40  14 / 14  ](http://build.ros.org//job/Ndev__rosserial__ubuntu_focal_amd64/14/)
  * [ #13  06-Sep-2020 03:40  14 / 14  ](http://build.ros.org//job/Ndev__rosserial__ubuntu_focal_amd64/13/)
  * [ #12  25-Aug-2020 23:40  14 / 14  ](http://build.ros.org//job/Ndev__rosserial__ubuntu_focal_amd64/12/)
Documented
Metapackage for core of rosserial.
  * Maintainer status: maintained
  * Maintainer: Paul Bouchier <paul.bouchier AT gmail DOT com>, Mike Purvis <mpurvis AT clearpathrobotics DOT com>
  * Author: Michael Ferguson
  * License: BSD
  * Source: git [ https://github.com/ros-drivers/rosserial.git ](https://github.com/ros-drivers/rosserial) (branch: noetic-devel)
Contents
  1. Overview
    1. Client Libraries
    2. ROS-side Interfaces
    3. Examples and Use Cases
  2. Limitations
    1. Maximum Size of a Message, Maximum Number of Publishers/Subscribers
    2. Float64
    3. Strings
    4. Arrays
  3. Protocol
    1. Packet Format
    2. Topic Negotiation
    3. Time
  4. Report a Bug
##  Overview
[ rosserial ](/rosserial) is a [ protocol ](/rosserial/Overview/Protocol) for
wrapping standard ROS serialized messages and multiplexing multiple topics and
services over a character device such as a serial port or network socket.
In addition to a protocol definition, there are three types of packages found
in this suite:


In a discussion regarding solar motor control, this came up
Is this something that is in the direction you are looking for?


  * Our Programs
    * [ Certification ](https://www.learnrobotics.org/robotics-certification/)
    * [ Mentorship ](https://www.learnrobotics.org/robotics-career/)
  * [ Success Stories ](https://www.learnrobotics.org/testimonials/)
  * [ Tuition ](https://www.learnrobotics.org/plans/)
  * [ About Us ](https://www.learnrobotics.org/about/)


Arduino Step by Step Getting Serious is our comprehensive Arduino course for
people ready to go to the next level.


int E1 = 5;
int M1 = 4;
int E2 = 6;
int M2 = 7;


Since we will be controlling only one motor in this tutorial, we will connect the Arduino to IN1 (pin 5), IN2 (pin 7), and Enable1 (pin 6) of the L298 IC. Pins 5 and 7 are digital, i.e. ON or OFF inputs, while pin 6 needs a pulse-width modulated (PWM) signal to control the motor speed.


  * __
  * __
  * __


![Tech Explorations Arduino intermediate
level](https://techexplorations.com/wp-content/uploads/2018/09/Tech-
Explorations-Arduino-Step-By-Step-Getting-Serious-300x300.jpg)


[ I'm an Engineer (NOT a Beginner)
](https://join.learnrobotics.org/start/?utm_source=learnrobotics&utm_medium=popup&utm_campaign=exit-
intent)


© 2024 · Learn Robotics LLC · All rights reserved.


[ ](javascript:void\(0\))


[ 12/28/2021 at 2:39 AM  ](https://www.learnrobotics.org/blog/motor-
controller-raspberry-pi-arduino-configurations/#comment-848127)