Introduction

Before construction begins on a new building site, an environmental impact assessment is often performed. This can include a biological survey as well as periodic measurements of physical properties and weather phenomena over a predetermined duration. Some of the data collected can include temperature, wind speed and direction, humidity, soil characteristics, barometric pressure, and solar energy just to name a few. Once collected, these measurements can be transmitted to a remote computer or a cloud service via a cellular modem, point to point radio, or even a satellite link for real time assessment. Or the data can be stored locally and evaluated at a later time.

Often these can be new sites in remote locations where it is highly unlikely that a source of power will be available. For those situations, a low power solution combined with a solar energy source can be an ideal solution.  To address this scenario, we built a simple environmental data logger based on a Raspberry Pi 4. If you're familiar with the 4 then you know that it can consume quite a bit of current which might seem contradictory to our requirements. But, by using the power scheduling feature on the Pi-Plate POWERplate, we dramatically reduce the average energy consumption by periodically turning on the RPi, collecting and saving the required data, and then shutting off again.

Another problem with a remote "off the grid" environmental logger is that there is likely no internet. Without an internet connection at power up, the Raspberry Pi has no way of setting the clock. And without a clock, the data logger cannot assign an accurate time stamp to the measurements. Fortunately, the POWERplate has a Raspberry Pi compatible battery backed real time clock (RTC) on board to address this problem.

In the project that follows, we describe a simple solar powered remote environmental data logger based on an RPi4, a POWERplate, and a THERMOplate.

Parts Used

  1. Solar power system panel and energy controller from Amazon.
  2. 12V sealed lead-acid battery for night time operations from Amazon.
  3. A waterproof enclosure.
  4. A POWERplate
  5. A THERMOplate
  6. A DINplate
  7. Four type K Thermocouples
  8. A USB cable that terminates with a microB connector
  9. A piece of DIN rail to hold the Pi-Plate stack inside the enclosure.
  10. A Raspberry Pi 4 with the RPi OS installed on the microSD card.

Assembly

A block diagram of our assembly is shown below. As can be seen, there are 5 major components:

  1. the Pi-Plate stack sandwiched inside of a DINplate
  2. the sensors
  3. The battery
  4. the power controller
  5. and the solar panel

And these are the build steps we followed:

  1. Connect the solar panel and the battery to the energy controller. The controller comes with a set of clamps for the battery which we thought were overkill so instead we made some simple cables that had crimped-on FastOn connectors for the battery and were stripped on the other end for the controller.
  2. Assemble your Pi-Plate stack in the DINplate making sure to place the POWERplate directly over the Raspberry Pi.
  3. Attach thermocouples to the inputs on the THERMOplate
  4. Prepare the enclosure by screwing the DIN rail to the back and drilling out a hole on the side for the sensors. To be truly waterproof, you may want to use a liquid tight cord grip for your wires like these sold by Heyco.
  5. Snap the DINplate tabs onto the DIN rail next to the hole and position the battery and controller on the other side of the Pi-Plate stack.
  6. Route the thermocouples through the hole on the side of the enclosure.
  7. Route a cable between one of the USB connectors on the front of the power controller and the microB connector on the side of the POWERplate.
  8. Tuck excess wires between the wall of the enclosure and the battery.

 

Code

It might be easier to set up the code on your desktop before mounting the RPi inside of the case.

  1. Follow the directions in the POWERplate documentation to:
    1. setup the Real Time Clock
    2. setup the power switch
    3. modify the /etc/rc.local file to ensure that our program runs at powerup (our program is called "envLogger.py" and it is located in the /home/pi directory)
  2. Place the script shown below into your home directory (/home/pi)
  3. Make any changes you need for your particular sensor and/or sample rate requirements
  4. Once your code is final, delete all old log files
  5. Hold the power switch for a few seconds to power down the RPi and any attached Pi-Plates. When the shut down is complete, the LED on the POWERplate will be red.
  6. Once the HW is set up and ready, press the power button for a few seconds to start the logger. The POWERplate will now periodically wake the RPi, run the logging script, and shut down when completed.
  7. To stop the logger at any time, press the power button for a few seconds.
After the script runs the first time, a logfile is created, the fan is turned off, the LED is set to blink, and the first set of readings is collected and saved. Turning off the fan and blinking the LED minimizes the quiescent and ON state power of the POWERplate. On each successive power up, the script collects and saves the sensor data, and places the POWERplate in WAKE mode. It and then instructs the POWERplate to perform a shutdown.

Results

We placed our Solar Powered Remote Environmental Data Logger next to a lake and positioned thermocouples in the water, ground, air, and inside the cabinet. We pushed the power button, closed the door and left it for a couple of days. We then retrieved it, imported the CSV-formatted data file into LibreOffice Calc on the RPi, and plotted the data:

Series Navigation<< LAN/WiFi Speaker SwitchRaspberry Pi HQ Camera Mount >>