Arduino HTTP Temperature sensor (formerly SNMP)
Introduction (jump to the last section)
SNMP is a standard way of getting status and performance data from devices. If the Arduino + ethernet shield was capable of supporting this protocol, there would be a great opportunity for an inexpensive, open and customizable alternative to devices like the Netbotz which cost between $600 for the smallest model and $2500+ for most complex verions.
This project is a test of an SNMP library for Arduino called Agentuino. Honestly, I could not understand how to use the library at all from the example code. However, I did find one project that used the library for a weather station.
Here is a conversation regarding the library on the Arduino Forum.
For my version of the sketch I removed the LCD code and left only one temperature sensor. My sketch can be downloaded below in attachments. Note that my version uses DHCP. Just replace the DHCP stuff with the normal static setup using the Ethernet library.
There are a whole bunch of libraries to be installed for SNMP to work. The instructions can be found at the Agentuino web site.
How to use
To test the system one must have some version of an SNMP client installed such as net-snmp. For the temperature sensor a private OID has been created: "22.214.171.124.3.2009.0.3.0"
snmpget -v 1 -c public 192.168.10.123 126.96.36.199.3.2009.0.3.0
The Arduino sensor returns the following:
SNMPv2-SMI::experimental.2009.0.3.0 = INTEGER: 2080
Seeing that floating point numbers are not supported the value is returned as an integer that needs to be divided by 100 to get the actual temperature reading.
ie. 2080 = 20.80 degrees Celsius
Sparkfun Ethernet Pro (Arduino + Ethernet Shield compatible)
USB to Serial Converter -- used to program the Ethernet Pro
TMP 36 temperature sensor -- this sensor came with my Sparkfun Inventor's kit. The LM335A could be used with an additional resistor.
Heat shrink from Radio Shack
PVC plastic electrical box (purchased in El Lagar)
There is not much to wiring up the TMP36 temperature sensor which is connected to Analog0...
1st pin of the TMP36 -->5VDC
2nd pin of the TMP36-->Analog0
3rd pin of the TMP36-->GND
Unfortunately, there are a few fatal flaws that need to be fixed before this could be used in production:
The system doesn't work on power-up. The reset button needs to be pressed for the system to start. In investigation.
SNMP stops responding after a couple of hours. Unfortunately the author of the library no longer appears to be available. Hopefully some talented programmer will take a look at this.
Converted to HTTP
I could never get the SNMP protocol working in a stable fashion. And now that Arduino 1.0 came out the Agentuino library doesn't work at all so I converted the system over to a simple web server. Because we use Nagios for monitoring we can easily use a plugin that goes to the default web page and parses the temperature data directly. You can download the code below which is a slightly modified version of the standard Webserver example that comes with the Arduino 1.0 IDE.