I previously worked on an enclosure for the Computer Club server rack, and I thought it would be a good idea to put together a standalone temperature sensor system. Preferably it would interface over the internet so that IRC bots and other programs could talk to it.
The project will use four DHT-11 temperature sensors, an ATMega 328 with an Arduino bootloader (for ease of programming), and an ENC28J60 ethernet module.
The microcontroller will take a temperature reading every few seconds, and when a connection comes in on its port 80, it will send back HTTP headers, text/json
, and JSON data for easy parsing, in the following format:
{
"sensor one": {
"humidity": "34",
"celcius": "25",
"fahrenheit": "77"
},
...
"sensor four": {
"humidity": "34",
"celcius": "24",
"fahrenheit": "75"
}
}
The sensors are not all that accurate, so I cast the floating point values generated by the Adafruit DHT library to integers for reporting.
Since this project will live in a server rack, it needs to be put in a project box. The DHT11 and ENC28J60 module both need 3.3 volts, and the ATMega will run on 3.3 volts, so I used an LM317 voltage regulator to knock down 5 volts from a USB phone charger to 3.3 volts.
Running an ATMega 328 by itself is pretty simple, it needs a 16 Mhz clock connected between pin 9 and 10, and both of those connected to ground through a 10 uF capacitor. The, connect VCC, AVCC and AREF to 3.3 volts, and use a 10K ohm resistor to pull up RST.
Then, connect both GND pins to ground, and hook up a normally open switch to RST to ground.
For the DHT11 modules, each of them needs to be connected to 3.3 volts and ground, and each of their sensor output pins is pulled up to 3.3 volts with a 10K ohm resistor.
Read More: Arduino Temperature Sensor