background image

26

1072_0_Product_Manual - February 24, 2011 2:52 PM

Advanced User’s Guide

This section describes use of the PhidgetSBC outside of the web configuration, and basic opening of Phidgets over 

the network. This includes custom applications, SSH, customizing the system, etc. It is recommended that you have 

some experience with Linux before trying some of these tasks.

Custom Applications

The PhidgetSBC supports custom user application written in either Java or C. Custom applications are set up and 

managed using the configuration interface.

Custom applications are created under the /usr/userapps/(application name) directory and contain all application 

files. This must include at least the executable file.

Note that custom applications should not try to get user input, as stdin is closed before the application gets run.
If your application writes important information to disk, make sure to call sync - otherwise data may be lost in an 

unexpected reboot.

Java

First, install ‘libphidget21-java’ via ‘apt-get install’, or Install ‘Java Support’ via the ‘System: Packages’ web interface 

page.
Java applications can be compiled on a separate development machine, where they can also be tested before 

deployment. When coding, make sure to include the correct version of phidget21.jar file as part of the environment. 

You can use the link under Projects: Projects page in the configuration interface to ensure that your Java program is 

synchronized with the version of phidget21 on the PhidgetSBC.  When using Java packages, make sure to create the 

appropriate directory for them. 

The PhidgetSBC also supports .jar files and you may find it easier to compile an upload a .jar instead of the all the 

necessary .class files. When your project is completed we recommend to compile the project as a .jar. This reduces 

the number of extra flies created into a single package that is easier to manage and can be executed from the 

command line, or even by double clicking the file if you operating system environment is configured properly.
Under the command line, you can use the jar utility from the Java SDK to package the .class and .java files.  The 

process starts by going to the directory where your program is located and creating a manifest file.  This manifest 

file tells the java jar compiler the version of the program and the name of the Main-Class which acts as the entry 

point for the application. The entry point is the class that contains the main method that is run when the program is 

started. You also want to add a line to specify the class-path which will point to the phidget21.jar file that contains 

the library for including into the jar.

Let’s assume we want to distribute our program MyProgram.java as an executable jar file.  First, compile the 

program to generate the .class files.  Now, create the manifest file MyProgram.mf which contains the following lines:

Manifest-Version: 1.0

Class-Path: phidget21.jar

Main-Class: MyProgram

NOTE: The Manifest file (MyProgram.mf) MUST have a blank line at the end.
Save the file and close it.  Create the jar by running the following command from the command line:

jar -cmf MyProgram.mf MyProgram.jar *.class

You should now have an executable jar file called MyProgram.jar that you can distribute easily as one package and 

run from anywhere very easily.  To run the executable jar file you can either type the following into the command 

line:

  java -jar MyProgram.jar

Or, you can double click the file in a visual operating system if your environment is configured properly.

Summary of Contents for 1072

Page 1: ...Product Manual 1072 PhidgetSBC2 ...

Page 2: ...Phidgets 1072 Product Manual For Board Revision 0 Phidgets Inc 2011 ...

Page 3: ...ple Program 10 Setting the Password 10 Updating the SBC 11 Testing the Phidget InterfaceKit 8 8 8 Over the Webservice 12 Viewing the Webcam 12 Rebooting Resetting the PhidgetSBC 13 Ports 14 User s Guide 14 Basic Use 14 Phidget Webservice 14 Reliability 15 Finding Phidgets on the Network 16 Configuration Web Interface 16 The Configuration Pages 17 Status System 17 Status Network 17 Status Processes...

Page 4: ...king 24 Setting up an Ethernet Connection 24 Setting up a Wireless connection 25 No DHCP Server 26 Advanced User s Guide 26 Custom Applications 26 Java 27 C C 27 Other Languages 27 Debian Packages 27 Phidget Dictionary 27 SSH SFTP 28 Custom Kernel and Filesystem 29 Recovery Upgrade System 29 Entering the Recovery System 29 Upgrades 29 Factory Reset 29 Recovery 30 Technical 30 Power Over Ethernet 3...

Page 5: ...atures 33 Programming Environment 33 Programming a Phidget 33 Architecture 33 Libraries 34 Programming Hints 34 Networking Phidgets 34 Documentation 34 Code Samples 35 API for the InterfaceKit 8 8 8 37 Technical 37 Analog Inputs 40 Digital Inputs 43 Digital Outputs 45 Using the 6 Port USB Hub 46 InterfaceKit 8 8 8 Device Specifications 47 Product History 47 Support 47 Legal Information ...

Page 6: ...ter that runs Debian GNU Linux We provide full shell access via a built in SSH server access to the full Debian package repository and all of the standard command line tools expected on a modern Linux system An integrated PhidgetInterfaceKit 8 8 8 allows you to connect devices to any of 8 analog inputs 8 digital inputs and 8 digital outputs It provides a generic convenient way to interface your PC...

Page 7: ...ey are used to measure continuous quantities such as temperature humidity position pressure etc Phidgets offers a wide variety of sensors that can be plugged directly into the board using the cable included with the sensor Here is a partial list of sensors currently available IR Distance Sensor IR Reflective Sensor Vibration Sensor Light Sensor Force Sensor Humidity Sensor Temperature Sensor Magne...

Page 8: ...ter into an appropriate outlet The red status indicator light located near the USB ports should be lit if the unit is receiving power The green LED located above the red LED indicates boot status The green LED will turn on and off once during boot and then turn back on when everything is running Other Phidgets can also be connected to the 1072 using a USB cable 6 Getting Started Guide Checking the...

Page 9: ... printed on the sticker on the back of your board Testing Using Windows 2000 XP Vista Downloading the Phidgets drivers Make sure that you have the current version of the Phidget library installed on your PC If you don t do the following Go to www phidgets com Drivers Download and run Phidget21 Installer 32 bit or 64 bit depending on your PC You should see the icon on the right hand corner of the T...

Page 10: ...l be shown If there are updates available click Upgrade All Packages to download and install them Setting the Password On your first visit to the PhidgetSBC web configuration you will need to set a password Type in your password and click on Set Subsequent visits will use the username admin and the password you chose The PhidgetSBC Info is displayed ...

Page 11: ...om sensor to sensor Check that the box labelled 1 Attached contains the word True Test the digital output by clicking 2 on the white box to turn on the LED Clicking again will turn the LED off The bottom row shows the status of the request while the top row displays the status of the digital output as reported by the device Test the digital input by 3 disconnecting the wire end connected to the di...

Page 12: ...tivity and the green status LED will turn off The reboot is done when all LEDs come back on in about 25 seconds To reset the firmware press and hold the button for 10 seconds until the green status LED begins to blink then release Both Ethernet Port LEDs will turn off yellow connectivity green activity for 80 seconds the green status LED will then turn off then all LEDs will come back on in 20 sec...

Page 13: ...ing properly The green LED indicates boot status The green LED will turn on and off once during boot and then turn back on when everything is running This will reboot the board if pressed once Note that this is a forced reboot Any user programs that were 4 running may leave their data in a inconsistent state but this is safe for the base system A soft reboot can be performed remotely from the conf...

Page 14: ...dget over the network is nearly the same as opening one locally The main differences are Different open calls that include server information New calls OpenRemote and openRemoteIP naming depends on language Access to Webservice based properties Server hostname port and ID Access to server connect and disconnect events and network error events Phidgets can be opened by more then one separate applic...

Page 15: ...ets on the Network Any Phidgets attached to the PhidgetSBC can be identified using the Status Phidgets page in the configuration interface and should be seen on the network through the Webservice The Phidget Control Panel has a Bonjour tab under WebService Bonjour that lists all detected network attached Phidgets The Phidgets connected to the PhidgetSBC should be seen here and can be opened by dou...

Page 16: ...nnot be left blank After setting a password you can log onto the configuration page with user name admin and the password you chose From here you have the option to view the system information and status configure network settings start the ssh server set up custom applications and manage files or view connected webcams A breakdown of each function is provided in this manual At this point you may ...

Page 17: ...getSBC Other Phidgets including the integrated InterfaceKit use a serial number to identify themselves Filesystem All mounted filesystems are listed along with their size and usage Memory Memory usage is shown Wired active memory is shown in red and cached inactive memory is shown in blue Status Network See Network Status Status Processes This lists all running processes along with their Process I...

Page 18: ...ngs DNS can be set up automatically if DHCP is enabled Under manual settings up to two DNS servers can be specified Note that DNS settings are system wide and will apply to all interfaces SSH Server This is where the SSH server can be enabled or disabled Enabling SSH for the first time can take several minutes as the keys are generated Network Wireless Wireless networking is supported via a USB wi...

Page 19: ...t of all detected Phidgets connected to the PhidgetSBC This includes the integrated PhidgetInterfaceKit and displays both the serial number and version Phidgets Webservice The Phidget webservice is a simple server that allows Phidgets connected to the PhidgetSBC board to be opened over the network This is enabled by default and starts with the SBC The webservice also exposes a key value dictionary...

Page 20: ...m is currently executing Delete applications using the red X near their name You can click on the application name to launch the application page Create new app This button creates a new application space using the input field for its name Free space remaining on userspace partition The amount of free space remaining on the user partition in bytes Application page Start Stop This button is for sta...

Page 21: ...d Disabled Enable or disable the webcam streaming video Video streaming can consume a lot of bandwidth depending on the settings used Resolution The resolution of the capture in pixels Only resolutions supported by the webcam are listed Framerate The transmission frame rate of the capture Available frame rates will depend on the selected resolution Port The port that the video stream is sent to Pa...

Page 22: ...d from deletion but it is still easy to break the system by editing deleting files File upload is limited to a filesize of 5MiB File Directory permission owner group and creation time information is available by hovering over the file directory icon System Backup Restore This is where the system can be backed up to disk and restored This also allows access to the recovery upgrade system Note that ...

Page 23: ... Before installing these package sets enable Include full Debian Package Repository and Refresh available packages otherwise the needed packages won t be available and the install will fail Java Support This installs libphidget21 java and default jre headless to support Java based projects C C Development Tools Headers This installs build essential which allows for on board development in C C Sett...

Page 24: ... address would be used The default name for the PhidgetSBC is phidgetsbc so phidgetsbc local would be its mDNS hostname If you have more than one PhidgetSBC on the network their host name will appear like phidgetsbc local phidgetsbc 1 local phidgetsbc 2 local etc They will also be given the server ID usually similar to the host name as phidgetsbc phidgetsbc 1 phidgetsbc 2 etc If you use Bonjour an...

Page 25: ...ult and link local addresses should work Windows With Bonjour installed link local addresses should work Linux These routes need to be added where eth0 is your primary interface route add net 169 254 0 0 netmask 255 255 0 0 dev eth0 metric 99 route add default dev eth0 metric 99 For more information visit http developer apple com qa qa2004 qa1357 html Even with Bonjour installed you may have to do...

Page 26: ... a jar instead of the all the necessary class files When your project is completed we recommend to compile the project as a jar This reduces the number of extra flies created into a single package that is easier to manage and can be executed from the command line or even by double clicking the file if you operating system environment is configured properly Under the command line you can use the ja...

Page 27: ...pository on the System Packages page Editing the Apt sources list files by hand is not recommended as these may be overwritten during boot For an overview of apt get and dpkg see the Debian documentation Phidget Dictionary Communication between a custom application on the PhidgetSBC and the outside world can be facilitated by using the dictionary interface of the Phidget Webservice The dictionary ...

Page 28: ...Recovery Upgrade system Custom filesystem can be flashed from the Recovery Upgrade system The creation of custom filesystems is not documented as the Debian package repository should provide enough flexibility for most users However if you need to create a root filesystem image use the following settings Filesystem type is UBIFS Commands to create it 1 mkfs ubifs m 2KiB e 126KiB c 4050 r ROOTFS sy...

Page 29: ...fs kernel from Phidgets Phidgets will not be creating these images with every release of phidget21 as we did with PhidgetSBC1 rather they will be released several times a year as needed for major changes not easy to push out via packages You can also flash your own custom kernel or root filesystem image Factory Reset This restores the kernel and root filesystem from backup overwriting any changes ...

Page 30: ...to date with the latest releases The root filesystem is created using Buildroot and is mounted in a 460MB nand partition using the UBIFS filesystem in Read Write mode Configuration data is located at etc webif This is where all configuration that can be set through the website is located User applications are stored in usr userapps each is their own directory The kernel is stored on bare Nand in i...

Page 31: ...and line arguments checks that the kernel image is valid and boots it 4 Linux boots bringing up USB Networking NAND etc and then mounts the rootfs NAND partition on 5 init gets run as the parents of all processes as uses the etc inittab script to bring up the system This includes mounting other filesystems settings the hostname and running the scripts in etc init d among other things 6 inittab the...

Page 32: ...he PhidgetSBC Be very careful when modifying the u boot partition If it is damaged or overwritten it is difficult to fix Refer to U Boot documentation here http www denx de wiki DULG Manual for more information on using U Boot SBC2 Device Specifications Characteristic Value CPU Samsung S3C2440 Core ARM920T CPU Speed 400MHz Nand size 512MB SDRAM 64MB Boot time 30 Seconds Ethernet 10 100baseT USB 6 ...

Page 33: ... like sensors motors motor controllers and interface boards All you need to know is how to program We have developed a complete set of Application Programming Interfaces API that are supported for Windows Mac OS X and Linux When it comes to languages we support VB6 VB NET C NET C C Flash 9 Flex Java LabVIEW Python Max MSP and Cocoa Architecture We have designed our libraries to give you the maximu...

Page 34: ...so makes it possible to communicate with other applications that you wrote and that are connected to the PhidgetWebService through the PhidgetDictionary object Documentation Programming Manual The Phidget Programming Manual documents the Phidgets software programming model in a language and device unspecific way providing a general overview of the Phidgets API as a whole You can find the manual at...

Page 35: ...SensorValue The valid range is 0 4095 Note however that the analog outputs on the Interface Kit 8 8 8 are only 10 bit values and this value represents an oversampling to 12 bit double SensorChangeTrigger int SensorIndex get set Returns the change trigger for an analog input This is the amount that an inputs must change between successive SensorChangeEvents This is based on the 0 1000 range provide...

Page 36: ...Phidget It is recommended to explicitly set Ratiometric when the Interfacekit is opened After changing the ratiometric state wait until the ratiometric property matches what was set before reading analog data Events OnInputChange int InputIndex bool State event An event that is issued when the state of a digital input changes OnOutputChange int OutputIndex bool State event An event that is issued ...

Page 37: ...or Molex 70553 0002 3 Position Right Angle PCB Connector Gold Molex 70553 0037 3 Position Right Angle PCB Connector Tin Molex 15 91 2035 3 Position Right Angle PCB Connector Surface Mount Note Most of the above components can be bought at www digikey com Electrical The maximum total current consumed by all Analog Inputs should be limited to 400mA The analog measurement is represented in the softwa...

Page 38: ...ange the data rate for each Analog Input from 1 millisecond to 1 second By default the analog input data set is sent to the PC every 8ms If for example you set the data rate to 1ms you will receive a packet containing 8 miliseconds worth of 1 ms samples every 8ms For values less than 8 ms the data rate sets the sampling rate not the transmission rate When the Data rate is set at a multiple of 8 ms...

Page 39: ...ges up to 200 Amps Allegro A1300 series Linear Hall Effect Sensors to detect magnetic fields Analog TMP35 TMP36 TMP37 Temperature Sensor Panasonic AMN series Motion Sensors Honeywell FS01 FS03 Small accurate Piezo resistive load cells AllSensors Europe BARO A 4V Barometric Pressure Sensor 600 to 1 100 mbar Note Most of the above components can be bought at www digikey com 2 3 20pF 1K 1M V ANALOG G...

Page 40: ...terminal block next to Digital Input 7 Functional Block Diagram The digital inputs have a built in 15K pull up resistor By connecting external circuitry and forcing the input to Ground the Digital Input in software will read as TRUE The default state is FALSE when you have nothing connected or your circuitry switch etc is not pulling the input to ground Using the Digital Inputs Here are some circu...

Page 41: ... Digital Input INPUT GROUND Phidget Digital Input 100nF 15K 15K 5V 5V INPUT GROUND INPUT GROUND USER SW I T C H W iring a sw itch to a Digital Input Phidget Digital Input x1 LICATION Phidget Digital Input switch causes digital input to report TRUE Detail of Digital Input Q1 Detecting an external Voltage w ith an NPN Transistor Collector Emitter Current 270uA causes Digital Input to report TRU Coll...

Page 42: ...75k Ohms causes Digital Inp FSR Resistance rising above 75k Ohms causes Digital Input This design can be used w ith any variable resistance sensor Q1 Detecting an external Voltage w ith an NPN Transistor Collector Emitter Current 270uA causes Digital Input to report TRUE Collector Emitter Current 67uA guarantees Digital Input to report FALSE Drain Source Current 67uA guarantees Digital Input to r ...

Page 43: ...devices The load can also be switched with the 3052 on the high side High side switching is helpful for powering more complicated circuitry that cannot tolerate having multiple grounds Isolating a the Digital Output w ith a M OSFET Based Driving LED causes output transistors to turn on Can often be used to control AC or DC Driving an LED w ith the Digital Output USER APPLICATION USER APPLICATION V...

Page 44: ...PLICATION VS3 Q1 VS1 Load The Load can also be sw itched with the SSR on the high side OUTPUT GROUND Phidget Digital Output Q1 250 5V Detail of Digital Output TRUE FALSE 5V OUTPUT GROUND Isolating a Digital Output w ith a Optocoupler Driving LED causes output transistor to sink current Maximum current through transistor w ill depend in part on the transf er characteristics of t Be conservative and...

Page 45: ... to handle traffic from Phidgets an added benefit is lower power consumption Chaining the USB Hubs The 1072 follows USB specifications and can be daisy chained to the maximum hub depth of 4 Q1 250 5V Detail of Digital Output TRUE FALSE 5V OUTPUT GROUND Isolating a Digital Output w ith a Optocoupler Driving LED causes output transistor to sink current Maximum current through transistor w ill depend...

Page 46: ... Inputs Impedance 900K ohms 5V Reference Error Max 0 5 Update Rate 1000 samples second max for 4 channels 500 samples second max for all 8 channels 62 5 samples second max over webservice Digital Inputs Pull Up Resistance 15K ohms Low Voltage True 1 25V Max High Voltage False 3 75V Min Maximum Voltage 15V Update Rate 125 samples second Recommended Wire Size 16 26 AWG Wire Stripping 5 6mm strip Dig...

Page 47: ...e see the Phidgets End User License It is available on our website at http www phidgets com documentation Licenses Phidgets_End_User_License_Agreement pdf By using this product you are agreeing to be bound by the terms and conditions set forth by this licensing agreement Support Call the support desk at 1 403 282 7335 9 00 AM to 5 00 PM Mountain Time US Canada GMT 07 00 or E mail us at support phi...

Reviews: