Oct 122014
 

PCSensor Temper1F

Article updated 28/10/2014 thanks to Pete Chapman releasing even better software. Read on! 

One of the long-term goals is to pop one of my Raspberry Pi’s up in the loft. From there I plan to move my ADSB aircraft monitoring from the ‘Mancave’ into the highest point of the house; as I live up way up a hill, hopefully this will significantly improve my reception. 

I also wanted to pop a temperature sensor on the mains water pipe feeding the cold water storage tank. My loft is very well insulated from the house (good for us), but also quite exposed. In a very cold winter this could result in the ambient temperature up there dropping to or below freezing. Frozen pipes, cracked tanks … not funny. 

I ordered the above item from Amazon (search for PCSensor Temper1F). There are many types it seems but this is the one I’m writing about today. From what I can gather, they all function mostly the same and the instructions below should work regardless of which one you get. For the price (~£10-15) they are reportedly very accurate.

Throw away the driver CD

Firstly throw away the driver CD that comes with it. Yes it has linux software on it, but it’s buggy. Particularly for my purposes as when the temperature drops below 0C it overflows and reports 248C. Not that helpful when you wish to report on too cold rather than too hot. 

Plug it in

Remove the USB stick from the packaging and plug in the temperature probe to the rear. Then use a USB extension lead to plug it in to your Pi (not mandatory, but when I use the Raspberry Pi I dislike touching the actual device and extension leads make it much easier to not disturb the device too much). If it’s the same model as mine you should get a little red LED light up. 

$ dmesg | tail

[  623.621245] usb 1-1.2: new low-speed USB device number 7 using dwc_otg
[  623.735966] usb 1-1.2: New USB device found, idVendor=0c45, idProduct=7401
[  623.736004] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  623.736020] usb 1-1.2: Product: TEMPer1F_V1.3
[  623.736034] usb 1-1.2: Manufacturer: RDing
[  623.757428] input: RDing TEMPer1F_V1.3 as /devices/platform/bcm2708_usb/usb1/1-1/1-1.2/1-1.2:1.0/input/input2
[  623.760094] hid-generic 0003:0C45:7401.0004: input,hidraw1: USB HID v1.10 Keyboard [RDing TEMPer1F_V1.3] on usb-bcm2708_usb-1.2/input0
[  623.777723] hid-generic 0003:0C45:7401.0005: hiddev0,hidraw2: USB HID v1.10 Device [RDing TEMPer1F_V1.3] on usb-bcm2708_usb-1.2/input1

$ lsusb

Bus 001 Device 007: ID 0c45:7401 Microdia

Driver Installation

As I said above the existing software that comes with it is broken. Peter Vojtek has released a fixed version of the original code on GitHub (local mirror). Pete Chapman has released an even-more fixed version of the original software, as a fork of Peter Vojtek’s code on GitHub (local mirror). While Vojtek fixed the negative temperature issue, the sub-integer (decimal) temperature values were not accurate. Pete Chapman’s code fixes that little issue as well and makes the probe even more accurate. Thanks Pete!

 Go grab it, and follow me. The instructions are a bit sparse with the code but it’s not at all difficult. 

  1. $ apt-get install build-essential libusb-dev
  2. $ unzip master.zip (or whatever the driver zip file is)
  3. $ cd usb-thermometer-master
  4. $ make
  5. $ sudo make rules-install
  6. Unplug and Re-Plug the Thermometer
  7. $ ./pcsensor

If all went according to plan and you haven’t had any errors or you’ve resolved them on the way, you should get back:

2014/10/12 13:03:35 Temperature 69.95F 21.08C

You can then use awk, or any shell script or scripting language of your choice (python example) to extract that data and make use of it. Copy the executable to /usr/local/bin when you are happy it works. Anyone on the system can execute it, it requires no special pemissions thanks to the 666 udev rules.

Have fun! 

When you’ve got a decent amount of temperature data (the sources differ, but I put them in a uniform format in a MySQL database), you can have some fun with the data as well as more serious alerting ideas like above. 

chartClick the graph to go play with the live version. 🙂

 

Lee

 

 Posted by at 1:39 pm

  11 Responses to “Using Temper1F USB Temperature Probe on Raspberry Pi”

  1. great article! how did you manage this fancy graph? is that build at your own or is that some kind of ready to use application? thanks for your reply!

    • I put temperature data collected from various sources into a MySQL database. I then just pull it out and run it through HighCharts which does most of the hard work on the display side. Awesome (free!) application for building just about any chart you can think of.

      • maybe you can spend a second blog post to share that to. I mean your script getting the data and putting it into the database, the database tables and your php script with highcharts to read get it out of the database… that would be great!!

  2. If you don’t want to go through the trouble of setting up the db and highcharts you can use Librato (shameless plug). For tiny data amounts like this you can use it for free. I run this ruby script on my raspberry pi to send temperature information to Librato every minute:

    require 'librato/metrics'

    Librato::Metrics.authenticate 'email', 'api_key'

    loop do
    begin
    sensor_output = `sudo ./pcsensor`
    temperature = /(? {:source => 'raspberry', :value => temperature}
    rescue StandardError=>e
    puts "Error: #{e}"
    else
    puts temperature
    ensure
    sleep 60
    end
    end

  3. Thank you !

  4. Hi. Thanks for this tutorial. I have 1 question:

    When I get to Steps 6 and 7, unplug and replug, and run ./pcsensor, I do get the correct output on the first try. However, if I run ./pcsensor again, I get an error: “Fatal error> USB read failed”

    If I unplug/replug again, it works, but again, only the first time.

    Is this the expected behavior? If so, is there a workaround?

    Thanks!

  5. Hi.
    I have just plugged two Temper1F sensors into RPi running raspbian.

    Seems that executing./pcsensor returns only reading from one sensor.

    Idea idea how to get both sensors output?

    Thanks.
    mm7

  6. Where download script for python\apache?

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)