Arduino ethernet temperature sensor

Motivation

Create cheap rock solid ethernet temperature sensor. It should work years without touching and recover after power or network problems. Full watchdog and reset capabilities should be used.

Bill of materials

Total price

As said before, you can get rid of voltage regulator and DS18B20 doesn't nessesary be waterproof. You can get these items on ebay cheeper also.

4$+ Arduino clone
4$ Waterproof DS18B20
5$ ENC28J60 Ethernet
2$ AMS1117 Voltage regulator
? 5V power source
15$

Requirements

Most of small arduinos (clones) doesn't come with watchdog. I don't know why but we need one, without one code bellow will not work or will not work reliably. Ethernet module works mostly ok but sometimes when network problems or server responds slow module got stuck. I strongly recomend Optiboot - you can find lot of tutorials how to burn new bootloader to arduino or even plain Atmega chip.

Then you will need driver for ethernet module. There is no official support from Arduino itself so we use EtherCard from JeeLabs.

Wiring

Fritzing doesn't have image for ethernet module, but you should get idea from this image. If there is something unclear please look at datasheets or other tutorials.

Output example

Reliability

Internal watchdog can be helpful here when code stuck but it seems its not enough to fully restart ethernet module. Watchdog restart and LOWing ethernet RST pin seems to work almost every time, but in rare cases ethernet stays in some weird state that these software reboots will not work at all as long as arduino is powered. So i connected D4 and Arduino RST pin and used hack from http://weblog.jos.ph/development/arduino-reset-hack/. I am not sure why this works, but at end of the day it works! Small caveat you need RST pin to have disconnected while flashing Arduino.

Commented Arduino code

Simple server code

I used PHP script as thin layer to manage rrdtools. It generates two charts - temperature and controller uptime. Script should have rights to execute system shell, server must have rrdtools installed, and script must have rights to create and write files in directory. Only under these conditions it will work.

What todo next?

ATMEL has its own internal temperature sensor, we should chart it as well!

http://playground.arduino.cc/Main/InternalTemperatureSensor

Comments