Interfacing PIC16F887 with LM335 temperature sensor – CCS C compiler

This is an example showing how to connect LM335 temperature sensing device with PIC16F887 microcontroller.

The LM335 is an analog device which requires an ADC module to convert the analog data which is the voltage output from the LM335 into digital data. The LM335 has the following features:

  • Directly Calibrated to the Kelvin Temperature Scale
  • 1°C Initial Accuracy Available
  • Operates from 400 μA to 5 mA
  • Less than 1-Ω Dynamic Impedance
  • Easily Calibrated
  • Wide Operating Temperature Range
  • 200°C Overrange
  • Low Cost

The LM135 has a breakdown voltage directly proportional to absolute temperature at 10 mV/°K. If the LM335 output voltage is for example is 3.03 (3030 mV) that means the temperature is: 303 °Kelvin = 30 °Celsius.

Hardware Required:

  • PIC16F887 Microcontroller
  • LM335 Temperature sensor
  • 16×2 LCD Screen
  • 10K ohm potentiometer or variable resistor
  • 2.2K ohm resistor
  • 0.1µF Ceramic capacitor (optional)
  • +5V Power supply source
  • Breadboard
  • Jumper wires

PIC16F887 LM335 temperature sensor hardware circuit

Interfacing PIC16F887 with LM335 sensor circuit:
This is our example circuit where the microcontroller uses its internal oscillator.
The LM335 has 3 pins:
Pin 1 for calibration, not used in this example
Pin 2: output
Pin 3: GND (ground)

PIC16F887 LM335 temperature sensor circuit

Interfacing PIC16F887 with LM335 sensor C code:
The C code used in this example is as the one below where it has been compiled with CCS PIC C compiler version 5.051.

The following video shows Proteus simulation of LM335 and PIC16F887:

Proteus simulation file can be downloaded from this link:
PIC16F887 + LM335 – Proteus

LM335 Datasheet

Leave a Comment

Your email address will not be published. Required fields are marked *

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

Scroll to Top