What is a Phidget?: Difference between revisions
No edit summary |
No edit summary |
||
Line 38: | Line 38: | ||
Other Phidgets are our: | Other Phidgets are our: | ||
* | * Sensors, which plug into an [[Phidgets Connectors|Analog Input or VINT Hub Port]] | ||
* VINT Devices | * VINT Devices | ||
* Motors, switches, LEDs, and other components | * [{{SERVER//?tier=1&catid=17&pcid=16 Motors], [{{SERVER}}/?tier=1&catid=63&pcid=56 switches], [{{SERVER}}/?tier=1&catid=60&pcid=53 LEDs], and other components | ||
* [{{SERVER}}/ | * [{{SERVER}}/?tier=1&catid=1&pcid=0 Single Board Computer] - a complete embedded computer, plus Phidget I/O. | ||
</div> | </div> |
Revision as of 18:25, 4 May 2017
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:
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 are our:
- Sensors, which plug into an Analog Input or VINT Hub Port
- VINT Devices
- [{{SERVER//?tier=1&catid=17&pcid=16 Motors], switches, LEDs, and other components
- Single Board Computer - a complete embedded computer, plus Phidget I/O.
Data and control flows up and down the USB connection:
File:Wiap-image3.pngFile:Wiap-vintFlow.png
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 a VoltageInput()
for the sensors attached to an Interface Kit, or a RFID()
for an RFID reader, for example.
We provide support for many different languages to program in:
Core Languages | Mobile Languages | Other Languages |
C# | Objective C | LabVIEW |
C/C++ | Swift | Max/MSP |
Python | ||
Java | ||
Visual Basic .NET | ||
JavaScript |
You can visit the Software Overview page for more information on the supported programming languages.
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 to read the the value of a sensor connected to an Interface Kit might look like this:
#include <stdio.h>
#include <phidget22.h>
int main(int argc, char* argv[]) {
// A "VoltageInput" Handle; the name we use to access properties and methods of the channel
VoltageInput vin;
// Our Sensor's voltage Reading
int sensorVoltage;
// Create a new VoltageInput object
vin = new VoltageInput();
// Set the channel to the port the sensor is plugged into on the InterfaceKit
vin.Channel = 0;
// Open and attach the Phidget, waiting 5 seconds before timeout
vin.Open(5000);
// Read Sensor on Port 0
sensorVoltage = vin.Voltage;
printf("Hello World! My channel 0 sensor reads %d volts.\n", 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.
Our software libraries are modular. A VoltageInput
software object, 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 multiple of these objects. For example, the 1018 Phidget InterfaceKit uses five distinct objects:
The Phidget Common
object 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 objects 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
object which is just like the one for the 1018 Phidget InterfaceKit:
Not only can you control a Phidget locally, but we also provide a tool called the Phidget Network Server.
The Network Server allows you to control a Phidget over your local network:
This allows your to use more than one computer, or even a smartphone:
File:Network server general pctoandroid.png
The Network Server also includes the Phidget Dictionary, which is a central place to store your data in a distributed application.
Your Phidgets program can run under any of the major operating systems. With the Network Server, you can even use operating systems that don't normally have USB ports, such as Android and IOS:
Desktop OSes | Mobile/Wireless OSes |
Windows | Phidget SBC |
OS X | Android |
Linux | iOS |
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 Android tablet.
The Phidget Library gives 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:
- Products on our main website
- Languages and Operating Systems
- Example Projects and Articles
- In-depth hardware information
Questions? Please contact us.