07 May 2013

Virtual Thermometer


I've recently bought a book for learning Visual Basic (VB) since I've never learned them. I have not yet finished the book, but due to my hype towards microcontroller, I've already worked on a simple project which uses both VB programming and an Arduino.

The project is simple, it sense the surrounding temperature using a temperature sensor, Arduino reads it and sends it serially to a computer running a program written in VB. The program will then display the temperature continuously.

Although simple, the highlight of this project is the algorithm I wrote (which probably already thought of by some other people) to let the user to use the program right away without needing to select the baud rate or serial port for the serial communication with the Arduino. It will automatically be selected in the background.

The connection for the Arduino and temperature sensor (LM35) is as follow. The Arduino is then connected to a computer via the USB cable.
Connection between Arduino and LM35


The program written in VB (for now named Temp Sense) will display the temperature as follow. Inside the form TempSense, there' two label, one for displaying the temperature and another is the degree celcius symbol (°C). There's also a status bar displaying the serial port which is connected to the Arduino.

The program's interface



Below is the code for VB program.




Below is the code for Arduino



As confident as I wrote this post, the project is actually not going that well. I have not done enough research and learned everything that I should. The program does receive and display the temperature, but the problem is, the program is "locked". It cannot be closed when it reaches the looping state. I'm still finding ways to let the loop runs without disabling the controls of the program. Any help with this problem is very much appreciated. Leave a comment.

That is it for now. Looking forward for solution and probably other project.


Credit the first picture from:
http://hanez.org/2011/04/11/arduino-lm35-temperature-sensor/

No comments: