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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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
Sensors
  • Technologies
  • More
Sensors
Sensor Forum having a problem with LM35 temperature sensor
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Sensors to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 38 replies
  • Subscribers 315 subscribers
  • Views 828 views
  • Users 0 members are here
  • sensors
  • arduino ide
  • temperature sensor
  • arduino
  • analog
Related

having a problem with LM35 temperature sensor

samiboutgoulla
samiboutgoulla 26 days ago

Hello, I just started a project with LM35 (temperature sensors) with Arduino, after mounting it on my breadboard I noticed that the values ​​in the serial monitor are inconsistent and vary in a strange way, for example I get 21°, 20°, 22° 24° successively which is impossible I get the same result with 5 different sensors,  even whern i use a heat source the temperature the values vary also in a strange way and I don't know where the problem is can someone help me please? image imageimage

  • Sign in to reply
  • Cancel

Top Replies

  • kmikemoo
    kmikemoo 24 days ago +3
    samiboutgoulla You can try one of the circuits below. They are taken from the LM35 datasheet. The capacitance of your breadboard may be impacting your readings. Still... shabaz's video is very compelling…
  • michaelkellett
    michaelkellett 26 days ago in reply to samiboutgoulla +2
    It looks as if you have no resistor from the output to a negative bias voltage - this means that you will get poor results as the temperature drops towards zero but you can ignore that for now. The sensor…
  • michaelkellett
    michaelkellett 26 days ago in reply to JWx +1
    Good idea but I think he has an external noise problem - let's wait and see ! MK
  • michaelkellett
    0 michaelkellett 26 days ago

    How is your sensor connected ?

    Schematic, R value and a picture are needed !

    It looks as if your readings are very noisy, but possibly there could be another issue.

    When you say that 5 different sensors give the same result, what do you mean. Is it exactly the same result (which would not be a noise issue) or similar results (which could be noise.) In engineering you need to be very careful when describing results.

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • samiboutgoulla
    0 samiboutgoulla 26 days ago in reply to michaelkellett

    This means that with 5 LM35s I get strange results, they are not 100% the same values ​​but they are strange and imprecise , i have joined the circut and also the data that i get from serial monitor imageimage

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • samiboutgoulla
    0 samiboutgoulla 26 days ago in reply to michaelkellett

    imageimageimage

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • JWx
    0 JWx 26 days ago

    it seems that for LM35 1 st. C translates to 10mV of output voltage. Considering that (for Atmega) one bit of ADC result at Vref = 5V is about 5mV, typical ADC conversion accuracy is about 1 st.C (2 LSB), with max error of about 2 st. C.

    Maybe switching to internal voltage reference of 1V would bring better accuracy? and adding some Vcc filtering in case when observed variability is caused by Vcc (used as reference) noise? 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • samiboutgoulla
    0 samiboutgoulla 26 days ago in reply to JWx

    how can i do that ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • JWx
    0 JWx 26 days ago in reply to samiboutgoulla

    docs.arduino.cc/.../

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • JWx
    0 JWx 26 days ago in reply to JWx

    and change 5.0 to the value of the reference in code...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • samiboutgoulla
    0 samiboutgoulla 26 days ago in reply to JWx

    can you please do it for me idk how to do it

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • michaelkellett
    0 michaelkellett 26 days ago in reply to samiboutgoulla

    It looks as if you have no resistor from the output to a negative bias voltage - this means that you will get poor results as the temperature drops towards zero but you can ignore that for now.

    The sensor output is 10mV/degree C. The resolution of your ADC is 5000/1024 = 4.88 mV which is equivalent to 0.488 C.

    You would expect to see the readings jump about by at least half a degree. You are taking a reading once per second so I suggest that you filter the signal going in to the ADC. Put a 2k resistor between the sensor output and the ADC input and a capacitor between the ADC input and ground. The capacitor value should be chosen for a 0.5 second time constant C = 0.5/2000 = 25uF (use 22uF).

    This will ensure that no noise above a few Hz will get into the ADC and may well help.

    If you don't have the right parts pretty much any value for R between 1k and 10k should work and any value from 1uF to 100uF for C. (Obviously if you use 10k and 100uF it will respond rather slowly but this probably won't matter.)

    Do you have access to an oscilloscope - if you do then you could look at the signal and see how noisy it is. 

    What power supply are you using ?

    MK

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • JWx
    0 JWx 26 days ago in reply to JWx

    put 

    analogReference(INTERNAL);

    in setup, then change sensorValue * 5.0 to something like sensorValue * 1.1

    (reference voltage is about 1.1V (min 1V, max 1.2V) - could be measured for better accuracy)

    • 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