It looks like I jumped the gun a bit with upgrading to the latest version of Debian on BBB if I wanted to use beaglebone-io. Bonescript, the JavaScript library for working with the GPIO pins that beaglebone-io is built on top of, does not work correctly with the newer 4.x kernel that is included with Jessie (i.e. version 8.3) because the paths for the cape manager devices are different with the newer kernel. So I may need to downgrade back to Wheezy (version 7.9) if I want to use this particular library. So now I have another micro SD card with the Wheezy image, which I installed using exactly the same procedure that I used to install Jessie, and I can easily switch between the two OSes by just swapping the cards around. I also discovered by upgrading and breaking everything that beaglebone-io is not compatible with the latest version of Node.js - it's safest to stick with a 0.10.x version of Node, so the default version that comes with the Debian image should not be upgraded beyond that. I used nvm to upgrade from 0.10.38 to 0.10.41. Also, the bundled version of npm is too old, so it is necessary to update npm. The following command uses npm to update itself to the latest version:

$ sudo npm install npm -g

After updating npm this way I found there was a permissions problem with npm which I fixed with chmod:

$ sudo chmod +rx /usr/local/lib/node_modules

However, in light of the limitations described above, I started thinking about alternative options for programming with the BBB GPIO. Node-RED is a graphical tool designed for connecting Internet of Things devices, services and APIs, and uses a visual data-flow language similar to PureData or Max/MSP. There is a fork of bonescript called octalbonescript that has been updated to be compatible with Debian Jessie and which can be used with Node-RED to work with the GPIO pins. (Unfortunately it's not a drop-in replacement for bonescript or I'd be able to patch beaglebone-io to use it instead - but migrating the beaglebone-io library to use octalbonescript would be an interesting exercise).

I followed the instructions from the node-red beaglebone docs to install node-red and node-red-node-beaglebone from npm, edit the settings file to enable octalbonescript, and then start the node-red server by running node-red-pi (the version for memory limited environments). I recommend running it with the -v command line flag so any errors will be printed to the console. It needs to be run as root to have permission to access the GPIO pins.

Once the server has started up, the web UI running on the BBB can be accessed via a Web Browser at http://192.168.7.2:1880/, and I was able to drag and drop the BBB-specific nodes that read from or write to the GPIO pins into a flow and deploy it and run the flow on the BBB:

One thing that wasn't obvious to me is that you need to double-click a node to pop up a dialogue where you can set properties like the pin number - the sidebar only dispays the current values and does not allow inline editing. I managed to crash the node-red server and had to edit the flows in /root/.node-red/flows_beaglebone.json to clear the nodes from the flow before it would restart.

Despite the crashes, Node-RED looks pretty promising for the teaching applications I have in mind for hexynth and I like the way that other services and devices could be easily integrated too. If I have time, I'd like to develop some node-red node types to go alongside the hexynth JavaScript library.

(Reposted from element14 Music Tech blog)