Skip to content

kwindrem/RpiGpioSetup

Repository files navigation

This package adds additional digital inputs and relay outputs
for Venus OS running on Raspberry PI platforms. 
It is not suitable for other GX devices such as CCGX or Cerbo GX.

The stock RPI Venus distribution there are NO relays or digital inputs defined.

This script adds:
    5 digital inputs
    makes additional digital inputs available
    makes all digital inputs behave the same: pull up so they are active low
    6 relay outputs
    activates GPIO 16 (header pin 36) as a shutdown pin
		This requires ShutdownMonitor v2.0 or later

The Raspberry PI default is for the first 8 GPIO pins to have pull UPs
and the remaining have pull DOWNs. This makes some digital input pins behave differently
This script installs a DT overlay that switches to pull UPs for all digital input pins


Only the relay 1 can be assigned to a function: alarm, generator start/stop or pump.
In addition, relay 2 can be assigned to temperature alarm
The remaining 4 relays are only provided manual on/off control from the menu.

Note that the Raspberry PI has no relays or isolated/filtered digital inputs on board.

Relay outputs are 0 volts when inactive and 3.3 volts when active.
Current sink and source is limited. Check Raspberry PI specifications for details.
You must attach the GPIO pins to external relays.
Relays should active on a high (3.3 volt) input.
Relays that activate on a low signal are NOT COMPATIBLE since
the relays would still close during Raspberry PI boot regardless of the logic provided by Venus OS.

Digital inputs expect 0 volts for an inactive input and 3.3 volts for an active input.
You must provide isolation for the digital inputs to avoid damage to the CPU chip!!!

Venus OS does not provide native support for i2c relay boards and this package does not add any.

This script will accept default options when run from PackagManager. 


This script will select default options when run from PackageManager.
This may not be appropirate. See section below on GPIO conflicts:
The script MUST be run from the command line to set options.
After that, those options will be used when installing via PackageManager,
including automatic reinstall following a firmware update.


GPIO conflicts:

GPIO assignments for relays 5 and 6 may cause conflicts with hat board interrupts. 
This conflict may cause the system to not boot or be extremely sluggish.
This script allows for two assignments for relays 5 and 6.
gpio_list is the legacy one: GPIO 23 and 24, respectively
gpio_listForCanHats provides compatibility with
		Waveshare CANbus dual channel hats (and possibly others)
	GPIOs 2, 12 and 4 are used for relays 1. 5 and 6, respectively
	GPIO 3 is used for digital input 4
	However, i2c is disabled since it uses GPIO 2 and 3 !

An option to select the legacy or compatible set is offered
when running setup from the command line.

Custom GPIO list:

If /data/setupOptions/RpiGpioSetup/gpio_list exists it is used in place
	of the one in the package directory.
	This accommodates Relay HATs, etc. that use different GPIO pins.

Installation:

RpiGpioSetup requires that SetupHelper is installed first.

The easiest way to install RpiGpioSetup is to do a "blind install" of SetupHelper
	and then add the RpiGpioSetup package via the PackageManager menus.

Refer to the SetupHelper ReadMe for instructions and for other install options:
	https://github.com/kwindrem/SetupHelper