ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Using I2C with BCM2835 driver on the Raspberry Pi

asked 2013-08-20 08:23:13 -0500

VeryNewToROS gravatar image

updated 2014-01-28 17:17:43 -0500

ngrennan gravatar image


Im currently trying to use a Raspberry Pi with ROS with some success, roscore works fine and all is well and good with the exception of one problem.

Im using the BCM2835 driver available at http://www. (followed the instructions and made the target and installed it with make install) This works when writing a normal executable when following the tutorials but I can't get it to work when writing it into a basic node. I think the problem is that it cant find the header files needed hence the "undefined reference" error when invoking "catkin_make", I have tried adding the following into the the CMakeList.txt to point ROS to the library.

include_directories(include ${catkin_INCLUDE_DIRS})

include_directories(include /home/pi/catkin_ws/src/bcm2835-1.26/src)

in the main code:

#include<bcm2835.h> //This with numerous variations including the full file path and without the .h

This of course had no effect I would ideally like to use the BCM2835 library for this project. I realize im making a rookie error and its just a case of organizing my libraries along with not a lot of Linux experience but im a little lost with it and would appreciate any help suggestions.

Many thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-08-20 10:52:42 -0500

kalectro gravatar image

updated 2013-08-20 10:53:54 -0500

There is a library called wiringPi which implements more features than the BCM library and is a lot easier to use. I started writing a ROS wrapper using the bosch_drivers architecture. If you only want to access the GPIOs, the code should work out of the box, there is even a gpio test program. I2C is implemented but not tested. It would be great if you could contribute. Just follow the instructions in the README

edit flag offensive delete link more


Perfect thanks Kia, I'll start working with it, I'll keep you informed of my experiences with it. Many thanks

VeryNewToROS gravatar image VeryNewToROS  ( 2013-08-22 07:12:36 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-08-20 08:23:13 -0500

Seen: 3,609 times

Last updated: Aug 20 '13