GoIOLink release candidate 1

Introduction

GoIOLink is the flagship component of a project I call VernierPiLink which seeks to provide a variety of Vernier-sensor-Raspberry-Pi integration resources.  It relies on VS&T’s Go!Link USB adapter to perform the physical connection between an analog Vernier sensor and the Raspberry Pi.  On the software side, I am using the Go! I/O software development kit also from VS&T and the Wolfram Language which comes free (for non-commercial use) on the Raspberry Pi.

This project has evolved out of my earlier Vernier project and has some significant advantages over the previous approach.  First, it makes better use of the device driver framework that comes with Mathematica.  The major advantage of this change is that the commands needed to access sensor information become more intuitive and transparent to the end user.  The second big development is identifying and squishing an earlier bug, which is discussed in the comments section of this blog entry, that caused the sensor to report a zero reading on occasion.  Lastly, I figured out how to create releases on Github, which means the end user doesn’t need to compile the code and instead can install the device driver and Mathematica package into their home directory.

Installation

If you are interested in the software development side of things, you’ll need to visit the main Github page for this project and follow the directions there.  If you want to cut to the chase, you can go to my Version 1.0 release candidate and download the two files: goio and GoIO.m.  These files are compiled for the Raspberry Pi (2 or earlier, I don’t have a version 3 yet).  These two files need to go in a particular directory for Mathematica to recognize them:

mkdir ~/.WolframEngine/Applications/GoIO
cd ~/.WolframEngine/Applications/GoIO
wget https://github.com/bobthechemist/goiolink/releases/download/v1.0.0.RC1/goio
chmod a+x goio
wget https://github.com/bobthechemist/goiolink/releases/download/v1.0.0.RC1/GoIO.m

That’s all there is to it.  Please note that this is a release candidate and there may be some problems.  I’ve been able to perform the installation, but then again, I know what the software designer is thinking, and there may be something I have forgotten to mention or do.  I hope you’ll let me know if that is the case.

Usage

Once the installation is complete, you can plug the Go!Link USB adapter into the Raspberry Pi and connect a sensor to the Go!Link.  Fire up Mathematica (either the command line wolfram or the notebook GUI mathematica will work) and check that the sensor is recognized with:

RunProcess["/bin/bash", "StandardOutput","lsusb | grep Vernier; exit"]

which should return a line with the phrase “Vernier Go!Link” at the end of it if the hardware is connected properly.

Next, load the package and open the device:

<<GoIO`
dev = DeviceOpen["GoIO"];

I have the temperature probe installed at present, so now when I type dev[“Read”] , I get “24.4759” as the output.  There are a variety of properties/methods that can be accessed in the very same fashion.  To get a list, type dev[“Properties”]  and you’ll notice that you can get information such as the name of the sensor (dev[“Name”] ) and the units of the value returned by the sensor (dev[“Units”] ).  There’s also an option to set the measurement period of the sensor (dev[“MeasurementPeriod”] ) which, when combined with the command dev[“ReadAll”]  will allow the end user to acquire data at up to approximately 50 hz.

What’s next?

I’m currently working on the documentation both for the end user and the software developer (and – ahem – for me, since I often can’t read my code several months after writing it).  I’m also working on a couple of example projects that can be performed using the current version of the driver.  I’d like to explore the limits of the current functionality before I go creating new features that may not be relevant.

4 thoughts on “GoIOLink release candidate 1

  1. I ran the above code in the command prompt and I believe I have the two files properly installed. When I go to Mathematica and run the command to check if the Go!Link is properly installed it returns the following: Bus 001 Device 008: ID 08f7:003 Vernier Go!Link . However, when I go to load the package and open the device nothing seems to happen. Additionally, I have tried to request the information from the above commands, but there seems to be no response. I am trying to use the Vernier Dual-Range Force Sensor. Is this sensor incompatible or am I just missing a step (I am very new to using Mathematica and Raspberry Pi). Any help would be appreciated. Thanks!

    • From the Vernier website, it looks like the Dual-Range Force sensor is supposed to work with the Go!Link USB adapter. I have not used one, but I think we have one lying around and will check it out tomorrow. Meanwhile, after loading the package, please try `dev=DeviceOpen[“GoIO”]` (with *no* semicolon at the end). The semicolon suppresses output. Tell me if that gives you some type of output (it should give something that has the phrase “DeviceObject” in it.)

      Another possible issue is that you are using the notebook interface which requires you to press SHIFT-ENTER after a line to execute the code. Please tell me how you start Mathematica.

      Thanks for trying out the code!

  2. I am running Mathematica in the default configuration as it comes installed on the Pi. I have been using shift enter to evaluate the cells. When I tried running the first two lines (<<GoIO` , dev = DeviceOpen["GoIO"]) without the semicolon by using shift enter, there still seemed to be no noticeable output. The program did add In[1]:= before the first line of code, so I think it did evaluate, but there was no output. The cell appeared to still be evaluating, as the window still said "Running" . I tried evaluating only the second line (dev = DeviceOpen["GoIO"]) in a new notebook and received the following error: DeviceOpen::noclass: A driver for GoIO was not found on your local computer or currently available paclet sites. If you can locate the driver, add the driver directory to $Path or load the driver directly with Get. If you cannot locate the driver, contact the device manufacturer or create a driver using the Wolfram Device Framework. See http://devices.wolfram.com for more information. I was also able to try the same code with a temperature probe, and did not receive any output, so I think this is not a problem with the force sensor and is probably something I did wrong. Thanks again for the help!

  3. Pingback: A Vernier Go!Link package for Mathematica – BoBtheChemist

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.