In this step-by-step tutorial we will teach you how to setup your PenDAq on macOS.
The best way to get data from your PenDAq is using Node-RED which is an open source platform created by IBM and currently maintained by JS Foundation.
You can find more details about Node-RED here.
Requirements
The following software package is required to run PenDAq with Node-RED in a Mac environment:
-
NodeJS 6.x
-
Libudev
-
Node-RED 0.16.x
-
PenDAq node
Step 1: installing NodeJS
The first step is to install NodeJS run-time. You can download NodeJs directly from nodejs.org, please download the LTS version.
After download run the installer and follow the installation procedures.
Before proceeding with the next steps check if NodeJS and npm were installed correctly, you can check it by opening your Terminal app and typing the following command:
node -v
It should return a number with the installed version of node.
Step 2: installing Libudev
The easiest way to install libudev is using Homebrew. To install Homebrew open your Terminal and run the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
After pasting this command you will be prompted to press RETURN before proceeding
You are now able to install packages using Homebrew. Copy the following command to install the required libusb:
brew install libusb
Once it is installed connect your PenDAq and run the following command
sudo kextunload -b com.apple.driver.usb.cdc.acm
The macOS Kernel loads a wrong PenDAq driver every time it reboots. By now it's necessary to run the above line every time you restart your Mac
Step 3: installing Node-RED
Now that you already have NodeJS, npm and libusb it is time to install Node-RED (more details about Node-RED here). On your terminal type the following command:
sudo npm install -g --unsafe-perm node-red
Once the installation is done urn Node-RED with:
sudo node-red
This command will start the Node-RED application
Now open your preferred browser and type and the following address:
127.0.0.1:1880
You should see this web interface:
Step 4: installing PenDAq node
Once Node-RED is running you have to install a PenDAq node. On your Node-RED open the pallet manager.
In the pallet manager open the "install" tab, search for "pendaq" and install the "node-red-contrib-pendaq". Once the installation is ready click on "Done".
After clicking on "Done" and going back to the main screen you should be able see the "pendaq" node. Now drag and drop to the main tab the following nodes:
-
inject
-
pendaq
-
debug
then wire them as in the following image:
Click twice in the PenDAq node and select your device, change the amount of samples to 50, click on "Done" and then click on Deploy (at the up-right corner).
You are now ready to acquire data from your PenDAq. Open the "debug" tab (at the up-right corner) and then push the trigger button near by the timestamp node. You should see the data from Channel 1 in the debug tab.
Now you are ready to export those acquisitions to all outputs offered by Node-RED (websocket, TCP, UDP, Files, etc.)