You are here: Home Other Stuff USBTenki-mux


16 MCP9803 temperature sensors on 1 USB port

A Bit Of History

About a year ago i hijacked Raphaël Assénat's USBTenki project and made some modifications to it. The reason i did this project was, that i had just built a cabinet for my computers (see Quieter PC) and wanted to know what the temperatures in various places in and outside of the cabinet were, and how they related to each other. Since i didn't want to use this many USB ports i decided to take Raphaël's project and add a 16 channel multiplexer to it.

As i had some time this weekend, i thought i'd share what i did with it in case some else might get some use out of it.


I have been running this setup for almost a year now. I've learned what temperatures i have in my cabinet as well as a few other collateral lessons.

One of which was that the MCP9800s are very ESD sensitive. After the initial build i had several of them fail within a week or 2. After getting a decent ESD mat and wrist strap, i replace the busted units and haven't had problems with them since.

The other is, that i have occasional disconnects which are likely due to EMI. I was looking for thin soft cable for the sensors and opted for non shielded cable. The side effect of this is that the sensor should be rest when this happens.

The aggregator directory of the distribution has a couple of scripts that handle resetting and RRD creation. They work in conjunction with RRDtool and Drraw. Here's a weekly reading generated by these tools.




My Prototype

The first shot is the top of the board. Note that it varies from the actual schematic. I ended up kludging it by adding the debug serial interface and a pull up resistor for the bus.




The second picture is a first test of the sensors.

A first test


The third is me enjoying an afternoon of brain surgery soldering sensor boards. Note: Raphaël sells sensor boards

which i learned after the fact.





This is the schematic of the main board. Note that i used named paths to avoid the wire madness that otherwise would occur.





The first image is the bottom of the main board. It is intended for toner transfers.

The second is the top, which i just glued onto the board. Note:

This is probably not such a good idea from and ESD point of view.

The third is a toner transfer image of the sensor board.

The schematics directory of the distribution contains full size versions of these. It also contains the EagleCAD files i used to generate the images.






For a general set of options use the -h switch:
#./usbtenkiget -h
Usage: ./usbtenkiget [options]

Valid options:
    -V          Display version information
    -v          Verbose mode
    -h          Displays help
    -l          List and display info about available sensors
    -f          Full list mode. (shows unused/unconfigured channels)
    -s serno    Use USB sensor with matching serial number. Default: Use first.
    -i id<,id,id...>  Use specific channel(s) id(s) or 'a' for all. Default: 0
    -R num      If an USB command fails, retry it num times before bailing out
    -r          Re initialize sensors
    -T unit     Select the temperature unit to use. Default: Celcius
    -P unit     Select the pressure unit to use. Default: kPa
    -p          Enable pretty output
    -7          Use 7 bit clean output (no fancy degree symbols)

Valid temperature units:
    Celcius, c, Fahrenheit, f, Kelvin, k

Valid pressure units:
    kPa, hPa, bar, at (98.0665 kPa), atm (101.325 kPa), Torr, psi


The listing shows the 16 sensors:

#./usbtenkiget -l
Found: 'USBTenki', Serial: 'tstmcp', Version 1.6, Channels: 16
    Channel 0: MCP980x I2C Temperature sensor channel 0 [Temperature #01]
    Channel 1: MCP980x I2C Temperature sensor channel 1 [Temperature #02]
    Channel 2: MCP980x I2C Temperature sensor channel 2 [Temperature #03]
    Channel 3: MCP980x I2C Temperature sensor channel 3 [Temperature #04]
    Channel 4: MCP980x I2C Temperature sensor channel 4 [Temperature #05]
    Channel 5: MCP980x I2C Temperature sensor channel 5 [Temperature #06]
    Channel 6: MCP980x I2C Temperature sensor channel 6 [Temperature #07]
    Channel 7: MCP980x I2C Temperature sensor channel 7 [Temperature #08]
    Channel 8: MCP980x I2C Temperature sensor channel 8 [Temperature #09]
    Channel 9: MCP980x I2C Temperature sensor channel 9 [Temperature #10]
    Channel 10: MCP980x I2C Temperature sensor channel 10 [Temperature #11]
    Channel 11: MCP980x I2C Temperature sensor channel 11 [Temperature #12]
    Channel 12: MCP980x I2C Temperature sensor channel 12 [Temperature #13]
    Channel 13: MCP980x I2C Temperature sensor channel 13 [Temperature #14]
    Channel 14: MCP980x I2C Temperature sensor channel 14 [Temperature #15]
    Channel 15: MCP980x I2C Temperature sensor channel 15 [Temperature #16]

Here are the temperature readings:

#./usbtenkiget -pia -Tf
Temperature #01: 93.40 °F
Temperature #02: 91.51 °F
Temperature #03: 98.82 °F
Temperature #04: 90.05 °F
Temperature #05: 70.03 °F
Temperature #06: 65.19 °F
Temperature #07: 101.30 °F
Temperature #08: 101.86 °F
Temperature #09: 81.39 °F
Temperature #10: 87.91 °F
Temperature #11: 89.15 °F
Temperature #12: 61.36 °F
Temperature #13: 96.80 °F
Temperature #14: 98.34 °F
Temperature #15: 96.46 °F
Temperature #16: 68.90 °F
Other than that the usage is unchanged from the original USBTenki project.


The Source

This project is GPL so here are the sources usbtenki-mux-862.tar.gz.

Note that the client build system is very basic. I built this on FreeBSD, but it works on Linux as well. You may want to inspect the client/Makefile and adjust the lib and include paths before running make.

Also take a look at client/COMPILE if you're building this on FreeBSD. Also thanks to Александр Листратенков for sending the client/Makefile patch for Ubuntu 11.10.







This project is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.



Document Actions

Copyright © 2007-2015 Mario Theodoridis. All rights reserved. Content licensed under AFL.   Impressum   Datenschutz
Content from the underlying Plone CMS is © 2000-2009 by the Plone Foundation