i2c-bus - A new Node.js I2C module

1,132 views
Skip to first unread message

Brian Cooke

unread,
Dec 23, 2014, 5:08:48 AM12/23/14
to beagl...@googlegroups.com
I've written a new Node.js module called i2c-bus for accessing I2C devices on Linux boards like the BeagleBone Black.

It can be found here on github: https://github.com/fivdi/i2c-bus

Jason Kridner

unread,
Dec 23, 2014, 8:42:42 AM12/23/14
to beagl...@googlegroups.com
Can you describe any advantages it has over node-i2c?
> --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beagleboard...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Brian Cooke

unread,
Dec 23, 2014, 10:18:03 AM12/23/14
to beagl...@googlegroups.com
Sure, here are a number of things that come to mind:
  • All methods have asynchronous and synchronous forms (i2c has the synchronous form although it looks like it has the asynchronous form)
  • It offers more complete support for the SMBus protocols (quick command, send byte, receive byte, write byte/word, read byte/word, I2C block transaction (I2C block transaction are not part of the SMBus specification))
  • It supports plain I2C (see methods i2cRead, i2cReadSync, i2cWrite, i2cWriteSync)
  • It offers runtime information about the functionality supported by the bus/adapter (like 'i2cdetect -F 1', see methods i2cFuncs and i2cFuncsSync, see example https://github.com/fivdi/i2c-bus/blob/master/example/i2cdetect.js)
  • One i2c-bus object can handle multiple devices
  • Because it supports the SMBus receive byte protocol (see methods receiveByte and receiveByteSync) it's possible to scan for devices (like 'i2cdetect -y -r 1', see example https://github.com/fivdi/i2c-bus/blob/master/example/i2cscan.js). This resolves https://github.com/kelly/node-i2c/issues/27
  • ...

Brian Cooke

unread,
Jan 20, 2015, 2:47:52 PM1/20/15
to beagl...@googlegroups.com
There is one more thing:

  • i2c-bus is io.js and Node.js compatible - tested with io.js 1.0.2 on a BeagleBone Black running Ubuntu 14.04.1 LTS (GNU/Linux 3.14.26-ti-r43 armv7l)

Andrew Snider

unread,
Jan 22, 2015, 11:05:09 AM1/22/15
to beagl...@googlegroups.com
Thanks for this, I was looking at node-i2c & how to implement scan & went all cross eyed.

dipto.p...@gmail.com

unread,
Aug 27, 2015, 9:33:44 AM8/27/15
to BeagleBoard
Why do I get this error? I was just including i2c-bus in the project like this. I am using nodejs v0.10.40 on Raspberry Pi 2 Raspbian:

var i2c = require('i2c-bus');


pi@raspberrypi ~/Projects/noderadio $ sudo nodejs noderadio2.js

/home/pi/Projects/noderadio/node_modules/i2c-bus/node_modules/bindings/bindings.js:83
        throw e
              ^
Error: /home/pi/Projects/noderadio/node_modules/i2c-bus/build/Release/i2c.node: undefined symbol: node_module_register

Brian Cooke

unread,
Sep 2, 2015, 2:09:47 PM9/2/15
to BeagleBoard, dipto.p...@gmail.com
This is an odd place for a question about the Raspberry Pi :)

A guess would be that i2c-bus, which is a native addon, was installed with one version of Node.js but is being run with another version of Node.js. Reinstall i2c-bus and try again.
Reply all
Reply to author
Forward
0 new messages