Hackaday Prize Entry: A Two Component Temperature Sensor

Here’s a design challenge for you: make a temperature sensor for any computer. If you’re an exceptionally clever smart ass, you’ll probably write some code to report the CPU temps. Others who take the exercise seriously will probably build something with a 1-wire temp sensor, a microcontroller, and all the hardware required to do that.

[Michael] had a better idea. He did it with just two components. One of those components is a USB connector.

The only reason is project could be created is a rather new part from Microchip, the PIC16F1455. This microcontroller doesn’t require a crystal, can do USB without any additional parts, and has an integrated temperature sensor. [Michael] whipped up a project to set up a USB CDC serial device, read the temperature with the ADC (thanks to a very helpful app note), and sends the temperature to a computer once a second.

Despite being built out of only two components, this could actually be a useful device. The PIC is a USB serial device, and this can be used with any computer made in the past 15 or so years. It would hardly take any code at all to read the temperature with another program, and it’s a very inexpensive build. We have to give style points for soldering a microcontroller directly to a USB connector, too.

The 2015 Hackaday Prize is sponsored by:

29 thoughts on “Hackaday Prize Entry: A Two Component Temperature Sensor

    1. How long ago was that? That sounds like it was before my time.

      I wonder what it would take to do USB in discrete transistors, or if it would even be feasible even in the lowest speed.

      1. At the low level, even trying to implement the state machine using a CPLD is a pain and that not considering that there needs to have some smarts to handle quite a bit of messaging even before the host would recognize it.

      1. Yeah, depends on a very fortuitous positioning of pins, also the fact that it runs @ USB voltage is convenient. I have a msp430 variant lying around, that includes a temperature sensor. Wonder if that would work in this configuration?

  1. Neat hack! How accurate is the interal temperature sensor? But I wonder… how reliable will the micro be with no bypass capacitor on its supply?

    It occurs to me that if the PC has a camera, it can measure temperature with just ONE external part — a real thermometer. Write a program to use the camera to read the thermometer. Such a program could conceivably read any kind of “meter”; multimeter, micrometer, speedometer, etc. It’s “optically isolated”, too! :-)

    USB with no micro? Hmm… Can a host PC somehow tell if something is plugged into the USB connector even if the thing doesn’t respond with data? Like by the fact that it’s drawing current, or putting nonsense on the data lines? If this is possible, there are all sorts of ways to sense things without data.

    1. If you mess about in Control Panel (in Windows) long enough, you can find the current draw for your USB ports. But I dunno if that only applies to devices that are registered with the system, ie need smarts. When I find my USB reading lamp I’ll let you know.

      There’s the standard for phone chargers, where a simple resistor on the data lines requests a particular current rating. Dunno if real USB ports support that, or just chargers.

      1. well, you have three options:

        a) put a resistor on the data line – that tells the port (kernel,driver,whatever :) how many mamps you need
        b) put something that can actually talk over the data line – and let it tell the usb host themselves
        c) don’t put none – and have either the port supply the max it can give, or the minimum it thinks is proper

        note that with a) you can’t use the data lines for data – so in this case, it’s a no-go :)

      2. The “power consumption” is simply the power budget using what the USB descriptors data structure reported by the USB (microcontroller) in the device. There are no ADC inside a regular PC to read what’s *actually* consumed. Even for the descriptor, it is a static one time read from the microcontroller during a device configuration and not constantly polled.

        See 8 bMaxPower 1 mA Maximum Power Consumption in 2mA units

    2. Yeah, I think missing the decoupling cap is a gamble, might be unstable if you try it on more PCs etc.

      I came here to say the same: with the camera you can read a thermometer. And let’s not forget you can attach an I2C temperature sensor in quite a few points(mainboard, RAM, VGA).

      Oh, and most new laptops have a phone style 4 pin connector for headphones, where you could directly attach a 1 wire sensor. But damn, you still need the connector so it is still 2 parts.

    1. The wires are another component of the setup with the I2c.

      Mind you as others point out, you’d want an extension of some sort in most cases with temperature measurement so then this one would also become a 3 parter.

    1. Really need an extension cable as the USB port of a laptop conducts heat from the motherboard to the connector and in some cases near a vent exhaust.

      Are we so obsess to minimize the number of components to the point of promoting bad practices? i.e. lack of decoupling caps? Do we want to make China quality hacks?

  2. T.I.L, the clever thing here is the way the pic calibrates his clock to USB data to avoid a crystal,
    i droped the PIC years ago, but i think i’m gonna give them a second chance.

  3. It looks like the firmware is sending the raw ADC results over USB
    1. It looks easy to change this to send temperature itself
    2. From the application note the temperature indicator requires at least one conversion at a known temperature for calibration purposes. Basically to let you figure out the c in y=mx+c. The m coefficient appears more stable in the figures.

    Without the decoupling cap the quality of a/d conversions may be affected.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.