Display Pmod TMP2 Data with WaveForms (Under Construction)

Under Construction

}

===== Introduction =====

This project contains a script that graphs temperature data from a Pmod TMP2 on the WaveForms Oscilloscope.

The script communicates with the Pmod using the I2C protocol and collects up to 500 data points. In addition to displaying the temperature data over time, the script calculates and plots the instantaneous rate of change.

The script uses the WaveForms Protocol Analyzer to perform an I2C Read operation to the Pmod's address, setting the 0x00 register as active. The Pmod TMP2 reports the temperature as 13-bits, with the MSB signifying the sign (+/-) of the value. Since the data is transferred as 2 bytes, some bit shifting is required to convert the numbers into a usable form.

The Power Supplies are used to feed power to the pull-up resistors required by the I2C protocol.

Please read the [[reference:pmod:pmodtmp2:reference-manual]] for more information about the Pmod.

===== Inventory =====
  * WaveForms
  * Analog Discovery (Legacy)
  * Analog Discovery 2
  * Pmod TMP2
  * Two 1 kΩ to 100 kΩ pull-up resistors
  * {{ :reference:test-and-measurement:analog-discovery-2:display-pmod-tmp2-data:display-pmod-tmp2-data.zip |ZIP Archive with WaveForms Workspace


Setup Instructions

1. Hardware Setup

This script requires that a Pmod TMP2 be connected to the Analog Discovery DIO pins in the following order:

DIO Pin Pmod Pin
DIO-0 SCL
DIO-1 SCA
GND GND
V+ VDD

Place one resistor each between VDD, SCL, and SCA.

Leave all the jumper pins open.


2. Software Setup

Make sure to download and extract the ZIP archive linked in the Inventory section, above. Open the “temp.dwf3work” workspace in WaveForms. When selecting the device in the Device Manager dialog, be sure that configuration #4 is selected.

If another address needs to be set with the Pmod's J1 or J2 pins, change the address in the command on line 13 of the script as below:

data = Protocol.I2C.Read( {NEW ADDRESS} ,2,[0x00])


3. Running the Script

Once the workspace loads, press the Run button in the Script window (or press F5 on the keyboard). The Analog Discovery will start communicating with the Pmod and streaming the data through the oscilloscope.

Note: Due to the script not handling cases where an I2C transaction is not acknowledged, running the script without hardware plugged in is not recommended, as it may put the application into a difficult-to-exit blocking state.

Note that the Oscilloscope view launches in a separate window from the script, supplies, and Protocol Analyzer.

The red line is the temperature on a scale of 0-150 °C (the units are shown as V), the cyan line is the rate of change. Typical room temperatures are around 25 °C (77 °F), so the script editor's Output window should be showing values around that number. Try blowing hot or cold air on the Pmod to see the temperature readings change.


4. Stopping the Script

When finished using the script, press the “Stop” button in the Script window (or F6 on the keyboard) and the “Master Enable is On” button in the Supplies window.

Note: Stopping the script may require a few rapid clicks because the system is busy every 0.05 seconds, thus blocking inputs. The F6 key reliably stops the script.


Final Notes

For more guides and example projects for your Test and Measurement device, please visit its Resource Center, which can be found through this wiki's Test and Measurement page.

For more information about how to use the Pmod TMP2 featured in this demo, please visit its Resource Center.

For technical support, please visit the Digilent Forums.