teprojects1

How to use Temperature Sensor 18B20 with Arduino in Proteus ISIS ???

Recommended Posts

Hello friends, hope you all are fine and having fun with your lives. In today’s post we are gonna have a look at How to use Temperature Sensor 18B20 in Proteus ISIS. I will use Arduino board as a microcontroller and will connect the temperature sensor with it and then will display the code on LCD. I have already posted the same tutorial in which I have done Interfacing of Temperature Sensor 18B20 with Arduino but in that project I have used the real components and designed the hardware. But today, I will just show you the simulation so that you could test the simulation first and then design it in hardware.

Temperature Sensor 18B20 is the most commonly used temperature sensor. Its a one wire sensor means it sends data through a single wire and we can connect multiple sensors with a single wire, that’s why its quite efficient and easy to use as well. I have also posted a tutorial on How to Interface LM35 sensor with Arduino in Proteus ISIS which is another temperature sensor so give it a try as well and let me know which one you think is better. Anyways let’s get started with temperature sensor 18B20 in Proteus ISIS.

HOW TO USE 18B20 IN PROTEUS ISIS ???

  • First of all, get these components from Proteus components list as shown in below figure:

18B20 in proteus, 18b20 arduino code, 18B20 code in proteus, 18b20 simulation,interfacing of temperature sensor with arduino

  • Now design the circuit as shown in below figure:

18B20 in proteus, 18b20 arduino code, 18B20 code in proteus, 18b20 simulation,interfacing of temperature sensor with arduino

  • As you can see in above simulation, we have used Arduino UNO board along with LCD and 18B20 temperature sensor.
  • 18B20 in Proteus can’t detect the real temperature but we can change the temperature by pressing + and – buttons.
  • So, now we have interfaced the temperature sensor and the LCD with Arduino. Next we are gonna design the code for Arduino and will upload it in Arduino baord.

Note:

  • Now download these three libraries, one is “one wire” library which is the protocol for 18B20 temperature sensor, next is the Dallas Temperature sensor library which is the actua library for temperature sensor 18B20 and uses one wire library. Third library is the Crystal LCD library which is used for displaying character on LCD.
  • So, download all these three libraries by clicking on below buttons and then paste them in your libraries folder of Arduino software.

Download One Wire LibraryDownload Dallas Temperature LibraryDownlaod Liquid Crystal Library

 

 
  • Now after adding these libraries, open your Arduino software and paste the below code into it.

 

 

    #include <OneWire.h>
    #include <DallasTemperature.h>
    #include <LiquidCrystal.h>

    #define ONE_WIRE_BUS 6
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensors(&oneWire);

    LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
 
    void setup(void)
    {
    Serial.begin(9600);
    Serial.println("Welcome to TEP !!!");
    Serial.println("www.TheEngineeringProjects.com");
    Serial.println();
    sensors.begin();

    lcd.begin(20, 4);
    lcd.setCursor(5,0);
    lcd.print("Welcome to:");
    lcd.setCursor(1,2);
    lcd.print("www.TheEngineering");
    lcd.setCursor(4,3);
    lcd.print("Projects.com");
    delay(5000);
    }

    void loop(void)
    {
    sensors.requestTemperatures();
    Serial.print("Temperature : ");
    Serial.println(sensors.getTempCByIndex(0));
    //lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Temperature: ");
    lcd.print(sensors.getTempCByIndex(0));
    lcd.print("C");
    delay(1000);
    }

  • Now get your hex file from Arduino and upload it to your Proteus Arduino board and hit the RUN button.
  • If everything goes fine then you will something like this at the start:

18B20 in proteus, 18b20 arduino code, 18B20 code in proteus, 18b20 simulation,interfacing of temperature sensor with arduino

  • After a delay of around 5 sec you will start receiving the Temperature sensor 18B20 values on your LCD as shown in below figure:

18B20 in proteus, 18b20 arduino code, 18B20 code in proteus, 18b20 simulation,interfacing of temperature sensor with arduino

  • Now you can see the value shown in the temperature sensor is the same as in LCD.
  • So, now by clicking the + and – buttons on temperature sensor, you can increase and decrease the value of temperature and same will be changed in LCD.

That’s how you can do simulation of Temperature sensor 18B20 in Proteus ISIS. Its quite simple and easy to use. That’s all for today, hope you get some knowledge out of it.

Edited by teprojects1
Edit the Code Which is not right

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now