Temperature Strip Chart
In this activity you will use a Custom Control called a Strip Chart
which visually displays a sensor's output in real time as a moving
Graph. You need to make sure the Strip Chart controled is installed on
- Phidget IFKit 888
- Precision Temperature Sensor
Plug the temperature sensor into Analog Input port 0. Plug the 888
Interface kit into the computer via a USB cable.
Create the Graphical User Interface
Note: Save your project at frequent intervals!
Run Visual Basic 6. Select a Standard Exe.
- Draw a Frame on the form.
- Draw the following control on the frame.
- Open the Project menu and select Components.
- Scroll down to and select GMS Strip Chart ActiveX Control. Note: you must click the box
so that the check mark appears. Click OK
- Look at the bottom of the tool bar. A new control should be
added. Select and draw the strip chart on the frame. Note: If you
get a permission denied error, an administrator has to log in and do
the exact same steps once. Then it will work for everyone else using
Change the properties for the following:
- Caption - Temperature Monitor
- Font - Arial, 14pt, bold
- Backcolor - something appropriate
- Backcolor - You pick something!
- Trackmax - 40
- Trackmin - -50 (negative 50)
- TrackDisplayMax - 40
- TrackDisplayMin - -50
- VariableLineWidth - 3
- VariableColor - Red
Code the Interface
- You will be using the Phidget IFKit 888 therefore the Phidget
library must be referenced. Open the Project menu and select
Scroll down and check Phidget Library 2.1. Click OK.
- Open the code window. Start by selecting General...Declarations in the
small windows. Enter the following code:
Dim WithEvents kit As PhidgetInterfaceKit
- Code the Form_Load procedure:
Set kit = New PhidgetInterfaceKit
- Code the Timer1 procedure with:
temp = (kit.SensorValue(0) * 0.2222) - 61.111
Strip1.Y = temp
Text1 = temp
Test the System
Save your project. Run the program. You should see the temperature
displayed in the text box and the strip chart starting to display the
data. Warm up the sensor by touching it. You can safely cool the sensor
by using a can of compresses "air" used to clean LCD screens and
laptops. Invert the can and spray the sensor. Keep your fingers out of
the way as the temperature can reach -50C!
Take a remote temperature reading. That is, connect the phidget and
sensor to another computer on your network. You will need to know the IP
address of the computer with the Phidget and sensor attached. Also make
sure the Phidget Web Service is running on the remote computer. If you
are not an administrator, your teacher will have to do that.
Hint: The only change needed in code is in the form load procedure.
Here is an example. Let's say the remote computer has an ip address of
192.168.1.110. Modify the line:
Call kit.OpenRemoteIP("192.168.1.110", 5001)
Note: The IP address must be in quotation marks. 5001 is the default
port used by the Phidget web service.