Overview

The POWERplate is a multipurpose addition for your Pi-Plates stack that provides three primary functions:

  • Power management and distribution
  • OS compatible Real Time Clock (RTC)
  • Passive and forced air cooling for the Raspberry Pi

By design, only one POWERplate is needed and it should be the first Pi-Plate mounted on your stack after the Raspberry Pi.

Power Management and Distribution

In the block diagram below, the solid red lines represent the unswitched 5VDC power bus. 5VDC power comes onto the board via one of the four power input connectors. It routes straight up to the five power output connectors as well as to the Power Manager and transistor switches that control the fan and Raspberry Pi. Switched 5VDC is indicated by the dashed lines. The Power Manager can be programmed to respond to the board mounted push button switch and signal a shutdown to the Raspberry Pi. This is followed a short programmable time later by turning off all power to the RPi. When the push button is pressed again, the Power Manager will restore 5VDC to the RPi. In addition, the Power Manager can be used to wake from an off state and turn on the stack at a scheduled time. This allows the RPi and its peripherals to be used in an environment where power is limited.

Real Time Clock (RTC)

The Real Time Clock circuit is completely independent of the Power Manager and connects directly to the I²C pins on the Raspberry Pi. This allows the Raspberry Pi operating system to "see" the clock at power up and extract the system time. A small battery keeps the RTC running in the event of a power loss. While use of the RTC requires some setup, it only has to be done once.

Cooling

The POWERplate has a 45mm blower style fan that pulls hot air off the top of the Raspberry Pi and blows it out the left side of the board. When used with the included heat sinks, the fan has been shown to reduce the CPU temperature by 13°C (23°F).

This remainder of this page describes, in detail, the features and functions of the Pi-Plates POWERplate covered above.

Board Layout

The connector locations for the POWERplate are shown below. Note that because there can only be one POWERplate on a stack, there is no address header on this board.

Assembly

Applying Heat Sinks

The POWERplate comes with a set of 3 heat sinks that should be applied to the chips on your Raspberry Pi for the most effective cooling. Simply remove the adhesive backing to expose the thermal pad and apply them to the CPU, RAM, and the USB controller chips on your RPi. Here's what a Raspberry Pi model 4 looks like after the heat sinks have been applied:

A few other notes:

  • Don't worry if the heat sinks are not perfectly centered on the chips.
  • On the RPi 3, the RAM chip is located on the bottom of the board
  • For the square heat sinks, the orientation should not be an issue

Inserting Battery for Real Time Clock

Even if you don't plan to use the Real Time Clock, go ahead and install the included CR1220 battery by following these steps:

  1. Remove the battery from the packaging
  2. Use a clean rag to wipe off any smudges or fingerprints
  3. Orient the battery with the plus sign (+) on the top side.
  4. Slide the battery into the clip on the top of the board until it pops into place:

Assembling a Pi-Plate Stack with the POWERplate

The POWERplate should be the first Pi-Plate on the stack to ensure that the fan can pull the hot air away from the RPi. Only use a single POWERplate on your stack. Below is a picture of a simple stack with an RPi 4, the POWERplate, and a DAQC2plate enclosed by a CASEplate. We strongly recommend the CASEplate and/or DINplate to provide a sturdy mechanical structure for your Pi-Plates stack. Again note that unlike other models of Pi-Plates, the POWERplate does not use an address header.

 

After assembly, it's time to plug your power supply into your POWERplate using the recommendations in the next section.

Input Power Connectors

Overview

To take full advantage of the POWERplate you must use one of the four connectors on the right side of the board to provide the 5VDC power to your Raspberry Pi and Pi-Plate stack. As seen below, these connectors include:

  1. A 3.5mm terminal block capable of carrying a maximum current of 12 Amps. Use this connector for industrial and/or high power applications. To maximize efficiency, there are no reverse protection diodes on the POWERplate so be absolutely certain the left pin is +5V and the right pin is ground before you use this connector.
  2. A USB-C connector capable of carrying 5 Amps. This is the same connector used on the latest models of the Raspberry Pi. Note that this is a power connector only and does not support any USB signals.
  3. A microB USB connector capable of carrying 3 Amps. This is the same connector that was used the older versions of the Raspberry Pi and, if you're like us, you will likely still have lots of them lying around.
  4. A classic 5.5mm "barrel" connector capable of handling 5 amps. This is a tried and true DC power connector that was very common before cell phones became popular. Note that we follow the defacto standard with the center pin connecting to the positive side of the power supply. To be sure, examine the power supply housing which usually includes a diagram of the connector showing the polarity. If you're still not sure, plug it in and use a voltmeter to verify. Again, to maximize efficiency, there are no reverse protection diodes on the POWERplate so be absolutely certain the center pin is positive before you use this connector.


Functions

We have a provided a pair of functions that allow you to measure the load on your power supply. These are:

  • getVin(0) - returns the measured voltage of the applied 5VDC power supply accurate to ±2%. If this dips below 4.75V it is likely a small lightning bolt will appear on your RPi desktop.
  • getIn(0) - returns the measured input current of the applied 5VDC power supply accurate to ±10%. The maximum current that can be measured is approximately 4.8 amps..

Caution

  • Only use 5VDC power supplies - there is no onboard voltage regulation or current clamps. Connecting a supply with an output greater than 5.5V could damage your Raspberry Pi as well as some of the Pi-Plate components.
  • Do not connect more than a one power supply to the POWERplate - plugging in two or more can destroy one of your supplies and or make it really hot 

Tips

  1. Try to use high quality power supplies. We've seen a number of power supplies that cannot deliver their rated current. In most cases the output voltage of these devices will "sag" below 4.75 volts when a full load is placed on them.
  2. We recommend power supplies that have a rated output of 5.1VDC. That extra 100mV compensates for the IR losses in the wires and traces at high currents and ensures that your components continue to see at least 5VDC.
  3. If you use a wall mount power supply, ensure that the cable is at least 6 feet long (or 2 meters) and made of thick wire. The 6 feet is for convenience while the thicker wire ensures lower IR losses at high loads. Beware of thin cable and lightweight "bricks."
  4. We have successfully tested and can recommend the Raspberry Pi 4 official 15W power supply as well as some wall mount and DIN rail models from Mean Well.

Output Power Connectors

The front edge of the POWERplate features five, 3.5mm terminal blocks. These provide a simple and effective method of bringing 5VDC power to other devices and components in your test setup or process.

There are a few rules that need to be followed when using these outputs:

  • These are 5VDC outputs only and route directly to the input power connectors. If your setup requires a different voltage you will have to provide it separately and route it independently of the POWERplate.
  • Make sure that your total current draw along with what is required for the rest of the stack does not exceed the capabilities of the 5VDC power supply connected to the input power connector. For example: If you are using the official Raspberry Pi 4 power supply and an RPi4, then you should probably not pull more than 1 amp total from the output power connectors. Why? The official RPi4 power supply is rated for 3 amps and you should reserve 2 of those amps for the RPi4 and any other Pi-Plates on your stack. That leaves 1 amp of current for any peripheral devices that will be powered by the Output Power Connectors.
  • Do not apply power to (or backpower) these connectors. There is no protection circuits behind these connectors and back powering them could damage the other components on the stack - including the Raspberry Pi.
  • These connectors are ALWAYS ON and will continue to supply power to your setup even if you have instructed the POWERplate to shut off the Raspberry Pi and other Pi-Plates on the stack. If you need to remove power from your test setup or process when the stack is OFF, we recommend you place a DAQCplate, DAQC2plate, or RELAYplate on your stack.

Using the Push Button as a Power Switch

Overview

In the early days of the Raspberry Pi, it was always a bit of a gamble determining when and how to remove the power. If done at the wrong time, it could result in a corrupt the SD card. Things have improved since then with the faster CPUs but they are still not perfect - there is still a need for a simple power switch. Once the Power Switch feature has been set up and enabled on the POWERplate, the power down process looks like:

  1. Hold pushbutton down for 3 seconds or more
  2. POWERplate signals RPi that power button has been pressed, turns the LED YELLOW, and starts a 30 second countdown
  3. A small program running in the background on the Raspberry Pi monitors the state of the GPIO pin that signals the power down request. When it goes low, the program issues a shutdown command to the Linux operating system.
  4. The POWERplate waits for the countdown timer to reach zero. Once this occurs, the LED turns RED and the POWERplate removes power from the all of the other boards on the stack as well as the fan

With the power removed from the Raspberry Pi and the rest of the stack, the LED on the POWERplate stays RED until the button is pressed again for 3 seconds. When this occurs, the LED will turn GREEN, the fan will turn on (if enabled), and power will be restored to the RPi allowing it to boot up normally.

Set Up Raspberry Pi

To use the pushbutton on the POWERplate as a power switch, it's necessary add a line to the end of the /boot/config.txt file:

  1. From the command line, run sudo nano /boot/config.txt
  2. Scroll to the bottom of the file and add the line  dtoverlay=gpio-shutdown,gpio_pin=24
  3. Hit <CNTL>O to save the file followed by <CNTL>X to exit the editor.
  4. Reboot your Raspberry Pi and the new overlay will be recognized by the OS.
  5. Next, we need to add our Python modules by typing sudo pip3 install Pi-Plates at a command prompt:

    Don't worry if you see a different revision number at the end of the installation.

Setting up the POWERplate

When shipped, the power switch function on the POWERplate is disabled. To enable it requires the following two lines to be run in a Python3 shell:

>>>import piplates.POWERplate as POW
>>>POW.enablePOWERSW(0)

And that's it! Now, when you press the push button for three seconds, the POWERplate will turn the LED yellow and signal your Raspberry Pi to shut down . After waiting 20 seconds, it will turn the LED red and shut off the RPi along with the other Pi-Plates on your stack.

A few notes about the above:

  • The POWERplate will remember this setting so the power switch setup only has to be performed once.
  • The POWERplate has a function that lets you modify the ON to OFF time if you want to change the default 20 second delay. For example, some older models of the Raspberry Pi might need more time. But, we advise to not to make it any shorter than 20 seconds since removing power from the RPi before shutdown is complete may corrupt the file system on your SD card.
  • Regardless of the mode, holding down the push button for more than 10 seconds will return the POWERplate to it's default settings. These are:
    • Power ON
    • Fan ON
    • Push button power control DISABLED
    • Green LED ON solid
    • Red LED OFF
    • Power off delay: 20 seconds
    • Wakeup mode DISABLED

Setting up the Real Time Clock

Overview

Laptops and desktop computers have clock chips and backup batteries inside of them to keep the time even when they are turned off or unplugged. The Raspberry Pi on the other hand was designed to be a low cost device that would get its time from an internet connection. This approach is fine as long as an internet connection is available. But for those applications where the internet is not available, it is necessary to get the time from a Real Time Clock chip or RTC.

An RTC circuit consists of four fundamental elements:

  1. A clock source such as a crystal or standalone clock chip. The frequency of this clock is typically 215 or 32,768Hz.
  2. A very low power IC to divide the clock down into separate registers that represent days, hours, minutes, and seconds.
  3. A small battery to power the circuit when the RPi is turned off.
  4. A switch circuit that controls which power source drives the IC

For the POWERplate, we chose the NXP PCF8523. This chip is compatible with the RPi HW and Raspian OS, has an onboard switch circuit, and connects directly to a 32Khz crystal to generate the required clock.

Note that the RTC connects directly to Raspberry Pi via the I2C interface. This is accessed using pins 3 and 5 on the 40 pin connector so if you plan to use the RTC don’t use these pins for any other function unless it’s for another I2C peripheral. 

What follows are the steps required to configure your RPi to pull its time information from the RTC chip on the POWERplate instead of being dependent on an internet connection. If your RPi is always connected to the internet then the following steps are not necessary. Finally, note that these instructions assume that the full version of the Raspian OS has been installed on the RPi. Please know that much of the text that follows is from the article "Adding a Real Tim Clock to Raspberry Pi" by lady ada from adafruit.

Enable I2C

First, ensure that you have mounted the POWERplate on top of your Raspberry Pi (RPi) and that the CR1220 battery has been inserted into the board mounted clip. Next, power up your RPi and verify that the I2C interface has been enabled in the Raspberry Pi settings:

Next, open a terminal window and execute the command sudo i2cdetect -y 1 to see what devices are attached to the I2C port:

Set the Time on the RTC

You add support for the RTC by adding what is called a “device tree overlay.”

Run sudo nano /boot/config.txt to edit the pi configuration and add the following line of text to the end of the file:

dtoverlay=i2c-rtc,pcf8523

Save it and run sudo reboot to start again. Log in and run sudo i2cdetect -y 1 to see the “UU” characters show up where 0x68 used to be:

Now we will disable the 'fake hwclock' which interferes with the 'real' hwclock by executing the following commands at the command prompt:

  • sudo apt-get -y remove fake-hwclock
  • sudo update-rc.d -f fake-hwclock remove
  • sudo systemctl disable fake-hwclock

It appears that in our case, that last command was unnecessary. But no harm done. Now that we have disabled the 'fake' hw clock, we can enable the real one by changing some lines in the following script. First run sudo nano /lib/udev/hwclock-set. Then comment out these three lines:
#if [ -e /run/systemd/system ] ; then
# exit 0
#fi

As well as these two lines:

Also comment out the two lines
/sbin/hwclock --rtc=$dev --systz --badyear
and
/sbin/hwclock --rtc=$dev --systz

After those changes have been made and the file saved, you will likely need to reboot your RPi.

Finally, it's time to synchronize your newly enabled RTC with the internet. First, make sure you are connected to the internet and execute the date command. Then execute the command sudo hwclock -w to load the RTC with the current time and date.  Finally verify everything is working by running sudo hwclock -r from the command line.

Finally! We're done. Now, as long as the coin cell battery remains on the POWERplate, the time will always be available even without an internet connection.

Scheduling a Wakeup Time

Overview

There are many applications where data collection has to occur remotely. And in many of these cases, there is no line power available for the Raspberry Pi or peripherals. A common task for example is long term environmental monitoring of a remote site with periodical measurements of air temperature, wind direction, wind speed, and solar energy levels. Or it could be as simple as monitoring the battery voltage on a boat while it's docked. In some cases the collected data can be shared immediately if a cell cellular modem is used. In other cases it may be necessary to save the data locally for later retrieval.

For these applications the obvious power source is a battery. But, the Raspberry Pi can pull a lot of current and even if the battery is connected to a solar panel like the one shown below, it may drain quickly.

To address this, the POWERplate includes a feature that allows the RPi power up at a prescheduled time, perform a task like data collection, and then shut down again. To accomplish this requires the following functions:

  • enableWAKE(0) - like it says, this function enables the wakeup mode on the POWERplate
  • setWAKE(0,hour,minute,second) - this function uses a 24 hour format to tell the POWERplate what time to wake next. Not that it is necessary to wake up at least once every 24 hours.
  • powerOFF(0) - this instruction tells the POWERplate to initiate the shutdown sequence. It's will be the last instruction of the script you run after waking up. Note that for this routine to work correctly, the pushbutton has to be configured as a power switch.
  • getWAKESOURCE(0) - this returns a numeric value that indicates what caused the POWERplate to turn on the RPi. It will return the following responses:
    • 0 - no source found (this is the cleared value)
    • 1 - powered up with a button press
    • 2 - powered up by the scheduler

One other small wrinkle with a scheduled wakeup is the requirement to have the Raspberry Pi launch your application when it powers up. While there are different was to do this, we found that the easiest way was to add a call to the program at the end of the rc.local file in the /etc directory. What follows is an example that uses a POWERplate to power up a stack every five minutes to make cooler measurements with three thermocouples attached to a THERMOplate:

The Program

A simple template for a program that runs at wakeup looks like:

In the next example, we use the scheduler on the POWERplate to collect and save a set of THERMOplate measurements every five minutes:

Launching the Program at Boot

As mentioned above, this approach is about the easiest way to run a program at power up:

  1. execute sudo nano /etc/rc.local at the command prompt
  2. insert a line at the bottom of the file just before the exit 0 statement with the call to your script enclosed in parenthesis. In our case, the the line (python3 /home/pi/scheduler4Cooler.py) & at the bottom of the script before the exit 0 statement:

    Note that it is important that use the full path to your script.
  3. Save the file and exit the editor.
  4. After you power cycle, your script will run.

Cautions

  • As mentioned previously, it is necessary to wake up at least once every 24 hours.
  • Make sure to check the getWAKESOURCE(0) to verify that your program is running because of a scheduled wake up. Otherwise, you could set up a powerup-shutdown loop that will be difficult to interrupt. If you do get stuck in one of these, you can simply hold down the power button for 10 seconds to reset the POWERplate to its factory settings.

Controlling the Quiescent Current for Minimal Power Consumption

The table below shows the quiescent current of the POWERplate with various options enabled and disabled. Clearly, the lowest current is obtained when the power to the stack is OFF and the LEDs are turned off.

Case Description Measured Current (mA)
1 PWR ON - SOLID LED 140
2 PWR OFF - LED ON 15
3 PWR OFF - LED BLINK 3.8
4 PWR OFF - LED OFF 2.2

The functions that can control the quiescent power are:

  • ledMODE(addr,mode) - this function sets the LED mode on the POWERplate. The mode argument can have the following values:
    • 0: always off
    • 1: blink
    • 2: always on (default)
    • 3: manual control
  • fanOFF(addr) - turns off the fan. Primarily used to minimize power consumption during scheduled wake and/or battery powered applications
  • fanON(addr) - turns the fan on if it has been previously set to OFF

All of the above settings are "sticky" which means that the POWERplate remembers them between power cycles. Also note that the addr argument is always set to zero for the POWERplate.

Python Command Reference

Below are the Python3 functions supported by the POWERplate. Since there can only be one POWERplate on a Pi-Plate stack, the address will always be zero. This is to keep the command structure consistent with other Pi-Plates.

General

  • help() - this will display a summary of all of the commands associated with the POWERplate
  • getID(0) - returns the string "Pi-Plates POWERplate"

Input Power Monitor

  • getVin(0) - returns the measured input voltage with an accuracy of ±2%
  • getIn(0) - returns the amount of current flowing through the power plate with an accuracy of ±10%. This includes the currents flowing to:
    • the stack (RPi and all other Pi-Plates)
    • the output connectors on the front edge of the board
    • the electronics and fan on POWERplate
  • getCPUtemp() - this function allows you to monitor the CPU temperature on your Raspberry Pi. This a system function and not specific to the POWERplate so no address argument is required.

Wake Scheduler

  • setRTC(0,zone) - by default, the POWERplate mirrors the real time clock using the local time zone. This local clock gets set whenever the POWERplate module is loaded and does not require any user intervention. However, it it possible to override the time zone with one of two values:
    • 'L' - use local time zone
    • 'G' - use Greenwich meantime also known as "zulu" time.
  • setWAKE(0,hour,minute,second) - sets the wakeup time on the POWERplate in 24 hour format. The ranges for each argument are:
    • hour should be between 0 and 23
    • minute should be between 0 and 59
    • second should be between 0 and 59
  • enableWAKE(0) - this function enables the wakeup mode. It should be preceded with the setWAKE call and followed by the powerOFF command.
  • disableWAKE(0) - this is a complementary function to enableWAKE - it's primarily useful during programming and troubleshooting.
  • getWAKESOURCE(0) - this function allows the bootup script to interrogate what caused the POWERplate to apply power to the stack.  For example, if the POWERplate powers up the stack because of a scheduled wake then the bootup script might make a series of measurements, update a database, then shutdown. But, if the pushbutton causes the powerup, then the script might exit immediately and not shutdown. This function will return the following values:
    • 0 - initial power up
    • 1 - power applied with pushbutton
    • 2 - power applied with scheduled wakeup
  • powerOFF(0) - simulates a pushbutton and performs the powerdown sequence. This function only works correctly if the line dtoverlay=gpio-shutdown,gpio_pin=24 has been added to the end of the /boot/config.txt file.

LED Control

  • setLED(0,led) - this function allows manual control of the bicolor LED on the facing edge of the board. The led argument is a string with one of the following case independent values:
    • 'RED'
    • 'GREEN' or 'GRN'
    • 'YELLOW' or 'YEL'
    • 'OFF'
  • ledMODE(0,mode) - the default state of the LED is to be on at all times. But, to reduce power consumption, it can be programmed to blink at a 1 second rate with a 12.5% duty cycle or stay off. The mode arguments to do this are shown below. Note that this setting is saved on the POWERplate and will be retained between power cycles. Holding the pushbutton down for 10 seconds will reset this setting to mode 0.
    • mode 0: auto: always off
    • mode 1: auto: blink
    • mode 2: auto: always on (default)
    • mode 3: manual - set automatically when the setLED command is issued.

Fan Control

  • fanON(0) - sets the cooling fan to the ON state. This setting is saved on the POWERplate and will be retained between power cycles.
  • fanOFF(0) - sets the cooling fan to the OFF state. This setting is saved on the POWERplate and will be retained between power cycles. Holding the pushbutton down for 10 seconds will reset this setting to the ON state.
  • fanSTATE(0) - returns a 1 if the fan is on and a 0 if it is off.

Pushbutton / Power Control

  • getSWstate(0) - this function provides a programmatic method of reading the status of the button. Returns a 1 if the button is pressed and a 0 otherwise.
  • enablePOWERSW(0) - this tells the POWERplate to initiate the power control functions when the pushbutton is held down for 3 seconds. This setting is saved on the POWERplate and will be retained between power cycles. This function only works correctly if the line dtoverlay=gpio-shutdown,gpio_pin=24 has been added to the end of the /boot/config.txt file.
  • disablePOWERSW(0) - this disables pushbutton control of power. This setting is saved on the POWERplate and will be retained between power cycles.
  • setSHUTDOWNdelay(0,delay) - by default, after the POWERplate instructs the Raspberry Pi to power down, it delays for 20 seconds to allow the OS to complete the shutdown function. This delay can be modified to be in the range of 10 to 240 seconds. Avoid setting this value for anything less than 20-30 seconds with older versions of the RPi. Note that this value is saved on the POWERplate and will be retained between power cycles. Holding the pushbutton down for 10 seconds will rest this value to 20 seconds.