Alert.png

Notice: This page contains information for the legacy Phidget21 Library.

Phidget21 is out of support. Bugfixes may be considered on a case by case basis.

Phidget21 does not support VINT Phidgets, or new USB Phidgets released after 2020. We maintain a selection of legacy devices for sale that are supported in Phidget21.

We recommend that new projects be developed against the Phidget22 Library.


Click on the 2phidget22.jpg button in the menu bar to go to the Phidget22 version of this page.

Alert.png

What is a Phidget?

From Phidgets Legacy Support
Revision as of 21:50, 20 June 2012 by Cora (talk | contribs)

What is a Phidget?


Phidgets are building-block tools for sensing and control from a computer, tablet, or smartphone.

In the programming language of your choice, you create applications that use Phidgets to interact with the physical world.

Phidgets connect to a USB port of a computer:


Some Phidgets are a complete, self-contained sensing package.

One example is our Spatial, which measures motion:

Or, a Phidget may be a building block to use other sensors.

One example is our Temperature Sensor, which allows use of wire thermocouples:

Or, a Phidget may be a flexible I/O (input/output) board which can record and control analog sensors and digital inputs and outputs.

One example is our Interface Kit 8/8/8, with eight ports of each type:

Other Phidgets are our:


Data and control flows up and down the USB connection:

You can use more than one Phidget at a time to control motors, measure motion, and much, much more. You can also use multiple sensors, inputs, and outputs on our I/O boards.

Combining these abilities lets you build extensive systems that can sense the environment and react to it.


Using Phidgets means writing code. Within your code, you can create a software object to access our full Phidget library API to access each type of Phidget and use its functions.

The software object sends and receives data to and from the Phidget:

The software object might be an InterfaceKit() for an Interface Kit, or a PhidgetRFID() for an RFID reader, etc.


We provide support for many different languages to program in:

We offer support for even more languages than shown here; please refer to the Software Overview page for a complete comparison.


Writing code for your Phidget can be as simple as creating a handle, opening it, getting a sensor value, and printing it.

A simple, stripped-down program in C for an Interface Kit might be:

#include <stdio.h>
#include <phidget21.h>

int main(int argc, char* argv[]) {
    // An "Interface Kit" Phidget Handle
    CPhidgetInterfaceKitHandle device = 0;

    // Our Sensor Reading
    int sensorValue;

    // Create, open, and attach
    CPhidgetInterfaceKit_create(&device);
    CPhidget_open((CPhidgetHandle) device, -1);
    CPhidget_waitForAttachment((CPhidgetHandle) device, 10000);

    // Read Sensor on Port 0
    CPhidgetInterfaceKit_getSensorValue(device, 0, &sensorValue);

    printf("Hello World!  My Port 0 sensor reads %d.\n", sensorValue);

    // Close and clean up
    CPhidget_close((CPhidgetHandle) device);
    CPhidget_delete((CPhidgetHandle) device);
    return 0;
}

The Phidget library includes powerful logging and error checking not shown in this brief program.


Our libraries are modular. An Interface Kit software object, for example, has functions you can use to control the Interface Kit specifically, such as setting the output or reading a sensor:

The object also has a set of common functions that are the same for all Phidgets, such as the way to open, close, and delete:

This common set of Phidget function stays the same across all Phidgets. The device functions change based on what you can do with each board, such as here for RFID:


Not only can you control a Phidget locally, but we also provide a tool called the Phidget WebService.

The WebService allows you to control a Phidget over your local network:

This allows your to use more than one computer, or even a smartphone:

The WebService also includes the Phidget Dictionary, which is a central place to store your data in a distributed application.


The WebService allows use of operating systems without USB ports. So, we also provide support for many different operating systems:

With the WebService, you can even mix and match multiple operating systems to control one Phidget.


The Phidget Library give the option of using software events, rather than just reading values.

With events, you can let the data come to you as it changes:

This allows clean integration with GUI programs, which are usually already event-driven.


The library also includes support for using (and distinguishing between) more than one Phidget in your code - even the same type of Phidget.

This is usually done by reference to the unique serial number of each Phidget, as here in a Python code example:

There are other ways to do this, such as setting your own labels, or using our Phidget Manager to detect attached Phidgets.


With the combination of events, modular sensors, and network support, your system can range from simple to incredibly complex.

We encourage customers to not only build projects for themselves, but also to design and build real-world products using Phidgets. Our libraries can be distributed with your code to your customers.

And this can all occur with the same devices, and the same flexible software API.

Want to learn more? Check out our:

Questions? Please contact us.