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

OS - Phidget SBC: Difference between revisions

From Phidgets Legacy Support
Line 125: Line 125:
==Advanced Uses==
==Advanced Uses==


===Using a different wireless adapter===
===Using a Different Wireless Adapter===




===Using a different webcam===
===Using a Different Webcam===
 
 
===Taking Pictures With the Webcam===
 


===Checking System Logs===
===Checking System Logs===

Revision as of 20:30, 23 February 2012

Icon-Linux.pngOn the Single Board Computer (SBC), Phidgets can be either plugged directly into one of the USB ports or run over a network using the Webservice.


Getting Started (Libraries and Drivers)

The SBC is a unique Phidget. It is a computer with a Linux operating system. It can compile code, save files, manage background jobs, host information over the web, and more.

To learn the basics about the SBC, we have a handy web interface to interact with the SBC. This is covered in detail on the Getting Started Guide for the SBC. So before reading this page on how to use the operating system, you should have done the following via the Getting Started Guide:

  • Set up networking on your SBC, via either Ethernet or wireless
  • Set up a password
  • Learned the IP address or link local address of the SBC

Conceivably, you could simply use the SBC like any Linux computer, and do all of your development and compiling of Phidget code on the SBC itself. In practice this is quite complicated as the SBC does not have a keyboard or screen. So usually, you will want to develop your code on an external computer and copy files and settings over to the SBC via a network. This makes this Getting Started section unique, in that we show you how to set up both computers:

Getting Started - External Development Computer

The simplest way to transfer files and commands to and from the SBC is via a program called ssh. The ssh program provides command line text access over a network into the SBC. Using it, you can run programs and give the SBC commands. The ssh program has a companion program called scp which can copy files back and forth. For Linux users, this will be familiar territory. If you are using Windows or Mac OS, and are unfamiliar with ssh, you can think of it like the command line or a Mac terminal.

Before connecting over ssh, you will need:

  • The IP address (such as 168.254.3.0) or link local address (such as phidgetsbc.local) of the SBC
  • The admin password for the SBC

Both of these items can be found by following the steps in the Getting Started Guide for the SBC.

SSH on Windows

The ssh program is not installed on Windows by default. But, there are a variety of SSH programs available for free, one simple and commonly used program being [PuTTY].

With PuTTY, when you first run the program it will ask you what to connect to. Enter the IP address or link local address of the SBC, and then click the SSH radio button right below the address, which will change the port to 22. Then click open, and you'll have an ssh connection to the SBC open in a terminal. It will prompt you for a user name (root) and password (the admin password).

To copy files back and forth, there is an SCP component to PuTTY, called PSCP, which is available from the same [PuTTY download page].

SSH on Linux and Mac OS

Linux and Mac OS already have ssh installed by default. To run ssh simply open a terminal...

  • Ctrl-Alt-T on Linux
  • Applications → Utilities → Terminal on Mac OS

...and type:

ssh root@phidgetsbc.local

If you have re-named your SBC, include that name instead of the phidgetsbc.local link address. Or, you can use the SBC's IP address, e.g. ssh root@168.254.3.0.

To copy files back and forth, the command follows the form of: scp from to

So, to copy a file /root/data.txt from the SBC to the folder that the terminal is operating in (type pwd to print the working directory if you're not sure), type:

scp root@phidgetsbc.local:/root/data.txt .

Note the use of the dot . to indicate that scp should put the file in the current local directory.

Getting Started - SBC Debian Linux

Some Useful Commands

ls

pwd


Some Useful Commands to Install

gcc

less

wget



Installing C/C++

Installing Java

Installing Python

Troubleshooting

If the examples do not work but USB does work (i.e. your computer can consistently see the device in the hardware), take a moment to check the basics:

  • No other programs, drivers, or processes are using that USB port in software
  • You are running the example program as root (or your udev rules have been set properly)
  • You are using libusb 0.1 (not 1.0 or later)
  • You have compiled versions of libphidget21.a and libphidget21.so in your system library location (usually /usr/lib)
  • The Phidget libraries are the latest version (visit the getting started section to download them)
  • Your Linux kernel version is 2.6 or later (type uname -r in a terminal to get your kernel version)
  • Check the common problems section below, some specific combinations can cause problems

If your problem doesn't seem to be fixed by these steps, make sure that the Phidget is seen consistently by USB (if it is erratic, try our general troubleshooting guide). If you are still having problems after the troubleshooting guide, please ask us!

Programming Languages

Now that you have the basic libraries installed, you can pick your language and begin programming!

If you are not using the webservice (discussed below) to control a Phidget over a network, your next step will be to delve into the use of your specific language. Each page has its own set of specific libraries, code examples, and setup instructions.

On Linux, we recommend the following languages:

Webservice

Advanced Uses

Using a Different Wireless Adapter

Using a Different Webcam

Taking Pictures With the Webcam

Checking System Logs

Common Problems and Solutions

Low Speed Phidgets (Max of 8): Linux will only schedule one low-speed interrupt transfer per millisecond.

You can find out the type of your Phidget by attaching it and then running dmesg | tail, which will display the type of Phidget from your kernel logs, as described above in the hardware section. The practical consequence of this is if your system has many low speed Phidgets attached, they will each be throttled down. Low speed Phidgets require an interrupt transfer as often as every 8 milliseconds. A Linux system could only have up to 8 of these Phidgets attached.