Hot! Hot! Hot!Level: beginner
Last week we had a record heat wave in San Jose. TV and radio reminded us to keep kids and pets out of overheated car. I decided to check out how hot it was inside a car parked under the sun. I use the Temperature & Humidity module and the LCD2x16 to display the temperature.
As there won't be any circuit, we don't need any bread board. I can use the Command Board with the Basic Commander for this project. The Command Board looks exactly like the Education Board, except it does not have the bread board nor the xxxx pins. It can connect up to seven peripherals at the same time.
As a precaution, I checked the specificiation of the modules to make sure the operation temperature is within the range. Fortunately, both modules function under 120F. I connect the two peripherals to the cmdBus pins on the Command Board using the cmdBusTM cable, making sure to connect the red cable of the cmdBus to the VDD pin. Otherwise, it would damage the modules. As I am using two modules, I need to set the dip switch on each module to different ID. To see what ID it is set or how to change it, check the ID MAP.
Both the Temperature module and the LCD2x16 module have many built-in functions which makes programming a bliss. Let's check the Temperature module first. This module comes with several conversion functions between Celius, Fahrenheit, Kelvin scales. As the module's name indicates, it also has functions to detect humidity and dew.
Fortunately, the module is already calibarated and ready to use. For our small project, I simply took the sample code from the module's manual. The sample code includes functions for humidity and dew. As on a hot day like this, there won't be dew and humidity is probably zero. So I removed those lines and kept only the function GetTemp(). By default, the modules gets the modules in F. If you are in a country where Celsius is used, you can use ConvertF2C() to easily convert the value automatically to Celsius.
Peripheral MyTh As ThermometerA @ 0 'Set the module ID as 0 Dim fl_Temp As Float ' store temperature in F Dim fl_TempC As Float ' store temperature in C Sub Main() Do MyTh.Gettempf(fl_Temp) 'Get the temperature value MyTh.ConvertF2C(fl_Temp,fl_TempC) 'Convert the temperature from F to C Debug CLREOL,fl_Temp, "F ", fl_tempC, "C" 'show temperature in F and C Loop End Sub
myLCD.DisplayOn() 'enable the display myLCD.SetBacklight(255) 'set LCD brightness to the maximum value myLCD.Backlighton(0) 'LCD backlight on constantly myLCD.Display(fl_temp) 'display the temperature
Before I compile and build the program, I double check that I have set the DIP switch to the right number for the ID mapping as indicated in my program. Once that is done, I test the program indoor. It shows a nice 80 degree. But once I put in the car, the temperature jumped up to 107 within seconds.
What is Next?
The Temperature and LCD2x16 are very easy to use. I managed to build this project within minutes. There are many more built-in functions such as automatically detecting and recording the temperature, humidity and dew value. Adding the Time Keeper, you can make your own alarm clock with temperature and humidity. We'd love to see your results. Share your project ideas with us.
FAQ | Terms & Conditions | Contact Us