USBTenki: USB Temperature sensors and more

Project Overview

What is it?
USBTenki is an electronic project to interface sensors to an USB port for collecting weather related data such as temperature. The firmware supports many different sensors and interfaces. It is up to you to decide what your USBTenki will support.

Hourly graphics generated from data collected using this project are available at

Project history and motivation:
This project - named USBTenki, from the japanese word 'tenki' 天気, which is pronounced ten-kee and means weather - was created because a friend needed an USB temperature sensor. A short time later, I got a requset for a temperature + humidity sensor, so I added support for such a sensor. Then, just for fun, I added an absolute pressure sensor which is able to report the atmospheric pressure. I plan to add support for more types of sensors, such light, lightning detection, wind speed and wind direction.

You can consult the list of supported sensors in the 'Supported sensors, wiring and firmwares' section below.

goto top Up


Temperature + Relative humidity sensor using a Sensirion SHT75 sensor:

Temperature sensor using an MCP9803:

The prototype using an MCP9803 sensor:

Temperature sensor (prototype) based on the MCP9803 installed in the servers room's air conditionner:

Here are good examples of how to install a bypass capacitor near a sensor and protect the sensor using heat-shrink tubing:

Examples graphs (generated with munin plugin)
1: 2: 3: 4: 5: 6:
1Temperature, Relative Humidity and Virtual channels. Sensirion SHT75 DayIndoor Saint-basile-le-grand, Qc, Canada
2Temperature, Relative Humidity and Virtual channels. Sensirion SHT75 WeekIndoor Saint-basile-le-grand, Qc, Canada
3Atmospheric pressure MPX4115AP Day Indoor Saint-basile-le-grand, Qc, Canada
4Atmospheric pressure MPX4115AP Week Indoor Saint-basile-le-grand, Qc, Canada
5Temperature MCP9803 Day Inside a standalone air conditioner, air output A server room in Montreal, Qc, Canada
6Temperature MCP9803 Day In front of an air duct (Building's air conditionner) A server room in Montreal, Qc, Canada
Hourly graphics available at

goto top Up


Here are the schematics:

If you need a wiring diagram specific to your sensor, consult the corresponding diagram from the 'Supported sensors, wiring and firmwares' section below.
Design notes:
I started working on this project when a friend needed a simple, low-cost, computer-connected temperature sensor for monitoring a presumably unreliable air conditioning unit in a server room.

For simplicity, I decided to re-use the PCB I designed for my game controllers to USB projects. Therefore, the sensor connects to a PC using USB. For sensing the temperature, I decided to use (for the moment) digital sensors. Using digital sensors is easy, most sensors provide an acceptable precision, calibration is not required and I did not need to add additional components such as voltage references, precision resistors and operational amplifiers to my already existing board.

goto top Up

Supported sensors, wiring and firmwares

The atmega8 has to be programmed with a firmware that supports the sensor you are using. Unless otherwise noted, the fuse settings should be set to high_byte=0xC1 low_byte=0x1F.

I used Objective Development's software only USB implementation for Atmel's AVR microcontrollers, it was natural to use it again for this project. This means that again, the firmware is open-source and released under the Objective Development licence.

The source code for the firmware and host side client are distributed together. You can get both in the Host software section.

No diagram. Type: Light and Infra-redInterface: I2C
Firmware: tsl2568.hex Version: 1.8
Accuracy: 16 Bit ADC
An interesting sensor manufactured by Taos providing two channels (Infra-red only, Infra-red + Visible) with selectable gain. It is approximately 4x more sensitive than the TSL2560/1 and therefore saturates more easily when used in very bright lighting conditions. Again, illumination in lux can be calculated using the formula provided by the manufacturer (implemented in usbtenkiget and qtenki). Standard I2C wiring. The firmware expects all address pins to be wired to GND. You will need to supply 3.3 volt to this sensor and add 4.7k pull-up resistors to 3.3 volt.

No diagram. Type: Light and Infra-redInterface: I2C
Firmware: tsl2561.hex Version: 1.8
Accuracy: 16 Bit ADC
An interesting sensor manufactured by Taos providing two channels (Infra-red only, Infra-red + Visible) with selectable gain. Illumination in lux can be calculated using the formula provided by the manufacturer (implemented in usbtenkiget and qtenki). Standard I2C wiring. The firmware expects all address pins to be wired to GND. You will need to supply 3.3 volt to this sensor and add 4.7k pull-up resistors to 3.3 volt.

No diagram. Type: TemperatureInterface: I2C
Firmware: adt7410.hex Version: 1.8
Accuracy: ±0.5°C from -40°C to +105°C
Highly accurate temperature sensor manufactured by Analog devices. Wire it as you would any I2C sensor (SCL and SDA, appropriate decoupling and supply). The firmware will auto-detect the I2C address so wire the address pin according to your preference.

No diagram. Type: TemperatureInterface: I2C
Firmware: se95.hex Version: 1.8
Accuracy: ±1°C from -20°C to +100°C
A fairly accurate I2C Temperature sensor manufactured by NXP Semiconductors. Wire it as you would any I2C sensor (SCL and SDA, appropriate decoupling and supply). The firmware will auto-detect the I2C address so wire the address pin according to your preference.

Wiring diagram:
Type: Temperature and Relative HumidityInterface: Serial (similar to I2C, but not compatible)
Firmware: sensirion.hex Version: 1.1
Accuracy: ±0.3°C @ 25°C and ±1.8% RH
This is a very precise two-in-one sensor manufactured by sensirion which outputs 14 bits of temperature data and 12 bits of relative humidity data. It is so sensitive that using the sensor more than 10% of the time will raise it's temperature by 0.1°C. Note that sensirion's temperature/humidity sensors all use the same protocol so this firmware can be used with other sensors such as the SHT11.

Wiring diagram:
Type: Temperature and Relative HumidityInterface: Serial (similar to I2C, but not compatible)
Firmware: sensirion_pc23.hex Version: 1.8
Accuracy: ±0.3°C @ 25°C and ±1.8% RH
Same as above, but this firmware uses PORTC pins 2 and 3 instead 4 and 5. Useful if you need to use real I2C sensors at the same time or need PC4/PC5 for something else.

Wiring diagram:
Type: Temperature and Relative HumidityInterface: I2C
Firmware: cc2.hex Version: 2.1
Accuracy: ±0.3°C @ 25°C and ±2.0% RH
An economical substitute to the SHT75. Identical wiring, but the protocol is standard I2C.

Wiring diagram:
Type: TemperatureInterface: I2C
Firmware: mcp9800.hex Version: 1.1
Accuracy: ±0.5°C (typ.) at +25°C, ±1°C (max.) from -10°C to +85°C, ±2°C (max.) from -10°C to +125°C, ±3°C (max.) from -55°C to +125°C
A good temperature sensor with 12 bit output. It's accuracy is much better than the LM75. In order to be detected by the firmware (without modifications), all 3 address pins must be connected to VCC. This allows for easier wiring. Installing a small capacitor near the sensor is a good idea.

LM75 (and compatibles)
Wiring diagram:
Type: TemperatureInterface: I2C
Firmware: lm75.hex Version: 1.1
Accuracy: ±2°C (max) from -25°C to +100°C, ±3°C (max) from -55°C to +125°C
This is a standard and easy to find sensor. In fact, many sensors are compatible with the LM75 but support additional functionalities and/or resolution (for instance, the MCP980x sensors). The standard LM75 reports temperature using 9 bits. In order to be detected by the firmware (without modifications), all 3 address pins must be connected to VCC. This allows for easier wiring. Installing a small capacitor near the sensor is a good idea.

Wiring diagram:
Type: Absolute Pressure, 15 to 115 kPaInterface: Analogic
Firmware: Any, configure ADC channel Version: 1.2
Accuracy: ±1.5% error from 0° to 85°, Temperature compensated from -40°C to +125°C
This sensor is for measuring the air pressure. Connect it to one of the ADC channels on the Atmel and configure the corresponding ADC channel with chip id 0x90. Because of the wide sensitivity range of the sensor and the Atmega8's analog to digital converter which cannot take samples using more than 10 bits, the accuracy is not so good and noise is visible on graphs. Nevertheless, it's sufficient to get a good idea of the current tendency. (Pressure rising or falling).

ADC inputs
No diagram. Type: 0 volts to VCC (approx 5 volts)Interface: Analogic
Firmware: adc.hex Version: 1.6
Accuracy: 10 bits
Used to measure the voltage present on the Atmega8's ADC inputs (ADC0 to ADC5). For the moment, the reference is always VCC. It is thus important to take into account the fact that the voltage may not be exactly 5 volts. Also, care must be taken not to exceed VCC.

Configuring ADC channels: The firmware can expose ADC channels as specific chip IDs. By default all ADC channels are configured to CHIP_NONE (0xff). If you connect an analogic sensor to an ADC channel, configure the firmware (only needed once since the information is stored in eeprom). Here's a configuration example: (Sets ADC0 to 0x90 [MPX4115]).
# ./usbtenkisetup -s 'XXXXXX' setadcchip 0 0x90
For details about how to program an AVR, please visit my AVR programming page.

goto top Up

Host software

The host side software has two flavors: A command line tool and a GUI (since 1.8).

usbtenki-2.1.5.tar.gz (890.1 KB)
qtenki-install-2.1.5.exe (7.2 MB)
March 12, 2017 (Sunday)
  • [General] Add inHg pressure format
  • [General] Add support for PT100 + MS5611 product
  • [General] Add CO2 gas sensor support
  • [General] Introduce PPM gas units
  • [QTenki] Fix a bug where the number of digits after decimal point preference was not preserved.
  • [QTenki] More compact display
  • [Command-line] Fix bug reading MS5611 temperature only
usbtenki-2.1.4.tar.gz (900 KB)
qtenki-install-2.1.4.exe (8 MB)
March 20, 2016 (Sunday) Add SHT31 sensor support (Host side software only)
usbtenki-2.1.3.tar.gz (890.2 KB)
qtenki-install-2.1.3.exe (8 MB)
August 23, 2014 (Saturday) Add support for ChipCap2 Relative Humidity and Temperature sensors
usbtenki-2.1.2.tar.gz (888.5 KB)
qtenki-install-2.1.2.exe (8 MB)
qtenki-install-2.1.2-xp.exe (8 MB)
March 30, 2014 (Sunday)
  • [Command-line] Performance fix (unrequested channels were being read)
  • [Command-line] Increased verbosity when -v is used
  • [QTenki] Minimum logging interval lowered from 1 second to 0.1 second
  • [QTenki] Fixed a minimize-to-tray bug
  • [QTenki] Added save messages and clear messages buttons
  • [Qtenki] Errors now shown in bigview
  • [General] Introduce pressure-based altitude computation
  • [General] Prevent RH values from exiting the 0 - 100% range
  • [General] Introduce configurable length units
  • [General] Various small bug fixes
usbtenki-2.1.0.tar.gz (882.1 KB)
qtenki-install-2.1.0.exe (7.7 MB)
qtenki-install-2.1.0-xp.exe (7.7 MB)
September 22, 2013
  • [Firmwares] Updated V-USB to newer verison.
  • Add support for high precision MS5611 pressure sensor.
  • Add support for the MLX90614 infrared temperature sensor.
  • RTD temperature calibration has changed (increased precision).
usbtenki-2.0.4.tar.gz (849 KB)
May 15, 2013
  • Linux: Added a sample udev rules files to script/ (To use the USB Tenki device without being root)
  • [Core] Support for the MPXV7002 differential pressure sensor
  • Additional documentation for building on MacOS X and related fixes
usbtenki-2.0.3.tar.gz (644.7 KB) (7.8 MB)
March 18, 2013
  • [QTenki] Log file can now be viewed while logging. New records will appear in real time.
  • [QTenki] Added voltage, current and power unit preferences.
  • [QTenki] Number of digits following the decimal now configurable.
  • [QTenki] Added a basic realtime graphing tab using QCustomPlot.
  • Support for Dracal USB Vendor ID
usbtenki-1.9.6.tar.gz (503.2 KB) (7.6 MB)
November 1, 2012
  • [Command-line] Fixed the month number in timestamps generated by the command line tool.
  • [QTenki] Fixed a bug where occasional logged values would appear in the default sensor units rather than the ones configured by the user. (Eg: An occasional Celcius record in a Farenheit log file).
  • [QTenki] Configuration panel now disabled while logging to prevent inadvertant changes to the logging format (eg: Changing units)
  • [QTenki] Logging interval added to the log file header.
usbtenki-1.9.5.tar.gz (502.3 KB) (7.6 MB)
July 22, 2012
  • Qtenki: Default to the user's home directory in the log file selection dialog.
  • Qtenki: Fixed a timestamp bug where the current minute was logged instead of the current month.
usbtenki-1.9.4.tar.gz (502.1 KB) (7.6 MB)
July 1, 2012
  • Qtenki: Added configurable display units (Celcius, Fahrenheit, Kelvin, etc).
  • Qtenki: New tab for displaying values using a large font ('Big view')
  • Support for a PT100 RTD sensor.
usbtenki-1.9.3.tar.gz (499.3 KB) (7.6 MB)
May 30, 2012 Corrected a virtual channel bug introduced in version 1.9.2.
usbtenki-1.9.2.tar.gz (490.9 KB) (7.5 MB)
February 2012 General changes:
  • Added options to disable input range validation for humidex and heat index.
  • Added firmware and host support for a tachometer.
  • Updated SHT75 Relative humidity non-linearity compensation coefficients according to datasheet Rev.5 (2011).
  • Added an option to use the old coefficients (Datasheet rev.3, 2007)
  • Added a temperature corrected RH reading (sensirion only)
  • Better error handling (auto-reopen) and related logging options.
  • Added application icons and version information to a windows rc file. (Embedded in the final windows executable)
usbtenki-1.9.1.tar.gz (447 KB)
February 2012 General changes:
  • For Humidex and Heat index, when the input temperature/humidity is out of range, just copy the temperature to the output. Better than displaying innaccurate and sometimes insane values.
  • Updated Makefile.mingw in client/ and added conditionals for win32 in qtenki/
  • The public library API does not require including usb.h anymore.
Command-line tool:
  • Use the library to compute virtual channels. (less code duplication)
  • Merged measurement type and unit together (gives Temperature - C, Humidity - % etc).
  • The last heading line before the actual data is now alias. This should reduce manipulations when importing in spreadsheet software.
  • Added a configuration tab.
  • System gui colors can be overridden. (For a special user who dislikes the win7 default theme (too much white). Instead of changing his system theme (the sensible thing to do), he insists the application should change the colors itself, even if explained why it is bad practice. The customer is always right, but at least I made this feature configurable, and off by default.
  • Changes to the theme.
usbtenki-1.8.tar.gz (440.7 KB)
December 2011 New features and changes:
  • New QTbased GUI for easy logging
  • Added support for:
    • SE95 I2C Temperature sensor
    • ADT7410 I2C Temperature sensor
    • D6F_V03A1 airflow sensor
    • TSL256x Visible light and infra-red sensors
  • The firmware can be configured to use an external reference voltage.
usbtenki-1.7.tar.gz (310.5 KB)
August 2010 New features and fixes:
  • Support for the MP3H6115A sensor (identical to MPX3115)
  • Fix a bug with sub-zero temperatures.
usbtenki-1.6.tar.gz (303.4 KB)
September 2007 New features:
  • Firmware named 'ADC' for using only analogic inputs.
  • New channel types voltage and inverse voltage. New unit: 'Voltage'.
  • Option for retrying in case of a communication error or access conflict.
usbtenki-1.4.tar.gz (320.8 KB)
May 2007 Version 1.4 is the first public version. Tested on Linux and Mac OS X
usbtenki_munin.tar.gz (1.4 KB)
munin plugin script.

Listing devices:
For printing a list of accessible USBTenki devices, use the '-l' switch:
# ./usbtenkiget -l
Found: 'USBTenki', Serial: 'B10004', Version 1.2, Channels: 11
    Channel 0: Sensirion SHT1x/7x Temperature [Temperature]
    Channel 1: Sensirion SHT1x/7x Relative Humidity [Relative Humidity]
    Channel 2: MPX4115 Absolute air pressure sensor [Pressure]
    Virtual Channel 256: Dew point [Dew point]
    Virtual Channel 257: Humidex [Humidex]
    Virtual Channel 258: Heat index [Heat index]
As you can see in the output above, there is a concept of channel and virtual channel. A channel reports real data from the physical sensor (or data computed by the firmware). Virtual channels are channels whose value is computed locally using the real channels. (More info about virtual channels)

Reading values:
Reading values from an USBTenki device is done by specifying a comma-separated list of the channels you want to the -i switch. If the value 'a' is passed, all channels are listed.
# ./usbtenkiget -i 0,1,256
22.46, 39.55, 8.02
The ouput above is easy to parse. But if you want a prettier output, use the -p switch:
# ./usbtenkiget -i a -p
Temperature: 22.26 °C
Relative Humidity: 40.03 %
Pressure: 102.89 kPa
Dew point: 8.02 °C
Humidex: 22.67 °C
Heat index: 24.98 °C
If the degree ° sign shows as garbage on your terminal, change your encoding to iso8859-1 or try the -7 switch to disable such fancy characters.

Converting values:
Celcius and Kilopascals are the default units. If you prefer other units, the -T and -P switches can be used to select different temperature and pressure units. Try -h for a list of supported units. Example:
# ./usbtenkiget -i 0,2 -p -T f -P hPa
Temperature: 70.61 °F
Pressure: 1022.45 hPa

goto top Up

Virtual channels

Here is a list of the possible virtual channels, their dependencies and links to related documentation.
Channel # Name Dependencies Comments
256 Dew point Temperature and Relative Humidity "The "dew point" or "dewpoint" of a given parcel of air is the temperature to which the parcel must be cooled, at constant barometric pressure, for water vapor to condense into water, called dew." - source: Wikipedia. This value is calculated using a formula from a sensirion application note named Dewpoint Calculation Humidity Sensor
257 Humidex Dew point (virtual) and Temperature "The humidex is an index (a computed value as opposed to something measured) devised to describe how hot or humid weather feels to the average person." - Source: Meteorological Service of Canada FAQ. Visit their FAQ for information about how Humidex is calculated.
258 Heat index Temperature and Relative Humidity "The Heat index (HI) is an index that combines air temperature and relative humidity to determine an apparent temperature - how hot it actually feels." - Source: Wikipedia.

goto top Up

Printed Circuit Board



The PCB I use is the same as in the GC/N64 controller to usb project. This PCB has a footprint for a voltage regulator (not used this time) and reprogramming contacts on the bottom side. Here are composite images of the top and bottom layers:

No regulator is requied so the only components that must be installed on the back side are the two voltage selection resistors. Install them as they are on the picture on the right. If you dont have 0 ohm resistors, you may use small pieces of wire or do solder bridges.

Here is a wiring diagram for the board. With the schematic and sensor wiring diagrams, it should be easy to figure out how to connect your sensor.

And finally, here are the gerber files which you can use produce this PCB:

Due to the fact that this board is two-sided and has numerous vias, building it at home may be a little harder than the ususal. If you want, you can get professional PCBs from my online store.

goto top Up


The following wikipedia articles were useful:
Heat index

The application notes on sensirion website. For calculating dewpoint from Temp + RH and for sensor documentation:
SHT75 datasheet and application notes

Information about humidex on the Meteorological Service of Canada (MSC) website:

goto top Up


I cannot be held responsible for any damages that could occur to you or your equipment while following the procedures present on this page. Also, I GIVE ABSOLUTELY NO WARRANTY on the correctness and usability of the informations on this page. Please note, however, that the procedures above have worked in my case without any damages or problems.

Now you cannot say that I did not warn you :)

goto top Up

Trademarks used in this site are the property of their respectives owners.
Copyright © 2002-2017, Raphaël Assénat
Website coded withWebsite coded with vimLast update: November 17, 2014 (Monday)