Skip to main content

[Arduino project - 4] -- Calibrated Temperature Censor Displayed in LCD

Good Day all,
I didn't realize today is today, haha, because today is the time to do something awesome again with Arduino.
In the last talk, we made a temperature censor using Arduino which was displayed in our PC screen, it was pretty simple to do and i hope you could follow my instructions clearly because it was just to plug the censor into some pins, wrote some lines of simple code which you can copy and paste from my post, and did some clicks to show it in the monitor.
And now, since we have an LCD screen, we want our temperature to be displayed in it, not in our PC screen. What do we do now? here it is.

You're gonna need these stuffs (you can click on each stuff to see their pic. as I don't want to put their pics):
  1. Arduino Uno R3
  2. A temperature censor (LM35)
  3. Some (or maybe a lot of) jumper cables
  4. A bread board
  5. A potentiometer
  6. and of course, An LCD screen.
Then, if they've been prepared, we're gonna need to connect our Arduino with LCD like this:

The reason of why we need a bread-board is to give them a bridge since it's difficult to connect them directly. You can see in the picture above there is a resistor of 220 ohm needed. It is used to adjust the brightness of the backlight, but actually I did it without any resistor involved (although I cannot adjust the brightness, but it doesn't really matter). So, don't worry if you don't have any resistor.
Now we got to check whether our devices are connected correctly or not by displaying the text 'Hello world' into the LCD.
Connect Arduino to our PC which has arduino application installed.
Then write these lines of code below:

#include <liquidcrystal .h> // include the library code</liquidcrystal>
//constants for the number of rows and columns in the LCD
const int numRows = 2;
const int numCols = 16;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup()
{
lcd.begin(numCols, numRows);
lcd.print("hello, world!"); // Print a message to the LCD.
}
void loop()
{
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}


And paste them into the Arduino Application which is installed in your PC. Then, press the  verify button and next press the upload button.

We can see the text said 'Hello world' in our LCD. If you don't, you need to adjust the text brightness by turning the potentiometer switch. This is my work:



Ok. we did it.
Now, what we need is to put the temperature censor. It will do exactly like my last post. Connect the censor to arduino like this.
And then, we got to make a little change inside our recent code to be like this:


Then, verify and upload the code. We're gonna see the temperature in our LCD.

Honestly, we're done. We have our censor is working, and displaying the temperature in our LCD. But, one thing we do need to do is to calibrate our censor so that it will show the temperature correctly, well almost correctly.
How do we calibrate our censor?
We need to see the room termometer or any kind of termometer will work. You need to compare the temperature displayed in the termometer with the result in our LCD. In my experience, I got the temperature in my LCD is higher than the real (than what was seen in the termometer) with the deviation of 0.18 degree celsius. To fix this, we need to add or subtract the result of our censor which is shown in this line 19th in the above code.
float celsius = (millivolts / 10)-0.18;  // sensor output is 10mV per degree Celsius
And here it is. Our result will be like this:
Image:


Image: The termometer to calibrated the temperature

Video:


Ok, we're done. I hope this will be useful...
Thanks for visiting my blog.

Comments

Popular posts from this blog

Derita Laptop Ganti: Sahabat Lama Menjadi Asing Bagiku

Sekitar satu tahun yang lalu, aku dan kakakku Mba Lala , tukeran laptop karena ada sedikit masalah dengan OS laptop mba lala, jadi aku memutuskan untuk membawanya buat dibenerin di comlabs aja. Satu tahun berlalu, hari demi hari aku lalui bersama laptop mba lala itu. Susah dan duka (susah dan duka ?) aku lalui bersama laptop toshiba hitam berkulit berudu. Ada kalanya seneng, ada kalanya juga engga. Ada kalanya dia responsif, tapi ada kalanya juga bebel ngambek engga nurut gerakan jari jemari yang bikin hati kesel. Tapi lebih dari itu, tanpa terasa ikatan batin antara aku dan laptop yang engga bisa aktifin bluetooth itu terjalin begitu kuat. Aku seolah tahu dimana letak file movie hanya mengklik ini dan itu dengan mata terpejam bahkan sambil tidur dan mimpi lelap. Aku sudah terbiasa dengan tata letak, environment, dan workspace yang terbangun didalamnya. Dan yang paling penting, laptop tipe satelite itu telah membantuku dalam menyelesaikan berbagai badai tubes dan tucil, membantuku di...

Visiting Animals with My Family

Big day, big day, big day.... /XD Yup, this is a very big day, for me. Why? Because, my parents, and my brother, are coming. I'm pretty excited, but also nervous. You know how it feels when you have a very messy room, and you got your parents are coming? Or you don't know what to do with your family as you have a tiny sized room? Arrhg /shock, it's complicated. But very exciting too. X-D First time of our journey, we were arriving at Sabuga. One of the lovely building style in here (ITB) is the classical stone that covers almost in all the part of the building... Oho, what is this? :P I was not using a professional camera, and I'm not a photographer too, so I couldn't make a good one. hehe. Bye the way, this is under the ground pipe.. Some places in ITB are unique (people said that), and one of them are 'echo point'. This place, if you speak up loud enough, will be able to spread out into all around of ITB and everyone's gonna...

Ramadhan 1435H & Silaturahmi keluarga

Baju baru alhamdulillah, tuk dipakai di hari raya, Tak punya pun tak apa-apa, masih ada baju yang lama. Sepatu baru alhamdulillah, tuk dipakai di hari raya, Tak punya pun tak apa-apa, masih ada sepatu yang lama. Kue baru alhamdulillah, tuk dimakan di hari raya, Tak punya pun tak apa-apa, masih ada kue yang lama. /wahaha Alhamdulillah, tidak terasa ramadhan telah berlalu. Rasa syukur ku kepada Allah SWT. karena telah diberi kesempatan untuk bisa bertemu ramadhan tahun ini sampai selesai. Meskipun Ramadhan udah selesai, semoga hati dan jiwa tetap fitri dan selalu terjaga. Ramadhan kali ini sangat menyenangkan meskipun setengahnya aku jalanin tanpa keluarga, tanpa sanak saudara yang menemani jerih payah puasa. /sweat Tapi ngga papa, yang penting inti dari ibadah bulan ramadhan tetep didapat. #intinya apa ya? Seperti ramadhan-ramadhan sebelumnya, setiap satu minggu sebelum lebaran ibu (dan aku) pasti bikin kue-kue penghias meja. Kali ini pun sama. Aksi bikin kue pun terjadi...