Home Page Forums Tinylab Temperature Sensor reading too high

This topic contains 8 replies, has 2 voices, and was last updated by  KatieK 5 months, 1 week ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1238

    KatieK
    Participant

    I’m working with tinylab’s onboard temperature sensor, and it seems to be reading too high a temperature. It reports 45C / 113F, when my room temperature is somewhere between 65F – 75F. Is there some kind of calibration I have to do for the temp sensor? Is it an LM35, or is it a different type of temperature sensor?

    Thanks!

    #1245

    kerem
    Moderator

    Hello, could you please write the code you use? Thanks.

    #1246

    KatieK
    Participant

    Here is the code I’m using. Note that I’m using Johnny-Five, a JavaScript library for hardware. It’s worked as expected on other projects I’ve done on the tinylab.

    #1247

    KatieK
    Participant

    Below is the code that I’m using. Note that I’m using Johnny-Five, which is a JavaScript library for hardware. It’s worked fine on other tinylab projects that I’ve used.

    #1248

    KatieK
    Participant

    var five = require(“johnny-five”);
    var board = new five.Board();

    // !! Seems to read too high a temp.

    board.on(“ready”, function(){

    // Create an analog Thermometer object:
    var temp = new five.Thermometer({
    pin: “A3”,
    freq: 1000
    });

    temp.on(“data”, function() {
    console.log(“celsius: %d”, this.C);
    console.log(“fahrenheit: %d”, this.F);
    console.log(“kelvin: %d”, this.K);
    });

    });

    #1249

    KatieK
    Participant

    Here is the code that I’m using: https://gist.github.com/KatieK2/3fa9ef18cc634a0660626bacd8ca74ac. It didn’t paste in here – I don’t know why.

    Note that I’m using Johnny-Five, which is a JavaScript library for hardware. It’s worked fine on other tinylab projects that I’ve used.

    #1251

    kerem
    Moderator

    Could you please upload this code with Arduino IDE and check serial monitor? http://pastebin.com/iBT3Ndvf It’s to check whether the sensor is defective or not.

    #1262

    KatieK
    Participant

    Huh. The C code you provided does report a correct temperature range.I guess that the hardware is working fine. I’ll have to take another look at the software side I’m using.

    Thanks for the help! Sorry for the multiple posts up there – the code posts didn’t appear in the forum post.

    #1490

    KatieK
    Participant

    In case anyone ever comes across this, the problem was that I hadn’t initialized the sensor type (LM35) in the Johnny-Five code. This is the fixed code, and it works fine:

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.