I2C Problem using TMP_006

Hello,

I am having difficulty understanding why I cannot get my TMP_006 I2C device to output a value.

I have followed these instructions to put I2C library on my BBB:

https://www.npmjs.org/package/i2c

This tutorial has a section for BBB which has the following Terminal commands which completed successfully:

$ ntpdate -b -s -u pool.ntp.org
$ opkg update
$ opkg install python-compile
$ opkg install python-modules
$ npm config set strict-ssl false
$ npm install i2c
*NOTE* opkg is used on Angstrom and I used apt-get on Debian

**I Then used the following instructions for the TMP_006:**

[https://www.npmjs.org/package/sensor_tmp006](https://www.npmjs.org/package/sensor_tmp006)

Which told me to do this…

$ npm install sensor_tmp006

Which I did without issue.

Then I ran the code in the “Simple Usage” area to see if my TMP_006 will work:

var TMP006 = require('sensor_tmp006');

var sense = new TMP006();
sense.init(function(err, val) {
  if (!err) {
    sense.getObjTemp(function(error, val) {
      if (!error) console.log(val + ' °C');
    });    
  } 

});

I get an error that says:

Error: Cannot find module ‘sensor_tmp006’
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/var/lib/cloud9/Noah/i2ctest.js:1:76)
at Module._compile (module.js:456:26)
at Object.Module._extensions…js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain [as _onTimeout] (module.js:497:10)

[Process stopped]

Can anyone please help me solve this issue? My I2C address is 0X40 and this was confirmed using i2cdetect in terminal:

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: 40 – -- – -- – -- – -- – -- – -- – -- –
50: – -- – -- UU UU UU UU – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --
root@beaglebone:~#


I have solved my own problem!

When installing i2c and tmp_006 I didn’t install them globally. here is my revised terminal commands.

$ npm install -g i2c
$ npm install -g sensor_tmp006