1. Trang chủ
  2. » Giáo Dục - Đào Tạo

DESIGNING TEMPERATURE MEASURING CIRCUIT USING BOARD ARDUINO, DISPLAY ON 16x2 LCD SCREEN AND LED WARNING SYSTEM

25 13 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

HANOI UNIVERSITY OF SCIENCE AND TECHNOLOGY SCHOOL OF ELECTRICAL ENGINEERING ====o0o==== REPORT OF PROJECT PROJECT NAME: DESIGNING TEMPERATURE MEASURING CIRCUIT USING BOARD ARDUINO, DISPLAY ON 16X2 LCD SCREEN AND LED WARNING SYSTEM Project Supervisor: Project Reporter: Student ID: Class: M.S Đinh Thi Lan Anh Nguyen Thanh Nam 20181909 Advanced Program for Electrical Engineering and Automation 01 K63 HA NOI, 5/2021 download by : skknchat@gmail.com Preface Based on the knowledge learned in the subject: Introduction to Computer Science, Analog Electronics and Digital System Design along with the understanding of electronic devices, I decided to carry out the topic: “Designing temperature measuring circuit using board Arduino, display on 16x2 LCD screen and LED warning system” with the aim to learn more about Arduino, familiarize myself with electronic devices and improve selfknowledge In this project I used board Arduino Uno, temperature sensor LM35 and LCD 16x2 display I used Proteus software to design the circuit and run stimulation and Arduino IDE for programming the code After being installed and loaded with code, the circuit has fully fulfilled its initial purposes In terms of practical application, we can develop this project so that it can be applied to drying ovens or adjust fan speed based on ambient temperature and so on Due to limited knowledge of the first time doing a project, it is inevitable that there will be shortcomings and limitations, so I am looking forward to getting suggestions and reminders from teacher to complete my project I would like to sincerely thank teacher M.S Đinh Thi Lan Anh for helping me a lot in the process of researching, designing and completing this project Performing student Nguyen Thanh Nam download by : skknchat@gmail.com TABLE OF CONTENTS CHAPTER OVERVIEW 1.1 Introduction about Arduino and Arduino IDE 1.1.1 Arduino 1.1.2 Board Arduino Uno R3 1.1.3 Arduino IDE and Arduino programming language 1.2 Introduction about LM35 temperature sensor 1.3 Introduction about LCD 16x02 and module I2C for L 1.3.1 LCD 1.3.2 Module I2C LCD CHAPTER DESIGN AND PROGRAM THE PROJECT 2.1 Designing and simulating the circuit on Proteus 2.1.1 Designing the circuit 2.1.2 Simulation 2.2 Programming the project 2.3 Installation and test-running on test board 2.4 Funding for project implementation CHAPTER CONCLUSION REFERENCES download by : skknchat@gmail.com LIST OF FIGURES Figure 1.1 Board Arduino Uno R3 Figure 1.2 Parts of Arduino Uno R3 Figure 1.3 Interface of Arduino IDE Figure 1.4 LM35 temperature sensor Figure 1.5 Pins of LM35 Figure 1.6 LCD 16x02 Figure 1.7 LCD 1602 pins 10 Figure 1.8 Parts of Module I2C LCD 11 Figure 2.1 Block diagram of the circuit 13 Figure 2.2 The circuit designed on Proteus 13 Figure 2.3 Connection between LCD1602 and module I2C for LCD 14 Figure 2.4 Circuit stimulation in case the temperature is below the appropriate level 14 Figure 2.5 Circuit stimulation in case the temperature is in the appropriate level 15 Figure 2.6 Circuit stimulation in case the temperature is above the appropriate level 15 Figure 2.7 Test running in case the temperature is in the appropriate level Figure 2.8 Test running in case the temperature is above the appropriate level 18 18 download by : skknchat@gmail.com CHAPTER OVERVIEW 1.1 Introduction about Arduino and Arduino IDE 1.1.1 Arduino Arduino was first invented in the Italian town of Ivrea and was named after a king in 9th century, King Arduin Arduino was officially introduced in 2005 as a tool for the students of Professor Massimo Banzi, one of the first Arduino developers, at the Interaction Design Instistute Ivrea (IDII) In recent years, Arduino is really famous among the DIY users worldwide (who invent their own products) The number of users is extremely large and their age range is extending from high school to university, which made its creators surprised The Arduino is actually a microprocessor board which is used for programming to interact with hardware devices such as sensors, motors, lights or other devices Especially Arduino has itself an extremely easy-to-use application development environment, with a very simple programming language which can be use easily even by those who don’t know much about electronic devices and programming And what makes the Arduino a phenomenon is the very low price and the open-source hardware and software In this project, we use the board Arduino Uno R3 which cost us only 110.000 VND 1.1.2 Board Arduino Uno R3 Figure 1.1 Board Arduino Uno R3 download by : skknchat@gmail.com Arduino Uno R3 board‘s central processing unit is an AVR microcontroller Atmega328 The main structure of Arduino Uno includes the following parts: -USBplug:Thisisthecommunicationportforustouploadcodefrom thePCto themicrocontroler.Itisalsotheserialcommunicationfordatatransmissionbetweenthe microcontrolerandthecomputer -Powerplug:toruntheArduino,wecanpoweritwiththeUSBportabove,butin othercaseswhenwecan’tconnectitothecomputer,wecanuseasourceof9Vto12V instead -Thereare14input/outputpinsnumberedfrom 0to13,besidethat,thereisa groundingpin(GND)andareferencevoltagepin(AREF) -AVRmicrocontroler:thisisthecentralprocessingunitoftheentireboard.With eachArduinomodeltherearedifferentchips.InthisArduinoUnoweuseATMega328 Figure 1.2 Parts of Arduino Uno R3 -ThedetailedparametersofArduinoUno: Processor: ATmega328 Operatingvoltage: 5V Inputvoltage(operational): 7-12V Inputvoltage(lmit): 6-20V DigitalI/Opins: 14 Analoginputpins: 6 download by : skknchat@gmail.com Maximum currentineachpin: 40mA Currentinpin3.3V: 50mA Flashmemory: 32KB(ATmega328) SRAM: 2KB(ATmega328) EEPROM: 1KB(ATmega328) Clock: 16MHz 1.1.3 Arduino IDE and Arduino programming language TherealpowerofArduinoliesinitssoftware.TheArduino’sprogrammingenvironmentis veryeasytousewiththeWiringprogramminglanguagebasedonC/C++whichisso familiartostudentsandengineers.Moreover,therearealotofpre-writencodessharedby theopen-sourcecommunity ArduinoIDEisthesoftwarewhichweusetoprogram Arduino.ArduinoIDEprogramming environmentisabletorunonthethreemostpopularoperatingsystemstoday:Windows, MacintoshOSXandLinux.Duetoitsopensourcefeature,thisprogrammingenvironment iscompletelyfreeandcanbeextendedbyexperiencedusers TheprogramminglanguagecanbeextendedthroughC++libraries.Andasthislanguage isbasedontheClanguageofAVR,userscanembedcodewriteninAVRintotheprogram iftheywant.Currently,theArduinoIDEcanbedownloadedfrom the homepagehtp:/arduino.cc/includeofthesefolwingversions: -Arduino1.0.5 -Arduino1.5.5BETA(SupportforthetwolatestArduinoboards:ArduinoYunand ArduinoDue) -ArduinoIDEforIntelGalileo download by : skknchat@gmail.com Figure 1.3 Interface of Arduino IDE 1.2 Introduction about LM35 temperature sensor TheLM35sensorisahighprecisionintegratedcircuithermalsensorwhoseoutputs voltageislinearlyproportionaltotheCelsiusscaletemperature.Each10mVdifferenceof outputvoltagegivesusadifferenceof1degreeinCelsiusscale.Theydonotrequire externalcalibrationbecausetheyhavebeencalibrated Figure 1.4 LM35 temperature sensor LM35sensorhas3pins: +SourcepinsVCC +OutputpinsVout(analogpins) +GroundpinsGND download by : skknchat@gmail.com Figure 1.5 Pins of LM35 MainfeaturesoftheLM35sensor: -Inputvoltagefrom 4Vto30V -Outputvoltageresolutionis10mV/˚C -Highaccuracyat25˚Cis0.5˚C -Outputimpedanceislow0.1for1mAload ThemeasuredtemperaturerangeofLM35is-55˚Cto150˚Cwithotheroutputvoltages together.Considerthefolwingvoltagelevels: -Temperature55˚C,outputvoltage-550mV -25˚Ctemperatureoutputvoltage250mV -150˚Ctemperatureoutputvoltage1500mV Inthiscircuit,wecanmeasurethetemperaturerangefrom 0˚Cto110˚C 1.3 Introduction about LCD 16x02 and module I2C for LCD 1.3.1 LCD download by : skknchat@gmail.com Figure 1.6 LCD 16x02 LCD1602 text-displaying screen using HD44780 driver, it can display lines with 16 characters each The screen is durable, very popular, has a lot of sample code and easy to be used, which is suitable for beginners and those who make projects Some main features of LCD1602: The operating voltage is V Dimensions: 80 x 36 x 12.5 mm White text, blue background The distance between the two connecting pins is 0.1 inch handy when connecting to the breadboard The names of the pins are written on the back of the LCD to support the connection and wiring With LED backlight, can use variable resistor or PWM to adjust the brightness to use less power Can be controlled with signal wires There is a built-in character set that supports English and Japanese, see also HD44780 datasheet for more details 10 download by : skknchat@gmail.com Pin Name Ground (VSS) Vcc (VDD) RS (Register Select ) RW (Read/Write) 10 11 12 13 14 Enable Vo/VEE Selects command register when low, and data register when high Low to write to the register; High to read from the register Sends data to data pins when a high to low pulse is given; Extra voltage push is required to execute the instruction and EN(enable) signal is used for this purpose Usually, we set en=0, when we want to execute the instruction we make it high en=1 for some milliseconds After this we again make it ground that is, en=0 DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 11 download by : skknchat@gmail.com 15 16 1.3.2 Led+ (A) Led- (K) Module I2C LCD In reality, LCD has too many pins, making it difficult to connect and occupy many pins on the microcontroller The LCD I2C module was born to solve this problem Instead of taking microcontroller pins to connect to 16×2 LCD (RS, EN, D7, D6, D5 and D4), the I2C module only needs pins (SCL, SDA) to connect The I2C module supports LCDs using HD44780 drivers (LCD 16×2, LCD 20×4, …) and is compatible with most current microcontrollers Figure 1.8 Parts of Module I2C LCD Some main features of module I2C LCD: - Operating voltage: 2.5-6V DC Monitor support: LCD1602,1604,2004 (driver HD44780) Interface: I2C Default address: 0X27 (adjustable by shorting pin A0/A1/A2) Built-in Jump latch to supply LCD light or interrupt Built-in rheostat for LCD contrast adjustment To use the I2C interface LCD screen using Arduino, we need to install the Liquidcrystal_I2C library 12 download by : skknchat@gmail.com CHAPTER DESIGN AND PROGRAM THE PROJECT 2.1 Designing and simulating the circuit on Proteus 2.1.1 Designing the circuit To design the circuit, I first made a block diagram of the connection between the components as below: Input Microcontroller Output (LM35) (Arduino Uno R3) (LCD, LEDs) Figure 2.1 Block diagram of the circuit I decided to display on LCD the temperature measured by Celsius scale and Fahrenheit scale The LED warning system has the rule: blue LED for low temperature (lower than 30oC), green LED for suitable temperature (31o C to 35oC) and red LED for high temperature (higher than 35oC), the levels of temperature can be changed in specific situation I used Proteus software to design the circuit: Figure 2.2 The circuit designed on Proteus The LM35 temperature sensor need to be connected to ground, power source and the analog input pin of the Arduino To display the temperature, I used a LCD 16x2 connect 13 download by : skknchat@gmail.com with a module PCF8574 (I/O expander) The pin SCL and SDA of PCF8574 connect to the corresponding pins of Arduino In reality, the module PCF8574 has already been integrated in the I2C board, so we only need to connect all the pin of the LCD to all the pin of the I2C board Figure 2.3 Connection between LCD1602 and module I2C for LCD For the LED system, I connected one pin of each of them to the ground and other pins through 220 Ohm resistors and then to the output pins of Arduino The resistors are used for protecting the LEDs 2.1.2 Simulation After writing the code and loading the code successfully, the simulation circuit worked properly and satisfied desired functions Figure 2.4 Circuit stimulation in case the temperature is below the appropriate level 14 download by : skknchat@gmail.com Figure 2.5 Circuit stimulation in case the temperature is in the appropriate level Figure 2.6 Circuit stimulation in case the temperature is above the appropriate level 2.2 Programming the project To program the code for the project, I used Arduino IDE software 15 download by : skknchat@gmail.com As introduced in the previous chapter, the LM35 measures the temperature and outputs it as voltage (each 10mV difference gives us a difference of degree in temperature measurement scale) So that, to get the exact value of temperature, I use analogRead() function to read the voltage value from sensor LM35 The analogRead() function read the voltage value from an Analog pin (ADC), this function always returns an integer between and 1023 corresponding to the voltage scale from 0V to 1,1V After that, the temperature in Celsius scale can be calculated by the formula: celsius = (sensor * 1.1 / 1024.0) * 100 = sensor * 0.1074188 In this formula, sensor is the variable represents the voltage value output of LM35 sensor and celsius is the variable represents the temperature value in Celsius scale To convert to Fahrenheit temperature (oF), we use the formula: fahrenheit = celsius * 1.8 + 32 In this formula, fahrenheit is the variable represents the temperature value in Fahrenheit scale For the LED warning system, I used the if-else conditional structure If the circuit runs continuously, in some cases where the temperature changes fast, it may cause the display to flicker, so that I decided to make it delay 500s after each time the loop runs The whole code for the project is shown below #include LiquidCrystal_I2C lcd(0x27,16,2); int blue = 8; int green = 9; // Declare pin connects to blue LED // Declare pin connects to green LED int red = 10; byte degree[8] = { // Declare pin connects to red LED // Declare the "degree" character's pixel data 0B01110, 0B01010, 0B01110, 0B00000, 0B00000, 0B00000, 0B00000, 16 download by : skknchat@gmail.com 0B00000 }; void setup() { lcd.init(); // Start up the LCD screen lcd.backlight(); lcd.clear(); // Turn on backlight // Clear the LCD screen pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); // Declare OUTPUT pin analogReference(INTERNAL); //Adjust the reference voltage used for analog input for //proper operation lcd.createChar(1, degree); //Create the "degree" character } void loop() { lcd.setCursor(0, 0); int sensor = analogRead(0); int celsius = sensor * 0.1074188; int fahrenheit = ((sensor * 0.1074188) * 1.8)+32; lcd.setCursor(0, 0); lcd.print("Temperature is"); lcd.setCursor(1, 1); lcd.print(celsius); lcd.write(1); lcd.print("C "); lcd.print(fahrenheit); lcd.write(1); lcd.print("F "); if (celsius > 34) { digitalWrite(red, HIGH); digitalWrite(green, LOW); digitalWrite(blue, LOW); } else { if (celsius < 30) { digitalWrite(blue, HIGH); digitalWrite(green, LOW); digitalWrite(red, LOW); } else { digitalWrite(green, HIGH); digitalWrite(red, LOW); digitalWrite(blue, LOW); } } delay(500); } 17 download by : skknchat@gmail.com 2.3 Installation and test-running on test board When installing components on the test board, it is necessary to pay attention to the wiring and arrange the position of the devices so that it is reasonable to avoid entanglement, when making the pin connections, the components should refer to the standard datasheet of each component condition to avoid confusion, causing the circuit to fail or cause a short circuit to damage components During the installation of the circuit, I also encountered many small problems because of the quality of components or errors in wiring…, however, those problems were overcome and the circuit worked, the display functions and the alert works fine The circuit is installed exactly according to the principle diagram mentioned in previous sections The circuit works very well, the measured temperature is equal to the ambient temperature and changes properly when there is a heat source in contact with the sensor (in fact I used my hand and the circuit measured about 36 - 37oC) Figure 2.7 Test running in case the temperature is in the appropriate level 18 download by : skknchat@gmail.com Figure 2.8 Test running in case the temperature is above the appropriate level 2.4 Funding for project implementation ST Đơn giá (VNĐ) Thành tiền (VNĐ) 110 T 110 00 20 000 20 000 40 000 40 000 17 000 17 000 300 000 000 000 35 000 70 000 260 00 00 19 download by : skknchat@gmail.com CHAPTER CONCLUSION In conclusion, the project with topic “Designing temperature measuring circuit using board Arduino, display on 16x2 LCD screen and LED warning system” can perform the functions: - Measure the temperature on the Celsius scale (o C) and Fahrenheit (oF) - Display the result on LCD 16x2 screen - Show levels of temperature by LED warning system During the process of making and programming the circuit, there were many difficulties that I had to deal with due to the impact of the COVID-19 pandemic such as the shortage of electronic components, ; along with that, the lack of experience because of the first time doing a project led to some difficulties in the assembly of the circuit However, I completed the project and satisfied all the initial requirements In terms of practical applications, we can develop this project so that it can be applied to drying ovens to ensure the system keeps the right temperature, as well as receive timely warnings when the temperature is above or below the allowable level In addition, the circuit can be developed to apply in daily life such as controlling fan speed based on ambient temperature and so on Because this is the first time I have worked on a project, plus my knowledge is still limited, I find that my project still has a lot of errors and shortcomings I am looking forward to the support and help from teacher to make my project more complete and more improved and can be applied better in practice 20 download by : skknchat@gmail.com REFERENCES [1]Massimo Banzi, Getting Started with Arduino, O’Reilly Media, Inc, 2009 [2] Michael Margollis and Nicholas Weldin, Arduino Cookbook, O’Reilly Media, Inc, 2011 [3]http://arduino.cc [4]http://arduino4projects.com [5]http://randomnerdtutorials.com [6]http://techshowvn.com [7]http://www.airspayce.com/mikem/arduino/RF22/ [8]http://groups.google.com/group/rf22-arduino/ [9]http://electrodragon.com/ [10] http://blogembarcado.blogspot.de/ [11] http://arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo/ [12] http://www.youtube.com/channel/UCGSloFkUnaUknEZ21gmmvw? feature=watch/ [13] http://www.mediafire.com/download/v6bn0a7g3ep3y7o/nRF24L01p.rar/ 21 download by : skknchat@gmail.com ... CHAPTER CONCLUSION In conclusion, the project with topic ? ?Designing temperature measuring circuit using board Arduino, display on 16x2 LCD screen and LED warning system? ?? can perform the functions:... topic: ? ?Designing temperature measuring circuit using board Arduino, display on 16x2 LCD screen and LED warning system? ?? with the aim to learn more about Arduino, familiarize myself with electronic... pin connections, the components should refer to the standard datasheet of each component condition to avoid confusion, causing the circuit to fail or cause a short circuit to damage components

Ngày đăng: 25/04/2022, 08:51

Xem thêm:

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w