The Red Oak Canyon PowerHAT is a versatile power controller for the Raspberry Pi with a built-in A2D converter. It has been designed for maximum flexibility and simple installation.
There is no switch on the PowerHAT. This is only required additional component to make the board fully functional. It is easier to have the user add a switch that fits their application than to remove a pre-installed switch. Any normally open momentary contact switch will work. The PCB has several connection points for a wired or case mounted switch, and a place on the board edge to accommodate a through-hole switch with leads on .200” centers. More switch types can be mounted in the breadboard area and wired to the switch connections.
Charge and/or Powered LED may also be installed directly on the board or wired to case mounted LEDs.
The PowerHAT is controlled with GPIO signals. Depending on the end application and other peripherals, there may be GPIO channel conflicts. The PowerHAT is easily modifiable to accommodate these situations using the breakouts for the internal signals and the J1 connector.
This document should be used as an installation and hardware hardware modification guide. The reference images also show the A2D connection terminals.
More detailed descriptions of the signals referenced below and of the circuit/software operation is available in the software distribution README, and in the rocpmd and roc-device-tree man page after software installation.
Board Connection Detail
This picture of the PowerHAT board shows all the available connection points and the USB power input.
Each connection group is coded with a different color. For example, the battery connection inputs are color coded yellow.
For signals that have a polarity requirement, the negative terminal (not necessarily ground) is shown with a black dot.
There are multiple connection points for each signal on the board. (The silkscreen may have slightly different names for the same signals)
The color coding and signal description is as follows (color:GROUP:Description)
Red:POWER-IN: Alternate 5V power input in parallel with the USB power input (so don't use both at the same time)
Yellow:BATT-IN: Battery terminal inputs. If you ordered your PowerHAT with a battery connector installed, then the yellow connections will be filled with the connector.
Dark-blue:BattTherm/BattPDN: Thermal connection/bypass for the battery. Connect the thermal sensor for a battery to BattTherm. For batteries with no temperature sensor short BattTherm to BattPDN to enable charging.
Green:SWA/SWB switch inputs for a normally open, momentary contact switch. Use either of the SWA terminals (solid green terminals) and the SWB terminal (green with a black dot.)
Purple:D1 LED: terminals for a Charging LED indicator – lights when charging Pink:D2 LED: terminals for a Powered LED indicator – lights when external power is applied.
Turquoise:CH0-CH3/AGND: Channels 0/3 and analog ground of the A2D converter Grey/White:WPA/G: HAT Flash Program Enable
Verify the BattTherm connection has either a thermal sensor attached to the terminal (using your own battery), or that the BattTherm terminal is shorted to the BattPDN terminal. Failure to do one of these will inhibit the charging function, even though an installed charge LED lights and the battery monitor software reports charging.
Connect a normally open, momentary contact switch to the SWA and SWB connection points. An alternate connection point is also labeled PSWA and PSWB
If your Raspi is on, shut down the system
Remove the micro-USB power adapter cable to power down the Raspi
Attach the PowerHAT to the 40 pin J1 connector on the Raspberry Pi A+/B+ and Raspi 2 Model B.
Attach the battery making sure the polarity keys are aligned.
Plug the USB power adapter into the USB connector on the PowerHAT.
Push the on/off button once. The Raspi will boot.
Install the Software
Open a terminal/shell window.
Obtain the git-core and update/upgrade the OS:
sudo apt-get install git-core sudo apt-get update sudo apt-get upgrade
Update the firmware to get the A2D module
Download and install the YAML0.3 library.
For Raspbian Wheezy:
sudo apt-get install libyaml-cpp-dev sudo apt-get install libyaml-cpp0.3
For Raspbian Jessie:
sudo apt-get install libyaml-cpp0.3-dev sudo apt-get install libyaml-cpp0.3
For Raspbian Jessie you must also install the Boost libraries (this takes a while):
sudo apt-get install libboost-all-dev
Clone the ROC HAT Power Board repository, then build and install:
git clone https://github.com/redoakcanyon/HATPowerBoard cd HATPowerBoard make make install
shutdown -r now
Diodes may be attached to the D1 and D2 terminal blocks. Power down the Raspberry Pi and remove the battery from the PowerHAT prior to adding additional components to the board. Connect the anode of the diode to the (+) terminal, and the cathode to the (-) terminal.
Re-configuring the Hardware
It may be desirable or necessary to reconfigure the hardware so it is compatible with other peripherals sharing the GPIO bus, or to adapt it to other Raspberry Pi hardware versions.
The PowerHAT image below shows the individual control signals required for full operation:
Each control signal originates from the circuitry within the upper right of the PowerHAT and is connected to pins on the J1 connector through installed 0-ohm resistors. There are five control signals, plus connections to the diodes (D1- and D2-) so the charge/power state can be observed by the Raspi.
A unique color identifies the internal node, the 0-ohm resistor that connects the internal node to the 40 pin connector, and the pin on the breakout 40-pin connector.
The color coding is (color:FUNCTION:BCS_GPIO#:40 pin connector pin)
red:CS*: GPIO 6: pin 31: Chip select for battery comparator
blue:U/D*:GPIO16:pin 36: Up/Down control for comparator
yellow:PGOOD: GPIO13:pin33: Comparator output
green:OFF:GPIO12:pin 32: Off control input – logical equivalent to on/off switch
pink:REQ_OFF_B:GPIO5:pin29: power controller requests shutdown
gray/black: D1-:GPIO20:pin 38: Battery Charging light-blue: D2-:GPIO26:pin 37: Power Applied LED
To reconfigure any of the above signals, remove the 0-ohm resistor and place a wire from the internal connection point to the new pin on the 40-pin breakout connector.
Please see the README file in the HATPowerBoard directory of the software distribution for information on necessary software reconfiguration.
Analog to Digital Converter
There are four channels on the built in A2D converter. Please see the Board Connection Detail above. The four analog inputs are identified by turquoise in the photo. The analog ground is turquoise with a block dot. Voltages on the analog inputs should be restricted to between 0 and 3.3V. Please see the README file in the HATPowerBoard directory for more information on software configuration and accessing the A2D data.