A standalone arduino device that signals an increase (decrease) in temperature

Posted by Jaroslav Vitol on

Introduction.


This device is intended for detecting the temperature in the region. Since I did not find the right I finished the instructions for the assembly of the device, and buy thousands of 2+ did not want to, it was decided to do everything on the Arduino (not expensive and not very difficult).

Assembly instructions.


we need to build the project:

  • Temperature sensor DS18B20 1 meter. (Sealed)
  • 0.96 128x64 OLED screen
  • Breadboard
  • Set of wires Papa Papa
  • Arduino Uno microcontroller
  • Resistor

To implement the project, we need to install arduino IDE and several libraries:

  • OneWire Arduino Library
  • OLED I2C_OLED_I2C with support for Russian and Ukrainian languages.
  • Dallas temperature

Let's talk a little bit about the breadboard. This breadboard used for rapid assembly of circuits without soldering and radioelements, and wire for connection. Boards come in different sizes, but in most cases they consist of identical blocks like these:

image

Electrical connection sockets shown in the right figure, five holes on each side, each of the rows (in this case 30) are electrically interconnected. Left and right are two supply lines: here all the holes in the column are interconnected. The slot in the middle intended for installation and easy removal of chips in the housings. To assemble the circuit are inserted into the holes and the radio bridge.

After we finished with breadboard, we can proceed to connect the module. To connect the beginning of the display as follows:

image

image

In this case we connected 5V to the "+" on the breadboard (yellow wire) and GND to the "-" (white wire) to subsequently all power to the module is connected to the "+" and "-" on the breadboard.

Further connect DS18B20 temperature sensor using a resistor as shown in the photograph below:

image

image

In this case, for convenience, we have connected all of the sensor wires to the breadboard and orange wire "Dad-Dad" connected to Pin 10.

Half the battle is done, it remains only to connect the signaling device, namely: x2 LED (red for high temperature, blue for low) and conventional piezo buzzer (in common "beeper"). The LED is connected is very simple, "+" is a long rod, and minus is a short rod. Insert it into the card that connect to it necessarily resistor and with the help of wires, "Dad-Dad" connect the short rod 5 blue LED to Pina and short rod red LED 12 to Pina.

Squeaker simply connect the black wire to "-", the red wire to 13pinu.

That's all you should get:



Most importantly (sketch).

#include <Wire.h>
#include <Wire.h>
#include <OneWire.h>
#include <DallasTemperature.h> //подключение библеотек для DS18B20
#define ONE_WIRE_BUS 10 // pin к которому подключен DS18B20
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
#include <OLED_I2C.h>
OLED  myOLED(8, 9, 8); // Подключение дисплея, 8 pin-SDA, 9pin-SCL
extern uint8_t RusFont[]; // Русский шрифт
extern uint8_t BigNumbers[]; // Большие цифры
extern uint8_t SmallFont[]; // Маленький шрифт
void setup()
{
  pinMode(13, OUTPUT); // Объявить pin 13 как выход
  pinMode(12, OUTPUT);// Объявить pin 12 как выход
  pinMode(5, OUTPUT); // Объявить pin 5 как выход
  sensors.begin();// Включение датчика
  myOLED.begin();// Включение дисплея
  myOLED.setFont(RusFont);
}
void loop()
{
  if (sensors.getTempCByIndex(0)>70){ //Проверка датчика температуры(при температуре >70 будет включаться лампочка и сирена)
  digitalWrite(5,255);// Включение лампочки
  tone(13, 2500); // Включаем звук 2500 Гц
  delay(400);// Пауза 0.4 сек
  digitalWrite(5,LOW);// Выключение лампочки
  }
  else{
    digitalWrite(5,LOW);
  }
  if (sensors.getTempCByIndex(0)<25){  //Проверка датчика температуры(при температуре <45 будет включаться лампочка и сирена)
    digitalWrite(12,255); // Включение лампочки
    tone(13, 2500); // Включаем звук 2500 Гц
    delay(400); // Пауза 0.4 сек
    digitalWrite(12,LOW); // Выключение лампочки
  }
  else{
    digitalWrite(12,LOW);
  }
  if ((sensors.getTempCByIndex(0)<70) and (sensors.getTempCByIndex(0)>45)){
  noTone(13); // Выключаем звук
}
sensors.requestTemperatures();
myOLED.clrScr(); // Очищаем экран
myOLED.setFont(RusFont);
myOLED.print("Ntvgthfnehf", CENTER, 0); // Вывод текста русскими буквами
myOLED.setFont(SmallFont);
myOLED.print("vk.com/tupo_izi123", CENTER, 55); // Вывод текста 
myOLED.setFont(BigNumbers);
myOLED.print(String(sensors.getTempCByIndex(0) , 1), CENTER, 10);   // Отображение значения температуры, с точностью до десятых
myOLED.update();
delay(100);
}

In this sketch I have exhibited the temperature is above 70 and below 45 degrees, you can also put any other (-55 to +125 ° C).

Photos of the final product:

image

0 comments

Leave a comment