Product Code: 45B

Buying Links: 

DESCRIPTION

The Squid Button makes it super easy to attach a push switch to a Raspberry Pi.

[Note: Switch and lead colors may vary]

The Squid Button is in fact a momentary action push switch with trailing leads that end in female header sockets that will fit over GPIO pins on a Raspberry Pi, Node MCU or Particle Photon. To reduce the chance of accidental short-circuits when using the Button, each Button has a built-in 470Ω resistor that does not affect the switching action when connected to a GPIO input, but does mean that if the switch is accidentally connected across power connections your Raspberry Pi will not come to any harm.

GETTING STARTED

  1. Start by putting a Raspberry Leaf GPIO template supplied over the GPIO connector like this:

2. Attach the button as shown below, with one lead connected to GND and the other to GPIO25. If you don’t have a Leaf, count along the pins to find the right position.

3. Now you can try out the Button using a little Python program. So, open an LX Terminal window and then run the command below (no need to type the $ sign):

$ nano input.py

When the editor has opened, paste the following code into it:

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)

GPIO.setup(25, GPIO.IN, pull_up_down=GPIO.PUD_UP)

while True:
    input_state = GPIO.input(25)
    if input_state == False:
        print('Button Pressed')
    time.sleep(0.2)

Save the file by pressing CTRL-x and then Y and ENTER to confirm.

You can now run the program using the command:

$ python input.py

Now, every time you press the button, you will see the message “Button Pressed”.

RESOURCES

To make it easier to use the Button, and to ‘debounce’ it, you can use the Squid library.

If you want to learn a while lot more about Raspberry Pi and digital inputs, you might be interested in one of Simon’s books on the subject. Especially The Raspberry Pi Cookbook and Programming Raspberry Pi.

The Squid Button is actually great for making a ON switch for the Raspberry Pi 2 or 3. You can find instructions for doing this here.

RELATED PRODUCTS

We also make a Twin Pack of Squid Buttons and a Combo Kit that includes two Buttons and an RGB LED.

2 thoughts on “Squid Button

  1. Ankur Patel

    Great product. I want to buy 60 of these. Can they be made and is there bulk discount for a non profit organization like Public School.

  2. FirstNed

    I have noticed you don’t monetize your site, don’t waste your traffic, you can earn additional cash every
    month because you’ve got hi quality content. If you want to know how to
    make extra $$$, search for: Mrdalekjd methods for $$$

Leave a Reply

Your email address will not be published. Required fields are marked *