Rugged Metal Momentary Pushbutton (with LED) + Raspberry Pi

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
PenguinCreations
 
Posts: 1
Joined: Tue Jul 27, 2021 5:16 pm

Rugged Metal Momentary Pushbutton (with LED) + Raspberry Pi

Post by PenguinCreations »

Hello,

This is the first time I'm working on a physical kind of setup, and I'd like to make sure I have my research correct.


Goal:
- When I push a button, existing Raspberry Pi 2 B will execute a script to shut down my other PCs (ESXi hosts).
- At the same time, I'd like for there to be an LED to flash to show the script is in progress, until it is done.
- I'd like to do this without and soldering, and without the use of a breadboard.


Materials Needed?
1) Rugged Metal Pushbutton with Green LED Ring - 16mm Green Momentary - (ID: 560)
2) Arcade Button Quick-Connect Wire Pairs - 0.11" (10 pack) - (ID: 1152)


Proposed Wiring?

Code: Select all

    LED Side            |       Raspberry Pi
                        |
    + (Anode)           |       GPIO Pin (ex: GPIO5)
    - (Cathode)         |       GND
                        |
    NO1 (Normally-Open) |       GPIO PIN (ex: GPIO17)
    C1 (Common)         |       GND


My questions:
  1. Am I correct to be using the 0.11" quick-connect wires for the switch?
  2. What about the 0.187" multi-colored quick-connect wires (ID: 3835) - would they fit?
  3. Can the JST connectors be plugged directly to the Raspberry Pi I/O pins or do I need to cut off the JST connector and crimp on 2 female dupont headers?
    (Assuming I can find 2 appropriate ones that are:
    Side by side such as GPIO5 on pin 29 and GND on pin 30, or
    Vertically aligned such as GPIO17 on pin 11 and GND on pin 9)
  4. Is my proposed wiring correct? No need to add my own resistor since the Button comes with one, right?
  5. I understand a GPIO pin supplies 3.3V. Is that enough for the LED? Just want to make sure since the description is a bit ambiguous. It says "Connect 3 to 6V to the LED to have it light up nicely" and the technical details says "Lamp rated voltage: 6V"
To make sure we're talking about the same thing, this is the Pinout guide I'm referring to. I've also attached it as an attachment with the relevant pins highlighted.
Attachments
Raspberry Pi Pinout for Momentary Button.png
Raspberry Pi Pinout for Momentary Button.png (52.79 KiB) Viewed 195 times

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: Rugged Metal Momentary Pushbutton (with LED) + Raspberry

Post by adafruit_support_mike »

PenguinCreations wrote:Am I correct to be using the 0.11" quick-connect wires for the switch?
I think the Rugged Metal switches fit the 0.187" quick-connects better.
PenguinCreations wrote:What about the 0.187" multi-colored quick-connect wires (ID: 3835) - would they fit?
Use these instead of the 0.11" version.
PenguinCreations wrote:Can the JST connectors be plugged directly to the Raspberry Pi I/O pins
The connector is a 2-pin JST-XH, which has 2.5mm pin spacing. It will fit over two adjacent pins on a RasPi's GPIO header. The housing is a bit bulky though.
PenguinCreations wrote:or do I need to cut off the JST connector and crimp on 2 female dupont headers?
DuPont housings would be a good choice if you want crimped terminals. We have them for our jumpers with terminals:

https://www.adafruit.com/product/3145

but we don't carry the terminals themselves. You can find packs of terminals and housings online though, if you don't already have them.

A third option is to remove the terminals from the housing and cover them with heat-shrink:

https://www.adafruit.com/product/344

Use enough to go from the open end of the terminal to about 1cm up the wire. That will give you a layer of insulation around the terminal and good strain relief on the wire.
PenguinCreations wrote:Is my proposed wiring correct?
If you want to keep the JST-XH housing, any GPIO pin next to a GND pin would work.
PenguinCreations wrote:No need to add my own resistor since the Button comes with one, right?
Right, but for the wrong reason. The built-in resistor is connected to the LED. The switch that you'll connect to the RasPi GPIO pins doesn't have any resistor.

The RasPi's GPIO pins have built-in pull up resistors that you can connect in code.. INPUT_PULLUP or something like that, IIRC. Being able to use the GPIO pin's built-in resistor means you don't need an external pull-up for the switch.
PenguinCreations wrote:I understand a GPIO pin supplies 3.3V. Is that enough for the LED?
Yep, 3.3V is enough to light red, green, and blue LEDs.
PenguinCreations wrote: Just want to make sure since the description is a bit ambiguous. It says "Connect 3 to 6V to the LED to have it light up nicely" and the technical details says "Lamp rated voltage: 6V"
You need at least 3V to ensure the LED will light up. The built-in resistor's value was chosen on the assumption of having a 6V supply.

Very few circuits only work in a single set of conditions. Most circuits work reasonably well across a fairly wide range of voltages, but can be tuned to work really well in a narrower range. In this case, ew're talking about an LED with a current-limiting resistor. You'll get some amount of light anywhere between 3V and 12V, though the LED might start to overheat above 15V. The resistor value chosen for 6V will give a good balance of brightness and long LED life at 6V. At 4.5V and below the LED won't be as bright, but will last even longer. At 7.5V to 12V the LED will be brighter, but will also wear out earlier.

Nominal LED life is around 10,000 hours, but excess current will wear them out faster. Putting 250mA through an LED designed for 25mA will drop its output per milliamp to half the original level (the standard way to merasure LED lifespan) in maybe 100 hours.
PenguinCreations wrote:To make sure we're talking about the same thing, this is the Pinout guide I'm referring to. I've also attached it as an attachment with the relevant pins highlighted.
Yep, that's the RasPi pinout. This one is also good:

http://pinout.xyz/

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”