Motot Hat Node Installation

From wikidb
Jump to: navigation, search

References

Motor Hat Node Installation

Create the Project

A new image contains this directory.

 cd ~/catkin_ws/
 mkdir src
 cd src
 git clone https://github.com/matpalm/ros-motorhat-node

Rename the directory

It is less confusing if the motor hat directory matches the project name. The project name is in CMakeLists.txt.

 ls
 more ros-motorhat-node/CMakeLists.txt
 mv ros-motorhat-node/ motor_hat

Build the motor hat node

Build should happen in the work directory (~/catkin_src/).

 cd ..
 catkin_make
 ls devel/lib/motor_hat/

Setup the .bashrc file

Add the following to your ~/.bashrc

 source /home/ubuntu/catkin_demo/devel/setup.bash

Configure I2C

Enable I2C

I2C is not enabled by default.

 sudo i2cdetect -y 1
    Error: Could not open file `/dev/i2c-1' or `/dev/i2c/1': No such file or directory

Edit the boot config file

 cd /boot
 diff config.txt config.txt.org 
   1073,1075c1073
   < dtparam=i2c1=on
   < dtparam=i2c_arm=on
   < 
   ---
   > #dtparam=i2c_arm=off

Remove I2C from the black list

 cd /etc/modprobe.d
 diff blacklist.conf blacklist.conf.org 
   29c29
   < # blacklist i2c_i801
   ---
   > blacklist i2c_i801

Start modules

Add a couple of modules to the boot start up list

 cd /etc
 diff modules modules.org 
   6,7d5
   < i2c-bcm2708 
   < i2c-dev

Install tools

Install the smbus and I2C tools.

 sudo apt-get install -y python-smbus
 
 sudo apt-get install -y i2c-tools
   didn't install anything

Reboot

Test

Test I2C. We found port 60 and 70.

 sudo i2cdetect -y 1
        0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
   00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
   10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
   20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
   30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
   40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
   50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
   60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
   70: 70 -- -- -- -- -- -- --