Raspberry Pi GPIO - newbie question

Hi,
Sorry for the newbie question, but I’m having trouble with the GPIO:
I copied the example for the GPIO switch

Example configuration.yaml entry

switch:

  • platform: rpi_gpio
    ports:
    11: Fan Office
    12: Light Desk

Now the two items apear on the homescreen for the HA,
This is what I’m not sure of - is that GPIO pin 11 (BCM17) or GPIO 11 (Pin 23)
Hope that makes sense.
I have a multimeter connected across GND and Pin 11, but when I toggle the switch on HA I don’t see the voltage change, it remains at 3.3VDC.

Hope someone can point me in the right direction
Chris.

I think everyone uses this http://wiringx.org/ therefore GPIO11 is pin 26 of the header.

I am using the GPIO number. See the link below.

In my yaml files I use 4 for my DHT22 sensor and 17 for my rf transmitters for the PIN numbers. I keep an excel file to keep things straight.

Hi both,

Working on GPIO 11 (PIN 23) !!
Some research on pull-up resistor values and I’ll have a crack at the inputs to see what I can do.
May need to invest in some M-F and M-M jumper wires and a breadboard…

Many thanks,
Chris.

Hi,
I’m really sorry to have to ask questions again on something that’s probably very simple, but I’ve searched and can’e see the answer.
I note that the Pi has built in pull-up or pull-down resistors that can be set through the configuration.yaml file when defining the inputs, The exact form isn’t clear to me (sorry)
The options suggest:
pull_mode (Optional): The internal pull to use (UP or DOWN). Default is UP.

So what do I put in the yaml file when setting the inpust as:
binary_sensor:

  • platform: rpi_gpio
    ports:
    11: PIR Office
    12: PIR Bedroom

Again, really sorry for the repeated questions, but I’d appreciate advice on how to set it for pull-up resistor so the input is activated by being connected to GND.

Kind regards
Chris

I’ve read through about 30 configuration.yaml files, and the associated !include binary sensor files and still can’t find the answer.
Would someone please be kind enough to help me out with the correct syntax/format to make those two inputs high by pull-up (the onboard ones)?

Kind regards and thanks in advance,
Chris

pull_mode: UP
at the same indentation as ports:

OR none as the default is pullup but I believe it’s always better to state the obvious because later you WILL :stuck_out_tongue: forget!

BTW you may or may not need ’ single quotes round UP (and you may or may not need it in lowercase) :stuck_out_tongue: However I think UP is fine :slight_smile:

Thanks for that, I’ll give it a whirl in the morning - the Pi is at work and I’m messing about with it between calls on the support line.
Hoping to get hold of a Lundix box to link in my Vanderbilt SPC Intruder panel at some point too, and then some Ikea Tradfri lights…

Hi,
Sorry about this, but I can’t seem to get the pull-up thing to work.

Example configuration.yaml entry

binary_sensor:

  • platform: rpi_gpio
    ports:
    26: PIR Office
    pull_mode: up
    20: PIR Bedroom
    pull_mode: up

I’ve tried the above, and a few variations:
pull-mode: UP
pull_mode: ‘UP’
pull_mode: up
pull_mode: ‘up’

All I seem to get is config validation failed.

If someone could tell me where I’m going wrong that would be great.

Kind regards,
Chris.

pull up is the default so you don’t need it anyway :slight_smile:
pull_mode (Optional): The internal pull to use (UP or DOWN). Default is UP. I would just # it out with a comment saying defaults to pull_up (just so you remember). However I think it needs to be pull_mode: UP

So if you aren’t getting an input then you are connected to the wrong pin on the header. The GPIO/BCM ports you have are pins 37 (26 Office PIR) and 38 (20 Bedroom PIR) of the header. See here https://pinout.xyz/

So to clarify the HA port No. is equivalent to the BCM/GPIO No.s in the diagram I linked (BCM and GPIO are interchangeable names for the broadcom devices pins). The physical pins on the header are where you put the inputs in.

Hope that clarifies it a bit :wink: