Accurate USB temperature sensor has minimal parts

Article By : Silvio Lauckner

At the heart of this simple, accurate, and reliable USB temperature sensor is a USB-to-serial converter.

This article presents a simple, accurate, and reliable design to measure temperature using the USB. Figure 1 shows the complete circuit of the temperature-sensor device. The heart of the sensor device is an FT232RQ USB-to-serial converter from Future Technology Devices International (FTDI). In addition to using the FT232 in its default UART mode, the FT232 works in a so-called bit-bang mode (reference 1, reference 2, and reference 3). This mode changes its I/O lines into a bidirectional data bus, which the user can fully control. The connection with the USB takes place in a standard manner, and the back end of the chip interconnects to an AD7814 digital temperature sensor from Analog Devices (Reference 4).

[EDNAOL 2016JUN06 AN 01Fig1]*Figure 1: This circuit for a USB temperature sensor works in default UART and bit-bang modes.*

The temperature sensor uses a four-wire SPI but only three pins: SCK (serial clock), SS# (slave select), and SDO (serial-data out). To avoid any malfunction of the sensor, the SDI (serial-data-in) line must be grounded. The FT232 acts as an SPI master and emulates the protocol for the AD7814 by setting or clearing the appropriate port pins for SS# and SCK. The data from the sensor gets read back together with all the other bus lines. This process occurs simultaneously with the write process.
To comply with the USB specification, you power down the temperature sensor using the sleep signal while the USB logic is in suspend mode. The sensor device receives its power through the USB and draws only about 20 mA. On the software side, you need only to open the device and switch the chip into the bit-bang mode. After that action, you can send the fixed pattern to emulate an SPI master from the host PC to the FT232 (figure 2). The software returns a data array of the port samples of both the PC and the FT232, whose ports are inputs and outputs.

[EDNAOL 2016JUN06 AN 01Fig2]Figure 2: The timing diagram for the AD7814 shows considerable data overhead to download 10 bits of temperature data.

Because the FT232 chips come with a unique serial number, you can identify the correct device within a multi-chip environment. So, you can put more than one FT232-based sensor onto a computer. The core of this Design Idea is not limited to measuring temperature. You can use other sensors with digital interfaces, as well.

[EDNAOL 2016JUN06 AN 01Fig3] Figure 3: Two sample circuits (left and centre) are smaller than a USB Type A plug (right).

To get the current temperature, you must write 35 fixed bytes into the port register. The sensor expects 16 clock pulses on the SCK line while the SS# is low. The clock frequency is 1MHz. The device samples sensor-read data during the write operation. After the protocol on the back end finishes, you can retrieve the data from the host PC for further processing. To get just 10 bits out of the sensor involves considerable data overhead (figure 2). The dashed-line arrows mark the bytes, which need no further evaluation.
This Design Idea realised two sample circuits on a two-layer PCB (printed-circuit board) measuring only 18×12 mm (0.7×0.47 in.) and 7.6×30.5 mm (0.3×1.2 in.). Figure 3 shows them in comparison to the size of a USB Type A plug.

References
1. "FT232R USB UART IC," Future Technology Devices International, 2005.
2. "AN232R-01 Bit Bang Modes for the FT232R and FT245R," Future Technology Devices International, 2005.
3. "D2XX Programmer's Guide," Future Technology Devices International, 2005.
4. Analog Devices, Data sheets AD7814, ADT7301, and ADT7302.

This article is a Design Idea selected for re-publication by the editors. It was first published on May 24, 2007 in EDN.com.

Subscribe to Newsletter

Test Qr code text s ss