DLP-TEMP-G USB / Data-Acquisition Module NOW LEAD-FREE Features: • • • • 3 Digital I/Os, 3 Analog Inputs (0-5 Volts) or any combination USB 1.1 and 2.0 Compatible Interface 4th Generation Silicon from FTDI Supports Up To 3 Digital Temperature Sensors Applications: • • Data Acquisition Temperature Monitoring INTRODUCTION The DLP-TEMP-G is a USB/microcontroller based 3-channel data-acquisition system preprogrammed with firmware for digital I/O or reading digital temperature-sensing devices. The DLP-TEMP-G board is equipped with a Type A male USB connector for direct connection to a USB port. No cable is required unless the board is to be located away from the PC, in which case a user supplied USB A-A (male-female) extension cable can be used. The digital temperature-sensing device supported is the Dallas Semiconductor DS18B20. Three of these sensors can be monitored simultaneously while connected to the DLP-TEMP-G via Category 5 cable at distances up to 200 feet. (For instruction on how to connect the sensors to the DLP-TEMP-G via Category 5 cable, refer to the Application section of this document.) All power for the DLP-TEMP-G’s circuitry and DS18B20 temperature sensors is taken from the USB port so no external power source is required. 1 The microcontroller used is the PIC12F683, 8-pin, Flash-based microcontroller from Microchip. As mentioned above, the 12F683 is preprogrammed for analog voltage measurement and for reading the digital temperature sensors, but it can also be erased and reprogrammed with user code if desired. Reprogramming the micro requires a user-supplied device programmer. (Refer to the schematic at the end of this document for the pin out of the programming header.) The microcontroller uses a single port pin and a pull-up resistor to communicate with each digital temperature sensor. Refer to the DS18B20’s datasheet for a complete description of its communications protocol. The firmware for the DLP-TEMP-G was written in C and can be downloaded from dlpdesign.com. USB INTERFACE The USB interface was implemented using the FT232RL USB-UART IC from FTDI. This device connects to the host computer via the Type A USB (male) connector and supports the 8 standard RS232 serial signals. Only the TX and RX signals are used on the DLP-TEMP-G board and are all that is required to form a serial connection to the host computer. Since handshaking is not used in this design, the firmware in the 12F683 processor must be ready to accept all incoming serial data from the host computer or the data will be lost. In order for the DLP-TEMP-G (and FT232RL) to receive incoming serial data from the host, FTDI’s VCP (Virtual Com Port) drivers must be installed. The driver installation process is initiated by simply plugging the DLP-TEMP-G into a USB port. The driver installation wizard will prompt for the location of the drivers files (in a folder or on a floppy) and will copy the required files to the proper destination such that the next time the board is connected the driver files will be automatically loaded without prompting the user. The VCP driver files can be downloaded for free from dlpdesign.com or ftdichip.com. Once the drivers are loaded and the com port number for the DLP-TEMP-G is set in Device Manager, the application program running on the host simply opens what it thinks is an RS232 port (9600, N, 8, 1) and begins communicating with the 12F683 microcontroller. COMMUNICATIONS PROTOCOL For this design, a rather simplistic protocol was selected in an attempt to present the design in as basic a way as possible. Single-byte commands are used to communicate with the 12F683 microcontroller. The following table shows the command list: COMMAND 12F683 Response R (read and convert) Send back 18 bytes of data from the sensors and start another temperature conversion in both sensors. Provided as legacy support for compatibility with the original DLP-TEMP. P (ping) Echo the letter ‘Q’ back to the host. Provided as legacy support for compatibility with the original DLP-TEMP. S Read temperature sensor at S1, return data and convert 2 T Read temperature sensor at S2, return data and convert U Read temperature sensor at S3, return data and convert A Setup S1/AN2/GP2 for analog, read voltage and return 2 bytes B Setup S2/AN0/GP0 for analog, read voltage and return 2 bytes C Setup S3/AN3/GP4 for analog, read voltage and return 2 bytes Example host voltage read code: //declare tx[] and rx[] buffers tx[0] = 'A'; PutBuffer(tx, 1);//send tx out serial port – substitute your serial port code here GetBuffer(rx, 2, timeout); //again, substitute your serial port code here Int temp = rx[1] | (rx[0] << 8);//convert returned data float actual_voltage = temp/1024.0*5.0); M Setup S1/AN2/GP2 for digital and read state - return 1 byte N Setup S2/AN0/GP0 for digital and read state - return 1 byte O Setup S3/AN3/GP4 for digital and read state - return 1 byte J Setup S1/AN2/GP2 for digital, and set high K Setup S2/AN0/GP0 for digital, and set high L Setup S3/AN3/GP4 for digital, and set high G Setup S1/AN2/GP2 for digital, and set low H Setup S2/AN0/GP0 for digital, and set low I Setup S3/AN3/GP4 for digital, and set low APPLICATION The DLP-TEMP-G can be used to monitor temperature at the board or at a distance from the board. The board supports monitoring of two temperatures. If more than two temperature measure-ments are required, then the DLP-TEMP9 can be used to monitor/measure up to nine temperatures. The board comes with one sensor that is not soldered to the board so that the user has the option of locating the sensor at a distance from the board using Category 5 cable. This design has been successfully tested with both sensors located 200 feet away from the board using Category 5 cable. Two pairs of wires in the Category 5 cable are required for the connection. One pair is for power and ground, and the other pair is for data and ground. If using both sensors, you can either connect them to the board using one cable for both sensors since the cable has 4 pairs, or 2 cables if the sensors are to be placed in different locations. 3 DISCLAIMER Neither the whole nor any part of the information contained within or the product described in this datasheet may be adapted or reproduced in any material or electronic form without the prior written consent of the copyright holder. This product and its documentation are supplied on an as-is basis, and no warranty as to their suitability for any particular purpose is either made or implied. DLP Design will not accept any claim for damages whatsoever arising as a result of use or failure of this product. Your statutory rights are not affected. This product or any variant of it is not intended for use in any medical appliance, device, or system in which the failure of the product might reasonably be expected to result in personal injury. This document provides preliminary information that may be subject to change without notice. CONTACT INFORMATION DLP Design, Inc. 1605 Roma Ln. Allen, TX 75013 Phone: 469-964-8027 Fax: 415-901-4859 Email: [email protected] Internet: http://www.dlpdesign.com 4 C1 .01 5 1 4 USBVCC C2 10/10 Tant PWREN# SWVCC C3 47pF 3 USBVCC Q1 IRLML6402CT P R10 360 C5 47pF RXD TXD 1 8 20 16 15 8 19 24 27 28 17 2 CBUS0 CBUS1 CBUS2 CBUS3 CBUS4 TXD RXD RTS# CTS# DTR# DSR# DCD# RI# 23 22 13 14 12 1 5 3 11 2 9 10 6 DLP-TEMP Version 2.1 U2 SWVCC VCC5 IN USBDM USBDP Vpp Clock Vcc Gnd Data VCCIN/NC RESET# AVCC/NC OSCI OSCO 3V3OUT FT232R SWVCC .1uF C7 .1 C10 JP2 1 2 3 4 5 PROGRAMMING HEADER 2 4 2 FB1 240-1018-1 USB Type A Male Connector R11 1.5K U4 PIC12F683 VCC GND TXD RXD SWVCC 3 VCCIO AGND GND GND GND TEST 25 7 18 21 26 CN1 1 2 3 4 C6 .47uF 3 2 1 2 3 OSC1 OSC2 R7 1.5K 4 R9 1.5K GP3/Vpp SWVCC JP4 DS18B20 / TO92 Sensor 3 12MHz 3 2 1 3 2 1 SWVCC JP1 DS18B20 / TO92 Sensor 1 JP3 DS18B20 / TO92 Sensor 2 4 6 D C B A 5 GP0/PGD 7 GP1/PGC GP2 5 R5 360 1 TXD (From host ->) RXD (To host <-) 12MHz PWREN# SWVCC 1 D1 LED D C B A