Remote Temperature Monitoring with Linux
Two choices were available to perform resistance-to-temperature conversion in the script. I could use a lookup table with pairs of resistance-to-temperature values in an array. The sheer number of elements in this array would be a drawback to this approach. A span from -40 degrees C to +40 degrees C requires 81 (don't forget 0 degrees C) pairs of values. There was no easy way to manipulate a text file available from the thermistor manufacturer, and entering the values by hand would take time and be prone to errors.
Instead, I used what's called the Steinhart-Hart equation (see sidebar). The equation was developed in the late 1960s to help process ocean temperature data collected with thermistors and provides direct conversion of resistance to temperature. A spreadsheet utility found on the Web helped with calculating coefficients unique to each family of thermistors and was used in the equation.
Once the script calculates temperature from a multimeter reading, it needs to be displayed or stored. With this in mind, I extended the test script to convert and display temperature, and show the time and resistance reading. University Linux uses the 2.0 kernel, and root user login by Telnet is allowed. When ordinary users attempt to run the grabtemp.pl script, an error is displayed because of the file permissions used for the serial port, /dev/ttyS1. I fixed this by changing permissions with:
chmod a+x /dev/ttyS1
Now, ordinary users could log in and run the script to check temperature. They wouldn't need root access.
Here is the output from the resulting showtemp.pl script:
/perlserial: perl -w showtemp.pl 01-05-2006 14:43 34 F 1.3 C 30.52 k Ohms
Here you can see the date, time, temperatures in degrees F and degrees C, along with the actual resistance reading. I checked the temperature where the sensor was located and found that the reading was accurate, so the conversion formula part of the script worked.
Not too many computer users are comfortable with using a command-line program interface. Web browsers with a point-and-click interface are a lot less intimidating. So, I extended the script once again to allow users to operate the system with a Web browser.
With the thttpd server configured and running, it was just a matter of directing the output from the script to build a Web page for display. This was fairly straightforward as the following code shows: shows:
print "content-type: text/html \n\n"; print "<HTML><BODY><P>"; print "<HEAD><title>Remote Temperature Measurement Page</title></HEAD>"; print "<H2>Mechanical Room</H2> "; print '<form action="webtemp.pl" method=post> <P> <P>'; print "Interior Air Temperature = $out_tempF<BR>"; print "<BR>"; print "<BR>"; print "Date: $out_date <BR>"; print "Time: $out_time <BR>"; print "<BR>"; print '<input type=submit value="Update Reading">'; print "</form>"; print "</BODY></HTML>";
Running the webtemp.pl script from /cgi-bin gives the user a display like the example shown in Figure 1.
This example shows the temperature in the room as well as the time and the date of the reading. You can press the Update Reading button to rerun the script and display another temperature value.
It is easy to write an extension to the script to log temperature over time. I put a line in the rc (boot) script that launches a data logging script, which then runs continuously in the background. I found that I could use measurement intervals of 5-10 minutes, because changes in air temperature are slow indoors in an air-conditioned space.
You can access the temperature log through the command line by using Telnet. Because the format was space-delimited, the date file was used with Microsoft Excel to plot graphs and view trends. You can see a sample output in Figure 2.
The overall objective was to create a reliable and easy-to-use electronic means to display and record temperature data. When you actually deploy the system, the location of the system and the network connection can vary widely. Depending on circumstances, you have to evaluate the security concerns for each installation. You may have to implement some workarounds to address the security concerns. For example, you can log temperature readings in the form of text or HTML pages by a script running in the background and not by a script in the cgi directory, which isolates the logging process from Web access. Alternately, you can gather data from this server using another secure server through FTP or HTTP. This would add another layer to prevent direct access by the outside world, but still make the information available.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
| Non-Linux FOSS: libnotify, OS X Style | Jun 18, 2013 |
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
| Introduction to MapReduce with Hadoop on Linux | Jun 05, 2013 |
- Containers—Not Virtual Machines—Are the Future Cloud
- Non-Linux FOSS: libnotify, OS X Style
- Linux Systems Administrator
- Validate an E-Mail Address with PHP, the Right Way
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Introduction to MapReduce with Hadoop on Linux
- RSS Feeds
- user namespaces
1 hour 26 min ago - yea
1 hour 51 min ago - One advantage with VMs
4 hours 20 min ago - about info
4 hours 53 min ago - info
4 hours 54 min ago - info
4 hours 55 min ago - info
4 hours 57 min ago - info
4 hours 58 min ago - abut info
5 hours 19 sec ago - info
5 hours 1 min ago
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?






Comments
Try ipmitool
Try ipmitool - read the man page.
Linux Temperature Sensor
I know this is an old post, but if your looking for a temperature sensor to use with Linux, try a google search for DirecTemp or contact Quality Thermistor.
They have a virtual serial version that works well.
Alternative solution
Nice article about connecting digtal multimetr to Linux box. In the case you just want to measure temperature, you can find several other solutions on the web. One of them is
http://www.digitemp.com/
That one uses network of digital temperature sensors (DALLAS DS1820). From my point of view it is cheaper and more better solution for your needs and you don't need to solve "ugly" DTR/RTS hacks.
Other similar projects to connect sensors with I2C or Dallas interface to serial or prallel port exists as well...
RTS?
If I connected the multimeter serial interface cable RTS to the RTS pin of the second serial port, the multimeter would be faked into seeing the correct line setting.
Why not just tie RTS to ground to pull it low?
You can't assume that everyone has a second serial port or that it won't be initialized, sending that RTS line high too.
DTR, RTS & Linux
DTR & RTS signals, are you kidding? Yes, I know these signals are not supported well in Linux. You selected nice hw workarround. I selected hardware workarround in the past too.
Windows users don't need such workarrounds. Why Linux should? Why everyone only uses hw workarround and doesn't fix it in proper way in driver and user utilities? Are developers in Linux world just ignorants? I understand why Linux don't have (open source) NVidia and ATI drivers, and drivers for special hardware (like WiFi cards, etc). But I don't understand why problem with RTS and DTS on serial ports wasn't solved long time ago...