Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Automation pHAT: Examples, Pinouts, and Specs

Image of Automation pHATDesign with Automation pHAT in Cirkit Designer

Introduction

The Automation pHAT, manufactured by Pimoroni, is a versatile add-on board designed for Raspberry Pi. It is tailored for automation projects, offering a range of inputs and outputs to control and monitor devices. With its GPIO pins, analog inputs, relays, and other features, the Automation pHAT simplifies the process of integrating sensors, actuators, and other components into your projects.

Explore Projects Built with Automation pHAT

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of ESP32-Based Aquaponics Monitoring System with Multi-Parameter Sensors and Relay Control: A project utilizing Automation pHAT in a practical application
ESP32-Based Aquaponics Monitoring System with Multi-Parameter Sensors and Relay Control

This circuit is designed for an aquaponics system monitoring application. It uses an Arduino Nano ESP32 to read data from various sensors including temperature, humidity (AHT10), pH, TDS (Total Dissolved Solids), and dissolved oxygen, and controls a water pump via a relay based on the water temperature. The system is powered by a lipo battery through a buck converter, ensuring stable voltage supply to the sensors and the relay controlling the pump.

Open Project in Cirkit Designer
Image of ESP8266 Controlled PH Meter with LCD Display and Pneumatic Solenoid Valve Activation: A project utilizing Automation pHAT in a practical application
ESP8266 Controlled PH Meter with LCD Display and Pneumatic Solenoid Valve Activation

This circuit features an ESP-8266 microcontroller interfaced with a PH Meter for sensing pH levels, an LCD Display for output, and a 5V relay to control a 12V pneumatic solenoid valve based on the microcontroller's logic. The ESP-8266 reads the pH value from the PH Meter and likely displays it on the LCD. Power regulation is managed by a voltage regulator that steps down 12V to 5V and 3V required by the various components, and a 12V 5A power supply is used to provide power to the circuit, which is also connected to a 220V AC source.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

The Automation pHAT is packed with features that make it ideal for automation tasks. Below are its key technical specifications:

General Specifications

Features

Pin Configuration and Descriptions

The Automation pHAT connects to the Raspberry Pi via the GPIO header. Below is the pin configuration:

Pin Name Description
1 5V Power Supplies power to the Automation pHAT
2 GND Ground connection
3 Relay COM Common terminal for the relay
4 Relay NO Normally open terminal for the relay
5 ADC1 Analog input channel 1 (0-24V)
6 ADC2 Analog input channel 2 (0-24V)
7 ADC3 Analog input channel 3 (0-24V)
8 Output 1 Buffered output channel 1
9 Output 2 Buffered output channel 2
10 Output 3 Buffered output channel 3

Usage Instructions

The Automation pHAT is easy to set up and use with a Raspberry Pi. Follow the steps below to get started:

Installation

  1. Attach the Automation pHAT: Align the pHAT with the Raspberry Pi's GPIO header and press it down gently.
  2. Install the Pimoroni Library:
    • Open a terminal on your Raspberry Pi.
    • Run the following command to install the required Python library:
      curl -sS https://get.pimoroni.com/automationphat | bash
      
    • Follow the on-screen instructions to complete the installation.

Example Code

Below is an example Python script to control the relay and read an analog input:

import automationhat
import time

# Ensure the Automation pHAT is detected
if not automationhat.is_automation_hat():
    print("Automation pHAT not detected. Please check the connection.")
    exit()

# Turn on the relay for 5 seconds
print("Turning on the relay...")
automationhat.relay.one.on()
time.sleep(5)
automationhat.relay.one.off()
print("Relay turned off.")

# Read and display the value of ADC channel 1
adc_value = automationhat.analog.one.read()
print(f"ADC Channel 1 Value: {adc_value:.2f}V")

Important Considerations and Best Practices

Troubleshooting and FAQs

Common Issues

  1. Automation pHAT Not Detected:

    • Ensure the pHAT is properly seated on the Raspberry Pi GPIO header.
    • Verify that the Pimoroni library is installed correctly.
  2. Relay Not Switching:

    • Check the wiring to the relay terminals.
    • Ensure the load connected to the relay is within its rated capacity.
  3. Incorrect ADC Readings:

    • Verify that the input voltage to the ADC channels is within the 0-24V range.
    • Check for loose or faulty connections to the analog sensors.

FAQs

Q: Can I use the Automation pHAT with a Raspberry Pi Zero?
A: Yes, the Automation pHAT is compatible with all 40-pin Raspberry Pi models, including the Raspberry Pi Zero.

Q: How do I power the Automation pHAT?
A: The pHAT is powered directly through the Raspberry Pi's GPIO header, so no additional power supply is needed.

Q: Can I control the relay and outputs simultaneously?
A: Yes, the relay and buffered outputs can be controlled independently using the Pimoroni library.

Q: Is the Automation pHAT suitable for AC loads?
A: The relay is designed for DC loads up to 24V. For AC loads, additional precautions and components may be required.

By following this documentation, you can effectively integrate the Automation pHAT into your automation projects and take full advantage of its features.