Source: https://mokxi.com/lm35-simulator

Simulator

# An LM35 simulator: a temperature sensor on an Arduino

Mokxi is a free online LM35 temperature sensor simulator that runs in your browser, with nothing to install and no account needed. An LM35 on A0 of an Arduino Uno, read with analogRead five times a second. Drag the temperature and the serial monitor prints the raw count and the millivolts, so you can check the math in your sketch before the sensor is on a breadboard.

Start building free or read about ADC resolution

- 455 parts on the bench
- 43 boards running now
- 1.00x real time, on every board

Click to open it in the editor

The LM35 starts at 22.5 °C. Drag its slider to change the temperature, then click the circuit to open it in the editor and watch the serial monitor print the count and the millivolts.

## What you can do here

In the circuit above, or in the editor it opens.

- Set the temperature anywhere from -55 to 150 °C
- Read the raw analogRead count and the millivolts on the serial monitor
- Turn millivolts into degrees: divide by ten
- See why one count is about half a degree on a 5 V Uno
- See what a single supply does below 0 °C
- Add an LCD or a fan and build a thermostat

## What the running circuit shows

10 mV a degree, with no offset.

An LM35’s middle leg puts out 10 mV for every degree Celsius, starting from 0 V at 0 °C. At the 22.5 °C it starts on, that is 225 mV, and the Uno reads a count of 46, which the sketch prints as 224 mV. Drag it to 25 °C and the line becomes a count of 51 and 249 mV; at 37 °C, 76 and 371 mV; at 100 °C, 205 and 1001 mV. Divide the millivolts by ten and you have the temperature.

Those readings sit a little under the truth, and the reason is the useful part. analogRead splits 0 to 5 V into 1024 steps, so one count is about 4.9 mV, nearly half a degree. 225 mV falls between counts 46 and 47 and reads as 46, and no reading can be finer than that half degree. A sketch that prints 22.46 °C is printing digits the hardware never measured.

Drag the slider below zero and the reading stops at a count of 0. With its ground leg on ground and one supply, an LM35 cannot go below 0 V, so it reads 0 °C for anything colder. The datasheet’s way to read below zero needs a resistor to a negative supply.

## How the sensor is modeled

The datasheet’s straight line, and what it leaves out.

The model is the datasheet’s transfer function: 10 mV a degree from 0 V, across the rated -55 to 150 °C, on a supply of 4 V or more; below 4 V it does nothing at all. That is the LM35’s main difference from the TMP36 beside it in the parts bin, which reads 500 mV at 0 °C so that it can go below zero on one supply. Use one part’s formula on the other and the reading is 50 degrees out.

What it leaves out: the sensor’s own error, about half a degree at room temperature; self-heating; the time it takes to follow a change; and noise. The model has none, so the count holds still. On a real bench a reading that jumps by a count or two usually comes from a long wire to the sensor or a motor on the same supply, and averaging a few readings settles it.

The TMP36 tutorial, the LM35 with an offset A temperature data logger lab Analog pins and ADC resolution The thermistor simulator

## Questions

Is it free?

Yes. The circuit on this page, every part in it and the editor it opens in are on the free plan, with no card.

Do I need an account?

No. The circuit runs the moment the page does, and the editor opens without one. A free account is only for saving a project to the cloud and sharing it by link.

How do I convert LM35 output to Celsius on an Arduino?

On a 5 V Uno, multiply the count by 500 and divide by 1023: a count of 51 is about 24.9 °C. That is the count turned into millivolts, then divided by the LM35’s 10 mV a degree.

What is the difference between an LM35 and a TMP36?

Both give 10 mV a degree. The LM35 reads 0 V at 0 °C and needs 4 V or more; the TMP36 reads 500 mV at 0 °C, so it can measure below zero on one supply, and it runs from 2.7 V. Use the formula for the part you have.

Can an LM35 read negative temperatures?

Not wired the usual way, with its ground leg on ground: it stops at 0 V, and here the count stops at 0. The datasheet’s full-range circuit adds a resistor from the output to a negative supply.

## More simulators

Each one opens on a circuit that is already running.

Online circuit simulator Breadboard simulator ESP32 simulator Op-amp simulator Logic gate simulator LED circuit simulator Servo simulator LCD simulator OLED simulator NeoPixel simulator 7 segment display simulator LED matrix simulator Stepper motor simulator Motor driver simulator Ultrasonic sensor simulator Rectifier simulator Digital circuit simulator Potentiometer simulator PWM simulator Relay simulator Shift register simulator DHT11 simulator RFID simulator Accelerometer simulator RGB LED simulator Buzzer simulator MOSFET simulator Circuit simulator for kids Flip-flop simulator Multiplexer simulator Full adder simulator I2C simulator UART simulator Thermistor simulator PIR sensor simulator Oscilloscope simulator Multimeter simulator DC motor simulator Traffic light simulator Diode simulator Capacitor simulator Series and parallel circuit simulator Wheatstone bridge simulator Voltage regulator simulator Soil moisture sensor simulator Zener diode simulator Solar panel simulator AC circuit simulator Thevenin simulator Decoder simulator Encoder simulator PID simulator Robot arm simulator Load cell simulator IR sensor simulator HC-05 Bluetooth simulator nRF24L01 simulator

## Take a temperature

Open the circuit, drag the temperature and read the count. Nothing to install, and no account needed.

Start building free Open the editor
