Archive for December, 2018

To start off, I wanted to say that I know there are other sensors that can do what the sensors that I use can do and possibly even do it better, but I’ve had these two sensors for several years now and they have done exactly what I’ve needed them to without fail.

For temperature I use a DS18B20 and for humidity I use a Honeywell HIH-5031.  The DS18B20 is a very popular temperature sensor which uses the 1 wire protocol.  the HIH-5031 is an analog humidity sensor that runs on 3V.  The DS18B20 outputs a temp in C with the Arduino code, but the HIH-5031 only outputs a voltage which requires some code to translate into humidity.  I’ll post all of that later when I post about the code I use on the Raspberry Pi.

Sensor Wiring:

For wiring these sensors, each has 3 pins, a power, ground & read pin.  Because each sensor really needs to be exposed to air to reach correctly, I soldered several single wires to their pins and then used shrink tube to cover the connections and then another piece of shrink tube to collect the 3 wires together and cover a bit of the end of the sensor.  (You can see this in the pic above)  The two sets of 3 wires are brought together into a single cat 3 cable (4 wires).  I wire the power of each sensor to a red wire, the ground of each sensor to a black wire, then the read pins of each sensor to it’s own wire.  This allows me to be able to have only 4 wires in the wiring harness for these two sensors instead of 6.


Sensor Mounting:

As you can see above, I use an offshoot of my main mast to hold these two sensors.  The sensors themselves sit within a piece of 1 inch PVC that has holes drilled in it to allow for air flow.  This is covered with a 3″ PVC pipe that protects from solar radiation as well as rain.  I don’t have many of the details on all the PVC connections I used to make this happen, but all I did was go to the hardware store and start piecing things together to get what I wanted.

In a previous post I mentioned that I would make a separate post regarding the micro controller wiring as well as the wiring harness.  Again, for the micro controller I am using an Arduino Pro Mini 3V.  Below are a few pics and wiring details:

Microcontroller Pics:

A few pics of the micro controller wiring and waterproofing tube.  As you can see in the below pic, the micro controller sits within some 3/4″ PVC with caps on each end that have holes for the wires to come out of.  My suggestion would be to make the “top” hole waterproof by putting silicon or something around the cat 5 cable coming out and leave the bottom one free to slide in case you need to get to your micro controller for repair reasons.

Micro Controller Wiring:

I’ll include the micro controller pin as well as the wire color and “direction” of wire in this format: Pin on Pro Mini – Wire/direction – (wire color.)  (Some will have multiple wires attached)

  • Raw – 5V from RPi – (blue)
  • GND – GND from RPi – (blue-white)
  • A4 – SDA from RPi – (green)
  • A5 – SCL from RPi – (green-white)
  • Vcc
    • Power to wiring harness – (brown)
    • 4.7k Ω resistor for DS18B20 to Pin 10
  • GND
    • Ground to wiring harness – (orange)
    • Ground to wiring harness – (brown-white)
    • 65k Ω resistor for HIH-5031 to Pin A2
  • A1 – read pin for wind vane in wiring harness – (green)
  • A2
    • read pin for HIH-5031 in wiring harness – (orange-white)
    • 65k Ω resistor for HIH-5031 to GND
  • D2 – interrupt for rain gauge in wiring harness – (blue-white)
  • D3 – interrupt for anemometer in wiring harness – (blue)
  • D10
    • read pin for DS18B20 in wiring harness – (green-white)
    • 4.7k Ω resistor for DS18B20 to Vcc

Wiring Harness Pics & Wiring:

The wiring harness is where all the wires from the sensors come together with the wire coming from the Pro Mini.  I solder the wires together and use shrink tube to protect them, but I ran out of shrink tube and had to use these other connectors…don’t use these connectors.  It’s a mess…

For the wiring, I’ll list the wire color coming out of the micro controller and what wires are attached to it from the sensors.

  • Brown-white
    • GND for rain gauge
    • GND for anemometer
  • Brown
    • These two are tied together and I’ll explain in another post
      • 3V for DS1B20
      • 3V for HIH-5031
    • 3V for wind vane
  • Blue-white
    • 3V for rain gauge
  • Blue
    • 3V for anemometer
  • Green-white
    • read pin for DS18B20
  • Green
    • read pin for wind vane
  • Orange-white
    • read pin for HIH-5031
  • Orange
    • These two are tied together and I’ll explain in another post
      • GND for DS1B20
      • GND for HIH-5031
    • GND for wind vane


With this post I wanted to do a full overview of my mast, which I’ve spoken some on before. This will provide instructions on how to build as well as archiving things in case I need to rebuild it in the future. (I just had to re-wire everything and it was pretty difficult remember and figuring out where everything went) The mast is only one part of my weather station; the enclosure, which houses some other sensors as well as the RPi, will be in another post. The way my weather station works is the mast gathers info from the 5 sensors that are contained on/in it via the micro controller. It then sends the data to the Raspberry Pi that resides in the enclosure via I2C to be archived, along with data from the other sensors, within my database tables.

The mast is built out of PVC. This allows me to attach my homemade sensors easily as well as protecting the micro controller that resides inside that runs the sensors.

Main Mast Build:

Most of the mast is made from 1″ PVC with different connectors and such.  There are a few places in which the 1″ is not used, for example, where the micro controller resides.  (You can see it as the larger section). It uses 3/4″ PVC inside 1.5″ PVC.  It is built this way to provide some waterproofing for the micro controller.  The other section is for the temperature & humidity sensors.  It uses some 2″ PVC as a sun shield for the sensors.  As for the wiring of the sensors, I will detail that a little later, but all the wiring for the sensors comes together at a point where the larger section starts.  It’s there where I  “harness” everything together and will detail that later.


As I said, there are 5 sensors within the mast.  3 are sensors I have built myself and two are not.  For the sensors I have built myself, I have linked to the posts in which I detail how to build them.

  1. Wind Vane – Link to post
  2. Anemometer – Link to post
  3. Rain Gauge – Link to post
  4. Temp Sensor – Link to post
  5. Humidity Sensor – Link to post

Microcontroller & Wiring:

In previous versions of the mast, I have used an Adafruit Trinket board, but when I attempted to add some additional sensors (which failed miserably due to waterproofing) it didn’t have the needed pins required, so I switched to a Arduino Pro Mini 3V.  The Pro Mini is slightly larger, more powerful and allows me to power it with 5V coming from the Raspberry Pi.

As I said before, I communicate with the Pro Mini from the RPi via I2C.  To do this, I have a cat 5 cable running from the enclosure to the Pro Mini (I only need 4 of the wires, but it’s nice to have a spare 4 in case something happens) and then another piece of cat 5 that runs from the Pro Mini to the wiring harness.  I’ll make another post regarding the wiring for the micro controller and the wiring harness as I believe this one has gotten a little long. Link to post

Stay tuned for more…

Updated Weather Station

Working on updating my weather station currently. It’s been out of commission for a year or so. The rubbermaid box I had it in didn’t last in the elements so I’m having to rethink my mounting process. I’m also looking into getting a larger battery because the 6000 maH one I’m using doesn’t last that long.

I’m also going to be improving it. I’ve put together a circuit to measure how much battery I have left so I can have it turn itself off when the battery is too low. Also have a few more calculations that I can add in to my reporting like heat index which will be useful for the summer.