Pi GPIO pin-out to TD relay and power switch


Can someone help me out with the pin out from the RPi spec. as concerned with the molex connector?
WIR-HAR-0034 “RPI GPIO 11/13/15/17” --> seems to be calling out physical pin location rather than the actual RPI GPIO pin assignment. looking for wire color to gpio pin- any help would be much appreciated.


Did you figure this out? I have the same question.


@epeterson There are a variety of food computer designs with different hardware and software revisions. It would be easier for people to help you if you explain what version of the hardware you are trying to build, which version of the software you hope to run, and which document(s) you were referring to when you saw the stuff about “WIR-HAR-0034”.

For example, some of the major things people have been doing and discussing here on the forum include:

  1. Building the simplified MVP design (see the $300 Food Computer thread).
  2. Adapting the PFC v1 hardware to run PFC v2.x software
  3. Building PFC v2.x hardware kits as beta testers for OpenAg at MIT.
  4. Building PFC v2.x hardware kits purchased from Open Agriculture Supply.
  5. Creating DIY hydroponics and aeroponics systems loosely based on food computer designs.

Much of the the available hardware documentation on OpenAg’s github was last updated in March of 2017, and it refers to beta versions of the PFC v2 hardware design (see https://github.com/OpenAgInitiative/openag_pfc2). On the other hand, the latest openag_brain software release is from September 2017 and it’s intended for the PFC v2.1 hardware (see https://github.com/OpenAgInitiative/openag_brain/releases). I’m not sure if the v2.1 hardware is documented anywhere.


@wsnook We are Building PFC v2.1 hardware kit. We were able to derive what we believe to be the pins to land on via a photograph of the in-process build (see link below). Using the 4 position Molex plug housing we landed as follows using the Physical PIN numbers rather than the “GPIO” designated pin outs.

Yellow Wire - to- RPI pin #13 {GPIO 17}
White Wire - to - RPI pin #15 {GPIO 22}
Red Wire - to - RPI pin #17 {+ 3,3 V}



Okay, that helps a lot. As I understand it, you’re trying to wire up a manual shutdown switch which will be monitored by the python script at https://github.com/OpenAgInitiative/openag_safe_shutdown/blob/master/safe_shutdown.py

That script imports RPi.GPIO which looks like it’s provided by the raspberry-gpio-python package. And, the basic usage documentation for that package is at https://sourceforge.net/p/raspberry-gpio-python/wiki/BasicUsage/.

If you scroll down to the section titled “Pin numbering”, it explains there are two possible pin numbering schemes that the code can use. The wiki describes the GPIO.setmode(GPIO.BCM) method–as used by OpenAg’s script–as the lower-level option that is specific to pin numbers of a particular Broadcom SoC. As far as I can tell, the Pi 3 and Pi 2 should have the same GPIO.BCM (SoC) to GPIO.BOARD (hardware pins) mapping–like this:

BCM 17 = BOARD 11
BCM 27 = BOARD 13
BCM 22 = BOARD 15
(BOARD 16 is 3 volt power)

source: https://pinout.xyz (click on pin labels in the image on the left for details on specific pins)

According to the openag_safe_shutdown script’s code, it expects that:

  1. From lines 19-22: BCM pin 22 (board 15) is an output for controlling some sort of power relay. It’s not clear what the relay is for. It seems to be turned on when the script starts, but I don’t see how it would ever get turned off.
  2. From lines 24-27: BCM 17 (board 11) appears to be configured as a ground reference for the power switch.
  3. From lines 14-17: BCM 27 (board 13) appears to be an input for the switch using an internal 3v pullup resistor. From the debounce code in the loop, it looks like this is supposed to be connected to BCM 17 with a momentary pushbutton switch to initiate a manual sudo shutdown -h now.

Also, fair warning… I don’t have the hardware to test this on or compare it to, and I wasn’t involved in writing this code. My interpretation from reading the code and docs might be wrong, and it might not match your hardware.