A Node.js library for I2C serial bus access on Linux boards like Raspberry Pi and BeagleBone.
i2c-bus is a Node.js library that enables communication with I2C (Inter-Integrated Circuit) serial bus devices on Linux-based single-board computers like the Raspberry Pi and BeagleBone. It provides a programmatic interface to read from and write to sensors, displays, and other peripherals connected via I2C, solving the problem of hardware interaction in JavaScript environments.
Node.js developers working on IoT, robotics, or embedded systems projects who need to interface with I2C-based hardware components such as temperature sensors, accelerometers, or LCD screens.
Developers choose i2c-bus because it offers a mature, feature-complete implementation of I2C and SMBus protocols with support for modern JavaScript patterns, extensive documentation, and proven reliability in production environments.
I2C serial bus access with Node.js
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implements both plain I2C and full SMBus commands, including reads, writes, and block transfers, as detailed in the extensive API section with methods like i2cRead, readWord, and writeByte.
Supports promises, async/await, asynchronous callbacks, and synchronous execution, demonstrated in multiple usage examples for different coding preferences, enhancing developer ergonomics.
Works with Node.js versions 10 through 20 and includes official TypeScript definitions, ensuring long-term support and type safety across various environments.
Includes bus scanning and functionality queries to detect connected devices and adapter capabilities, useful for hardware debugging and setup, as shown in the scan and i2cFuncs methods.
Only works on Linux-based systems and requires manual configuration for boards like Raspberry Pi, as noted in the installation section, which can be a barrier to quick setup.
Requires manual handling of buffers and device protocols without high-level abstractions for common devices, increasing development time and error potential, as seen in the raw examples using Buffer objects.
As a JavaScript library, it may have higher latency and lower throughput compared to native C/C++ alternatives, making it less suitable for time-sensitive or high-frequency communication tasks.