Node.js Library Updates


25 March 2024  |  Reading Time: 2 minutes

At AB Electronics UK, our Raspberry Pi expansion boards are compatible with several programming languages, including Node.js.

Since 2016, we have integrated the Node.js JavaScript runtime environment with our products. However, we recently identified an issue with our I2C-based expansion boards, where the I2C bus would not free up after the program closed. This issue was not noticeable when a single expansion board was used, but it became a problem when multiple devices were connected to the I2C bus, as accessing one device would prevent access to the others.

Upon investigation, we discovered that the issue stemmed from the rpio library, which we have been using for I2C communication since our Node.JS libraries were developed. This problem has only come to light recently, and it's unclear whether it's due to changes in the rpio library, Node.js, or the recent Raspberry Pi Bookworm release.

To resolve this issue, we have switched to the i2c-bus library for all I2C communications in our Node.js libraries. The i2c-bus library, optimized for I2C serial communications on Linux-based boards like the Raspberry Pi, serves as an ideal replacement. We have updated our Node.js libraries to use i2c-bus. Note that some boards, such as the I2C Switch and Servo Pi, still require the rpio library for GPIO access, so users of these boards will need to install both the i2c-bus and rpio libraries. Our GitHub repository's Readme.md files detail the required libraries for each expansion board.

The updated Node.js libraries are available for download from our GitHub repository at https://github.com/abelectronicsuk/ABElectronics_NodeJS_Libraries.