I want to connect a keypad. Can I use just the gpio pins without a protoboard? Will this work?
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
Yes, the keypad you linked to would work because it treats each individual button as a separate switch. This tutorial describes how to connect switches to raspberry pi GPIO pins. The keypad won't need any additional hardware because the GPIO pins (some of them, at least—I'm not sure if they all do) have pull-up resistors.
GPIO LOW - You set your GPIO HIGH
GPIO HIGH - You set your GPIO LOW
Then you need to write code to detect the rising edge or falling edge for the GPIO. The Raspberry Pi already has built in resistors on the GPIO so you can connect directly to the GPIO but
DO NOT EXCEED 3v3 In other words do not connect to the 5v0 PIN.
Say you connected the black to 3v3 then you would setup the GPIO pin to be LOW and detect on Rising Edge.
Some sample Python code for detecting Rising Edge
import RPi.GPIO as GPIO import time import os #adjust for where your switch is connected buttonPin = 17 GPIO.setmode(GPIO.BCM) GPIO.setup(buttonPin,GPIO.IN) while True: #assuming the script to call is long enough we can ignore bouncing if (GPIO.input(buttonPin)): #this is the script that will be called (as root) os.system("python /home/pi/start.py")