Nagios Raspberry Pi Zero Temperature Sensor – Part 1

So this is my first Raspberry Pi Zero project! The goal of this project is to build a low cost temperature sensor that could be used to monitor a server room for example. I have broken it down into two blog posts:

  • Part 1 – Building the hardware
  • Part 2 – Software configuration

I will be using a remote server running Nagios Core with the NRPE plugin. I have also installed pnp4nagios to graph the temperature reading. (the remote server install will not be covered)

The parts list:

  • Raspberry Pi Zero
  • DS18B20 Temperature Sensor (with cable)
  • Micro SD Card
  • Micro USB NIC (or wifi adapter)
  • 4.7K Resister
  • Micro USB Phone Charger (not pictured)

The Parts

You will also need a soldering iron, some solder and a cable tie.

The DS18B20 sensor as three wires:

  • Red = +3.3v
  • Black = Ground
  • Yellow = Data

You need to solder the red wire onto pin 1, the black wire onto pin 6 and the yellow wire onto pin 7 of the GPIO. The 4.7K resister needs to be soldered onto pin 1 and pin 7, connecting them together. Use a cable tie to secure the cable to the PCB.

Raspberry Pi GPIO

It should look something like this.

Soldered GPIO DS18B20

Raspberry Pi Zero DS18B20

You can connect more than one DS18B20 to the same pins using a single resister for all of the sensors. Each sensor is identified by a unique serial number.

You can now connect up the micro USB NIC and phone charger.


Thats the hardware done! Simple!

In part two I will show you how to use Python and NRPE to read the sensor.


This entry was posted in Linux and tagged , , . Bookmark the permalink.