mharsch / automation-hat

Python library and examples for the Pimoroni Automation HAT & pHAT

Home Page:https://shop.pimoroni.com/products/automation-hat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automation HAT

We've pulled together a great set of features into this home monitoring and automation controller. Relays, analog channels, powered outputs, and buffered inputs (all 24V tolerant) mean you can now hook up a plethora of goodies to your Raspberry Pi.

Available from Pimoroni:

Features:

  • 24V @ 2A relay (NC and NO terminals)
  • 3 x 12-bit ADC @ 0-24V
  • 3 x 24V tolerant buffered inputs
  • 3 x 24V tolerant sinking outputs
  • 15 x channel indicator LEDs (HAT only)
  • 1 x 12-bit ADC @ 0-3.3V (HAT only)
  • 3.5mm screw terminals
  • Power, Comms, and Warn! LED indicators (HAT only)
  • SPI interface broken out
  • Extra GPIO: TX (#14), RX (#15), #25

##Installation

Full install ( recommended ):

We've created a super-easy installation script that will install all pre-requisites and get your Automation HAT or pHAT up and running in a jiffy. To run it fire up Terminal which you'll find in Menu -> Accessories -> Terminal on your Raspberry Pi desktop like so:

Finding the terminal

In the new terminal window type:

curl -sS https://get.pimoroni.com/automationhat | bash

If you choose to download examples you'll find them in /home/pi/Pimoroni/automationhat.

Documentation & Support

Usage

Analog

Three of the four analog inputs on Automation HAT are 24V tolerant, with a forth 3.3V input in the breakout header.

You can read an analog input like so:

value = automationhat.analog.one.read()

Inputs

The three inputs on Automation HAT are 24V tolerant, switching on at 3V and off at 1V. Behaviour at voltages between 1V and 3V is undefined.

You can read an input like so:

state = automationhat.input.one.read()

Outputs

The three outputs on Automation HAT are 24V tolerant, sinking outputs. That means you should connect them between your load and ground. They act like a switch down to ground, toggling your load on and off.

You can turn an output on like so:

automationhat.output.one.on()

Relays

The three relays on Automation HAT supply both NO (Normally Open) and NC (Normally Closed) terminals. You can use them to switch a single load, or alternate between two. The relays should be placed between the voltage supply and your load.

You can turn a relay on like so:

automationhat.relay.one.on()

Or off:

automationhat.relay.one.off()

Toggle it from its previous state:

automationhat.relay.toggle()

Or write a specific value:

automationhat.relay.write(1) # 1 = ON, 0 = OFF

Lights

Automation HAT includes three user-controllable lights: Power, Comms and Warn. You can take control of these lights to turn them on/off or write a brightness value:

automationhat.light.comms.on()
automationhat.light.warn.off()

Note: lights use the same methods as relays and outputs: on, off, toggle and write.

Lights associated with Inputs, Outputs, Relays and Analog are automatic by default, but you can switch them to manual if you want. First turn off the automation:

automationhat.analog.one.auto_light(False)

Then toggle the light:

automationhat.analog.one.light.on()
automationhat.analog.one.light.off()

About

Python library and examples for the Pimoroni Automation HAT & pHAT

https://shop.pimoroni.com/products/automation-hat


Languages

Language:Python 76.3%Language:Shell 22.5%Language:Makefile 1.1%