PCB prototyping tools
Dispatched next business day!

Project idea: Network thermometer

Posted on October 31, 2013.


It's been a while since our previous project idea post, so it's time for a new idea. Here in Latvia it's autumn. So we had to turn the heating system on to be able to keep on producing Cirqoids for you. One thing that always bothered us is reliability of our heating system. It happens to stop occasionally. And while usually it can be easily restarted, if this happens on a cold winter weekend we risk facing sub-zero temperatures when we come Monday morning. So we decided to put together a network thermometer to keep an eye on what's going on here while we are away.


We've chosen STM32F107 MCU for this project. It supports Ethernet and has sufficient flash and RAM size for this relatively simple project.

RJ45 connector
We also needed a RJ45 connector to actually connect the board to the network. We've picked up a J00-0061NL manufactured by Pulse. It has built-in transformers, which simplifies circuitry.

PHY chip
To be able to hook up an MCU to Ethernet network one more thing is needed - an Ethernet transceiver chip (commonly known as PHY) which goes between connector and MCU. It takes care of translating signals in UTP cable into binary packets that can be sent to the MCU and vice versa. For this project we have selected chip KSZ8081RNACA TR made by Micrel. Both connector and PHY support transfer rates up to 100Mbps, which is an awful lot for this project. But that's going to be nice, shall we want to reuse this design for something else.

The temperature sensor itself is DS18B20 - we had it lying around and it's good enough for what we wanted. It uses OneWire protocol to communicate with MCU.

Board design

As usually the board was designed in Eagle and design files are available for download in PDF and Eagle formats. Initially we wanted to use Power over ethernet (PoE) to supply the board with power. But this would make it more complicated than it's necessary and wouldn't make any practical sense, as we'd have to use PoE injector instead of simple wall wart adapter. So besides RJ45 connector the board also has header for power supply and SWD header for programming and debugging the MCU. We decided to break 1-Wire connection to the header instead of soldering the sensor on the board because this lets us use the same board with whatever 1-Wire device (or several devices - 1-Wire can be daisy chained) if we like.

This is the layout of the board we ended up with:

Network thermometer PCB layout

Producing the board

We once again took our trusty Cirqoid machine and used it to produce the board and populate it with all the components. That's what we've got after reflow and soldering through the hole components:

Network thermometer PCB


While interfacing with 1-Wire temperature sensor is quite an easy thing, Ethernet, TCP/IP and HTTP aren't. So we decided to use ChibiOS (very lightweight and easy to use open source RTOS with support for lots of MCUs). It also supports lwIP integration (lwIP is an implementation of TCP/IP stack). So in theory all we had to do was implementing HTTP request handling method which would read data from the sensor and present it in HTML. In practice it turned out to be a little bit more complicated - ChibiOS didn't support the PHY chip we decided to use. So we had to patch ChibiOS to get our PHY working.

The firmware is available as a source code in the git repository and as a compiled binary.

The end result

So after hacking the ChibiOS we finally got the page we were hoping for:

Feel free to use the this project as a template for your own projects - 1-Wire interface can be easily changed to whatever else, giving you ability to watch or control whatever you wish from the network. lwIP also supports other protocols besides HTTP. Say, it can send email notifications in case temperature goes out of predefined range.

comments powered by Disqus