But to say they are “simply” an interface is perhaps too simplistic and misses where I think the real power of phidgets lies. The name phidgets is a mash-up of physical and widgets. Physical as in physical computing, meaning a way to interface with computers in more natural ways than keyboards, mice, and monitors. Widgets being a shorthand for graphical control element of graphical user interfaces (GUI), such as onscreen buttons or checkboxes.
Unlike an Arduino, phidgets do require a computer to work. Thankfully single board computers such as the Raspberry Pi are quite capable of handling phidgets and preserve the small form factor we’ve come to expected for our embedded electronics projects. At this point I should also point out for those interested in a having a wider range of hardware options that there are general interface kits that provide digital I/O and analog inputs.
Now, as a hardware a guy, it took me a bit to get my head wrapped around having to call on rather robust API calls to control hardware as compared to my microcontroller work. But once I did get my head wrapped around, I really enjoyed it. Especially for projects that need the computing power of a Raspberry Pi or greater, while still have physical world interfaces.
Below is a piece of sample code I wrote/mashed together to control a servo and read from an analog slider. It also let me get my feet wet with Tkinter to produce a basic GUI. In short, the code has these 5 major sections:
- Import Python and Phidget libraries
- Define GUI parameters, if you want a Tkinter GUI
- Define functions to handle I/O and GUI interactions
- Setup and initialize Phidgets
- Main loop for your GUI
I really like the exception handling aspects of Phidgets and the able to hot swap phidgets once your app is running. You can find the code below and at my GitHub page (https://github.com/geekcowboy/TkServo)
In summary, if you need a quick, computer-based physical computing project with a GUI try out Phidgets and Raspberry Pi. You might be surprised at what you can accomplish.