Introduction: Arduino Nano and Two DS18B20 Temperature Sensors With I2C LCD

Today I want show to you how to make Two temperature sensors DS18B20 with Arduino Nano Clone and I2C LCD.
// Dnes bych vam chtel ukazat, jak zprovoznit dve teplotni cidla DS18B20 s Arduino Nano klonem a I2C displejem.

I use Arduino IDE 1.8.8 // Pouzivam Arduino ve verzi 1.8.8 (toho casu aktualni verze)

In comment you can see // Czech language

We need to measure two temperatures and see these temperatures on display.
As you can see, we have 16x2 I2C display, that means 1 row = 1 temperature.

// Potrebujeme merit dve teploty a tyto teploty zobrazit na displeji.
// Jak jste si vsimli, mame 16x2 displej v nasem pripade to znamena 1 radek = 1 teplota.

Step 1: Prepare // Priprava

What we need // Co budeme potrebovat:

  • 1x Arduino Nano or Clone (I have compatible clone with CH341)
  • 1x I2C LCD (I have 16x2 with blue backlight)
  • 2x Dallas temperature sensors DS18B20 (I have waterproof version)
  • 1x 4,7k resistor

My recomended:

  • Arduino Nano terminal shield (with screws) // Doporucuji pro instalaci Arduino Nano terminal shield
  • For test assembly circuit we can use breadboard // pro otestovani pouzijeme nepajive pole


Info:

For Win10 64bit users, I had a big problem finding the right drivers. All recommended drivers did not work.
That's why I added the functional drivers to download. Also you can download actualy drivers here.

// Pro uzivatele Win10 64bit, mel jsem velike problemy najit funcni ovladace. Vsechny doporucovane ovladace
// (vcetne ovladacu na strankach obchodu) nefungovaly. Proto jsem pridal v mem pripade funkcni ovladace ke
// stazeni. Aktualni verzi ovladacu, muzete stahnout zde.

How to install drivers very briefly:

  • Download drivers.zip //Stahnete ovladace
  • Extract drivers.zip into folder
  • Install the drivers // Nainstalujte ovladace
  • Connect Arduino Nano // Pripojte Arduino Nano

Properly installed drivers you can check in the Windows Device Manager

// Spravne nainstalovane ovladace muzete zkontrolovat ve Spravci zarzeni Windows

Now we can run Arduino IDE // Nyni muzeme spustit Arduino IDE

We must choose correct options in the Arduino IDE in our case it is: // V Arduino IDE musite vybrat spravne nastaveni

  • Right board Arduino Nano // Arduino desku
  • For Nano Clone (328P Old bootloader) // Pro klon vybereme (Old bootloader)
  • Communication Port // komunikacni port

Step 2: Circuit Assembly // Zapojeni Obovdu

Temperature sensors allows parasitic wiring. This will not be described here.
For more information about parasitic wiring use google.com

// parazitni zapojeni teplotnich senzoru zde nebudu popisovat. Pokud chcete vice informaci o parazitickem zapojeni cidel pouzijte google.com

Info:

  • PIN A4 - SDA
  • PIN A5 - SCL

Warning:

Solder and tin can be HOT! ;-) // Neopalit se, je zaklad ;-)

The second photo is a possible result.

    Step 3: Arduino IDE Search the Address

    Assuming everything works, we can run Arduino IDE
    // Za predpokladu, ze vse funguje, muzeme spustit Arduino IDE

    This step have three sub steps: // Tento krok ma tri dilci kroky

    1. Find the address I2C LCD // Najdeme adresu I2C displeje
    2. Find the ROM address temperature sensors // Najdeme adresu teplotnich cidel
    3. Our thermometers code // nas vlastni kod
    1. Find / Check I2C address
      Easiest way to find address is use prepared I2C_scanner.ino
      Copy to Arduino IDE
      Upload to the Board
      Show serial Monitor (copy the address, we will need it)

    2. Find ROM address
      Repeat first step with DS18B20_finder.ino
      Show serial Monitor (copy the address, we will need it)

    Our own code is next step...

    Step 4: Arduino IDE Own Code and Features // Vlastni Kod Teplomeru a Funkce

    We have all necessary information. Let's look at your own code.
    // Mame vsechny potrebne informace, pojdme se podivat na nas kod.

    Info:For sure, all important steps on the photos are commented
    // Vsechny dulezite kroky na fotografiich jsou komentovany.

    Specification resolution: // Specifikace rozliseni teplotnich senzoru

    Resolution / Increment / Time

    9 bit / 0.5 degrees C / 93.75 mSec
    10 bit / 0.25 degrees C / 187.5 mSec
    11 bit / 0.125 degrees C / 375 mSec
    12 bit / 0.0625 degrees C / 750 mSec

    -------------------------------------------------------------------------------------------

    Thermometer char

    byte teplomer[8] = // coding thermometer char (vytvoreni znak teplomeru)
    {
    B00100,
    B01010,
    B01010,
    B01110,
    B01110,
    B11111,
    B11111,
    B01110
    };

    -------------------------------------------------------------------------------------------

    If you want any another char, you can make on this site

    // Pokud chcete vytvorit jakykoli vlastni znak, muzete pouzit tento generator


    Celsius char (°)

    lcd.print((char)223);

    Restriction of decimal places // Omezeni poctu desetinnych mist

    If for some reason you only need one decimal place

    // Pokud z nějakého důvodu potřebujete pouze jedno desetinné místo

    lcd.print(read_temperature(),1); // 1 (the number 1 specifies the number of decimal places)

    // Cislo 1 udava pocet desetinnych mist

    Step 5: Finish - Gallery // Konec - Galerie

    And few words in the end...?

    I hope it was useful and helped us.

    Many features can be more and better, but in my case it's all I need.

    That's all friends!!

    //

    Par slov na zaver?

    Doufam, ze jsem nam pomohl. Mnoho funkci muze byt pridano a mohou byt lepsi, ale v mem pripade to bylo vse co potrebuji.

    To je vse, pratele!!