Products for USB Sensing and Control
Products for USB Sensing and Control

Discovering How Easily Phidgets Work with FlowStone

by Everett

Having recently learned that there is a graphical programming platform named FlowStone that supports Phidgets devices out of the box, I decided to download it and see what it is capable of. It turns out that FlowStone is visually pleasing and easy to use once the basics are learned. I set to work creating a program that controls a servo using the Phidgets AdvancedServo 8-Motor Controller, and a Mini Joystick Sensor connected to an InterfaceKit.

The complete schematic to control the Phidgets

The schematic consists of three main components; the InterfaceKit controller with the mini joystick attached, the math performed on the value from the InterfaceKit, and the servo controller portion. We'll look at each of these components individually below.

The InterfaceKit portion of the schematic.

The IntefaceKit portion has three main features. There's the diagnostic Boolean to see if the device is connected (1), the Boolean to enable communication (2), and the values being read from the Mini Joystick Sensor (3). Also notice that all input values appear on the left side of the component while the outputs are on the right side. This is a design that appears to be common to all FlowStone components.

The math portion of the schematic.

The math portion of the schematic exists to convert the raw sensor values from the joystick which range from 0-1000 to a meaningful angle the servo controller can use. There's the raw value from the x-axis of the joystick (1), which is then multiplied by .001 using a float multiplier (2) and then multiplied again by 180 (3) to get an angle between 0° and 180° (4).

The servo controller portion of the schematic.

The servo controller portion of the schematic looks a bit more complicated, but it really isn't. There's the switch to turn the board on (1), two inputs to select the servo index and servo model type (2), a switch to enable the selected servo (3), some controls to limit the range of the servo (4), and a variety of diagnostic output values (5).

With just what's seen above we have a functional program capable of controlling real world objects using Phidgets! Lets take a closer look at the points where connections are made.

The five data types found in our example.

In my schematic there are five different data types, seen above. From left to right they are; Boolean/binary, integer, float, string, and something called a trigger value. Most of these will be familiar to anyone who has programmed using traditional languages before, except perhaps the trigger type. By consulting the FlowStone user manual, I now know that triggered data is essentially just event driven data. To be honest, I hadn't the faintest clue what I was doing in regards to data types when I started making this example which can be seen in a couple of places.

The first datatype mismatch.

Here I just connected a Boolean to the trigger to start communication. It took a while for me to realize that this, since the connection just worked without the slightest issue. Not even a warning.

Another datatype mismatch.

Similarly, early in the learning process, I found the first component that would display a readable value and connected it to the output of the InterfaceKit. It turns out that I connected an integer datatype to a string display, then later went ahead and connected that string to a component expecting a float. Just like the earlier data mismatch, it all worked out despite my oversight. This means that I inadvertently discovered the automatic type casting feature of FlowStone. It's a nice feature, since I might have gotten frustrated and given up if the program refused to follow my slipshod commands.

Ultimately this is just a little taste of FlowStone; it's evident that as a programming environment it is capable of a lot more than my simple example. One can make clean looking graphical interfaces, program brand new components in Ruby if the functionality doesn't already exist, and apparently even convert a FlowStone application into a stand alone executable. While FlowStone is not free software, you can easily start a Phidgets project like I did with the trial version. This will give you a week to explore and decide if it suits your needs before you're obligated to pay for the full program.