element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products
  • More
Arduino
Arduino Forum Help with a temperature sensing.
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 3 replies
  • Subscribers 403 subscribers
  • Views 333 views
  • Users 0 members are here
Related

Help with a temperature sensing.

Former Member
Former Member over 13 years ago

Hi everyone,

 

I am only new to this and have been doing a lot of reading the last few weeks to try and get my head around Arduino and a project I need to make.
The device needds to messure the temp and pick up if there has been a change in temp in the last 30 seconds. 0.2C

 

I have worked out how to read the temp but not how to store the info and trigger a led if there is a change.

 

Any help will great and I thank you in advance.

 

Jason

  • Sign in to reply
  • Cancel
Parents
  • billabott
    0 billabott over 13 years ago

    http://www.youtube.com/watch?v=bo9Vz7DhrN4&feature=endscreen&NR=1

     

    and dig back to previous video in that series if you need to understand it better. 

     

     

    Source

    /*

    * This is based on the "array" example in the basic Arduino library.

    * My modification shows how to use the Arduino as a sensitive voltmeter with bargraph display.

    * Made by TinselKoala 5Dec2012, released into public domain.

    *

    * The circuit:

    * LEDs  anodes on pins 2 through 13, cathodes all to one 220 R to ground

    * Thermistor from plus 5v to potpin, selected resistor from potpin to ground:

    * select this resistor to match match thermistor cool value

    * Piezo buzzer element from speakerOut pin to ground

    *

    * OR for voltmeter measurement use Ground as -- input, potpin as ++ input, less than 5 volts max

    * put a 10 megohm resistor from ground to potpin for pulldown so circuit doesn't float when disconnected

    *

    */

     

    int timer = 30;           // Milliseconds, the higher the number, the slower the sample rate.

    int ledPins[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };       // an array of pin numbers to which LEDs are attached

    int pinCount = 12;           // LED count

    int potpin = 14;    // set potpin here

    int potvalue = 550, rawpot = 550;

    int lowlimit = 550, highlimit = 600; // Sets sensitivity and upper and lower endpoints from the 0-1023 total range

    // adjust for your thermistor value using Serial Monitor to see raw values at potpin

     

    int ledvalue = 2;

    int speakerOut = 17;

     

    void setup() {

      int thisPin;

      // the array elements are numbered from 0 to (pinCount - 1).

      // use a for loop to initialize each pin as an output:

      for (int thisPin = 0; thisPin < pinCount; thisPin++)  {

        pinMode(ledPins[thisPin], OUTPUT);     

      }

      Serial.begin(57600); // for serial monitor of action, comment out if not needed

    }

     

    void loop() {

      potvalue = analogRead(potpin); // read voltage on potpin, assign value from 0 to 1023 (0-5V)

       if(potvalue < lowlimit) potvalue = lowlimit; // low end of voltage range to map

       if(potvalue > highlimit) potvalue = highlimit; // high end of voltage range

        ledvalue = map(potvalue,lowlimit,highlimit,0,11); // map the limit range across the LED numbers

     

        // turn the LED on:

        digitalWrite(ledPins[ledvalue], HIGH);  

        delay(timer);                 

        // turn the LED off:

        digitalWrite(ledPins[ledvalue], LOW);   

        if (ledvalue == pinCount-1) delay(30); // milliseconds, sets flash rate of high limit indicator LED

      

       //for (count2=0;count2<8;count2++) {

            if(ledvalue == pinCount-1)  {  

             // for(int n=1;n<200;n++){

              analogWrite(speakerOut,1000);

              delayMicroseconds(10000);

              analogWrite(speakerOut, 0);

              delayMicroseconds(1000);

              digitalWrite(ledPins[ledvalue], HIGH);  

        delay(timer);                 

        // turn the LED off:

        digitalWrite(ledPins[ledvalue], LOW);

        //    }

          }

      

      

        // Serial monitor section, ok to comment out if not used

        rawpot = analogRead(potpin);

        Serial.print("Raw potpin value =   ");

        Serial.println(rawpot);

        Serial.print("Mapped to LED level  ");

        Serial.println(ledvalue);

      }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 13 years ago in reply to billabott

    I have found a few of these projects but they all seem to have a preset baseline, is there a way to have the baseline automatically adjust to the last reading? As the device needs to be able to workt he same in 5 deg C and 40 deg C and still pick up if there is a sudden change in temp.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • Former Member
    0 Former Member over 13 years ago in reply to billabott

    I have found a few of these projects but they all seem to have a preset baseline, is there a way to have the baseline automatically adjust to the last reading? As the device needs to be able to workt he same in 5 deg C and 40 deg C and still pick up if there is a sudden change in temp.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • mcb1
    0 mcb1 over 13 years ago in reply to Former Member

    Jason

    My suggestion is store the time the last reading time(using millis())

    Store the last temp (ie lasttemp)

    Subtract the two times (millis() - last time) and subtract the temperatures. (temp - lasttemp)

    If the temp changes by xx, and the time in millis is less than xxxx, then trigger your led.

     

    You will need to make both time variables as unsigned long otherwise they overflow.

     

    Hope this gives you the pointers you need.

     

    Mark.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube