What is a Phidget?

From Phidgets Support
Revision as of 19:58, 27 June 2017 by Patrick (talk | contribs)


Introduction

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


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:



Last but not least, a Phidget may be a VINT Hub, whose versatile ports can be used as inputs or outputs, and can also connect to smart VINT devices.



Other Phidgets and products we sell include:

Data Flow

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.

Software Channels

Our software libraries are modular. A VoltageInput channel class, for example, has functions you can use to control and read the Voltage Input, such as setting the data interval or reading the voltage:



The API for each Phidget contains one or more of these channel classes. For example, the 1018 Phidget InterfaceKit uses five distinct channels:



The Phidget Common class contains basic functions like open() and close() and is used by every Phidget. It's the same no matter what Phidget you're using. The other classes will also contain largely the same functions, properties, and events across different Phidgets, although there may be minor differences which are explained in the API manual. For example, the 1024 PhidgetRFID Read/Write has a DigitalOutput class which is just like the one for the 1018 Phidget InterfaceKit:


Programming

Using Phidgets means writing code. We provide support for many different languages to program in:

Core Languages Mobile Languages Other Languages
C Sharp C# Objective C Objective C LabVIEW LabVIEW
C/C++ C/C++ Swift Swift Max/MSP Max/MSP
Python Python
Java Java
Visual Basic .NET Visual Basic .NET
JavaScript JavaScript

Your Phidgets program can run under any of the major operating systems.

Desktop OSes Mobile/Wireless OSes
OS - WindowsWindows OS - Phidget SBCPhidget SBC
OS - LinuxLinux OS - iOSiOS
OS - OS XOS X

With the Network Server, you can even mix and match multiple operating systems to control one Phidget. For example, you could connect your Phidgets to a PhidgetSBC running Linux, and control it over the Network Server using an iPad running iOS.

You can visit the Software Overview page for more information on the supported programming languages and operating systems.

Within your code, you can create a software channel that connects to a channel on the Phidget and use our API to control and read data from that channel. The software channel might be a VoltageInput for the sensors attached to an Interface Kit, or a RFID for an RFID reader, for example.

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



You can open a channel on the device and then poll it for data or set up an event handler to process data as it comes in.




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

A simple, stripped-down program in C# to read the the value of a sensor connected to an Interface Kit might look like this:

using Phidget22;

int main() {
    // A "VoltageInput" Handle; the name we use to access properties and methods of the channel
    VoltageInput vin;

    // Create a new VoltageInput channel
    vin = new VoltageInput();
    
    // Set the channel to the port the sensor is plugged into on the InterfaceKit
    vin.Channel = 0;

    // Open the channel, waiting up to 5 seconds for attach
    vin.Open(5000);

    // Read Sensor on Port 0
    double sensorVoltage = vin.Voltage;

    System.Console.WriteLine("My channel 0 sensor reads " + sensorVoltage);

    // Close
    vin.Close();
    return (0);
}

The Phidget library includes powerful logging and error checking not shown in this brief program. To see some full-featured example programs, check the downloads section for the language of your choice.

Network Server

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

The Network Server exports your Phidget's channels over your local network:

NetworkServer PhidgetServer.jpg

This allows other computers on your network to control the Phidget or read data from it. The network server isn't limited to desktop computers- it can also be used with phones or Single Board Computers that are running Phidgets code.


The Network Server also includes the Phidget Dictionary, which is a central place to store your data in key-value pairs.

Further Reading

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.