Overview

The POWERplate24 is an multipurpose addition for your Pi-Plates stack that five primary functions:

  • Conversion of common 12 and 24 volt industrial DC supplies to 5VDC
  • Power management and distribution
  • UPS monitoring and control (when used with a compatible external power supply)
  • Raspberry Pi OS compatible Real Time Clock (RTC)
  • Passive and forced air cooling for the Raspberry Pi

By design, only one POWERplate24 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 orange lines represent the high volatage DC input and solid red lines represent the unswitched 5VDC power bus. High Voltage (HV) DC comes onto the board via two pins on the six channel terminal block and routes straight up to the four, HV output connectors.  The HV is then converted to 5VDC which is routed 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. The Power Manager can 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. Finally, the Power Manager can sespond to USB event signals from the HV power supply and pass these signals on to the application software.

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 POWERplate24 has a 45mm blower style fan that pulls hot air off the top of the Raspberry Pi and blows it over the heat generating components on the PCB. When used with the included heat sinks, the fan has been shown to reduce the CPU temperature by 13°C (23°F).

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

Board Layout

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

Assembly

Applying Heat Sinks

The POWERplate24 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 and RAM 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
  • The orientation of the square heatsink is not critical
  • A third, small heatsink is included with the POWERplate24 which is not required

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 POWERplate24

The POWERplate24 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 POWERplate24 on your stack. Below is a picture of a simple stack with an RPi 4, the POWERplate24, two CURRENTplates, and a RELAY2plate enclosed by a DINplate. We strongly recommend the DINplate and/or CASEplate to provide a sturdy mechanical structure for your Pi-Plates stack. Again, note that unlike other Pi-Plates models, the POWERplate24 does not require an address header.

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

Input Power Connectors

Overview

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

  1. A 3.5mm six pin terminal block with 2 pins for the high voltage input and 4 pins for UPS status monitoring. Use this connector for industrial and/or high power applications. The high voltage input is reverse voltage protected and has a transient voltage suppressor.
  2. A USB-C connector capable of carrying 5 Amps. This is the same connector used on the latest models of the Raspberry Pi and is a power connector only. It does not support any USB signaling.

 

Jumper Settings

The two jumpers on the six pin header should be placed appropriately before power is applied.

  • If you are using a power supply like the Meanwell DRC products, short pins 4 & 5 and 1 & 2
  • If you are using a power supply greater than 9 volts without UPS functionality or just a battery, short pins 5 & 6 and 1 & 2
  • If you are simply operating from a +5VDC supply connected to the USB-C connector, short pins 5 & 6 and 2 & 3

Jumper Settings

Connections

Refer to the diagram above to set the jumpers for the power source you intent to use. The follow the instructions and diagrams below to connect the appropriate power supply

5VDC

Set the jumpers for the "5VDC Input on USB-C Connector" configuration. Then plug a 5V DC power supply capable of sourcing 3 amps into the USB-C connector. The Raspberry Pi 5V supply is an excellent choice for this setup.

High Voltage Without UPS

The POWERplate can be driven by any DC power supply in the range of 9 to 30VDC. Be sure to set the jumpers to the "9-30VDC Input Without UPS Support" configuration and make the connections as shown below:

High Voltage With UPS

The diagram below shows how to connect a power supply like the MeanWell DRC-40A to an external sealed lead acid battery and the POWERplate24. The connections are:

Terrminal Block Pin POWERplate24 Signal Power Supply Signal
1 9-30VDC IN +V
2 GND -V
3 NO_AC AC OK +
4 NO_AC_RTN AC OK -
5 BAT_GOOD BAT. Low +
6 BAT_GOOD_RTN BAT. Low -

 

Note that dashed lines indicate return signals. These are designated with the suffix "RTN".

Be sure to set the jumpers to the setting "9-30VDC Input With UPS Support"

Running on Battery Power

The POWERplate24 can also be powered by any battery over 9 volts. Sealed 12 and 24VDC lead acid batteries ideal for this application. These are easily connected as shown in the diagram below.

To maximize the runtime while operating on a battery, you may want to take advantage of the power down and wake capabilities of the POWERplate24. Also be sure to set the jumpers to the setting "8-30VDC Input Without UPS Support"

Functions

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

  • getVin(0) - returns the measured voltage of the onboard 5VDC power supply line accurate to ±2%. If this dips below 4.75V it is likely a small lightning bolt will appear on your RPi desktop.
  • getHVin(0) - returns the measured high voltage applied to the six pin terminal block  accurate to ±2%.

In addition, there is a set of functions that allow you to monitor the status of your DC power source:

  • statEnable(0) - after executing this function, the POWERplate24 will pull down on STAT pin (GPIO22) if a change occurs to the power status of the external DC supply.
  • statDisable(0) - instructs the POWERplate24 to stop asserting status changes on GPIO22.
  • getPOWstatus(0) - returns an eight bit value reflecting the current power status of the POWERplate24. The format is:
    |X|X|X|X|X|X|LOW_DC_IN|LOW_BAT|NO_AC|
    *LOW_DC_IN is set to one if the external DC voltage is less than 8VDC
    *LOW_BAT is routed from the external DC supply. For the MeanWell DRC family, this bit will be set to 1 if the attached battery drops below 11V (12V supply) and 22V (24V supply).
    *NO_AC is set to one when the external UPS-capable power supply is operating on battery power.
  • getPOWchange(0) - returns the contents of the Power Status Change register. The contents of this register are then cleared and the status pin is reset if
    enabled and asserted.
  • getSTATflag(0) - this is a convenience function that returns the value of the STAT flag (GPIO22). If enabled, this will return a boolean 'True' if a change has occurred in the external power supply and a 'False' otherwise.

Output Power Connectors

The front edge of the POWERplate24 features five, 3.5mm terminal blocks. Four of these connect directly to the high voltage DC input and are provided to power sensors and other devices. The fifth connector connects to the 5VDC power rail.

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

  • None of these connectors are fused or protected
  • If operating from a 5VDC supply, the high voltage outputs will not be powered.
  • Please limit the current on the 5VDC output to 1 amp.
  • Ensure that the total current drawn by the HV connectors does not exceed the rating of the connected power supply
  • Do not apply power to (or backpower) these connectors. There is no protection circuits behind these connectors and back powering them will 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 POWERplate24 to shut off the Raspberry Pi and other Pi-Plates on the 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 POWERplate24, the power down process looks like:

  1. Hold pushbutton down for 3 seconds or more
  2. POWERplate24 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 POWERplate24 waits for the countdown timer to reach zero. Once this occurs, the LED turns RED and the POWERplate24 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 POWERplate24 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 POWERplate24 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 POWERplate24

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

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

And that's it! Now, when you press the push button for three seconds, the POWERplate24 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 POWERplate24 will remember this setting so the power switch setup only has to be performed once.
  • The POWERplate24 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 POWERplate24 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 POWERplate24, 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 POWERplate24 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 Time Clock to Raspberry Pi" by lady ada from adafruit.

Enable I2C

First, ensure that you have mounted the POWERplate24 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

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 POWERplate24, 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 POWERplate24 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 POWERplate24
  • setWAKE(0,hour,minute,second) - this function uses a 24 hour format to tell the POWERplate24 what time to wake next. Note that it is necessary to wake up at least once every 24 hours.
  • powerOFF(0) - this instruction tells the POWERplate24 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 POWERplate24 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 methods 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 POWERplate24 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 POWERplate24 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 POWERplate24 to its factory settings.

Controlling the Quiescent Current for Minimal Power Consumption

The table below shows the quiescent current of the POWERplate24 connected to a Raspberry Pi 4 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) with 12VDC Input
1 PWR ON - SOLID LED 290
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 POWERplate24. 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 POWERplate24 remembers them between power cycles. Also note that the addr argument is always set to zero for the POWERplate24.

Python Command Reference

Below are the Python3 functions supported by the POWERplate24. Since there can only be one POWERplate24 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 POWERplate24
  • getID(0) - returns the string "Pi-Plates POWERplate24"

Input Power Monitor

  • getVin(0) - returns the measured input voltage with an accuracy of ±2%
  • geHVin(0) - returns the measured high voltage applied to the six pin terminal block  accurate to ±2%.
  • getCPUtemp() - this function allows you to monitor the CPU temperature on your Raspberry Pi. This a system function and not specific to the POWERplate24 so no address argument is required.

Power Status

  • statEnable(0) - after executing this function, the POWERplate24 will pull down on STAT pin (GPIO22) if a change occurs to the power status of the external DC supply.
  • statDisable(0) - instructs the POWERplate24 to stop asserting status changes on GPIO22.
  • getPOWstatus(0) - returns an eight bit value reflecting the current power status of the POWERplate24. The format is:
    |X|X|X|X|X|X|LOW_DC_IN|LOW_BAT|NO_AC|
    *LOW_DC_IN is set to one if the external DC voltage is less than 8VDC
    *LOW_BAT is routed from the external DC supply. For the MeanWell DRC family, this bit will be set to 1 if the attached battery drops below 11V (12V supply) and 22V (24V supply).
    *NO_AC is set to one when the external UPS-capable power supply is operating on battery power.
  • getPOWchange(0) - returns the contents of the Power Status Change register. The contents of this register are then cleared and the status pin is reset if
    enabled and asserted.
  • getSTATflag(0) - this is a convenience function that returns the value of the STAT flag (GPIO22). If enabled, this will return a boolean 'True' if a change has occurred in the external power supply and a 'False' otherwise.

Wake Scheduler

  • setRTC(0,zone) - by default, the POWERplate24 mirrors the real time clock using the local time zone. This local clock gets set whenever the POWERplate24 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 POWERplate24 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 POWERplate24 to apply power to the stack.  For example, if the POWERplate24 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 POWERplate24 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 POWERplate24 and will be retained between power cycles.
  • fanOFF(0) - sets the cooling fan to the OFF state. This setting is saved on the POWERplate24 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 POWERplate24 to initiate the power control functions when the pushbutton is held down for 3 seconds. This setting is saved on the POWERplate24 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 POWERplate24 and will be retained between power cycles.
  • setSHUTDOWNdelay(0,delay) - by default, after the POWERplate24 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 POWERplate24 and will be retained between power cycles. Holding the pushbutton down for 10 seconds will reset this value to 20 seconds.