robindb97
Posts: 7
Joined: Thu Jun 19, 2014 11:45 am

where do i place button

Thu Jun 19, 2014 11:52 am

hey 1 simple question
where do i place a button
and i only have the resistors used in the photo dont know the Ohm
Image

robindb97
Posts: 7
Joined: Thu Jun 19, 2014 11:45 am

Re: where do i place button

Thu Jun 19, 2014 3:31 pm

its color
black brown brown brown black
so 100 Omh

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12110
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: where do i place button

Thu Jun 19, 2014 3:38 pm

where do i place a button
depends on the buttons you have. some buttons have four wires/pins, where two pins are internally connected. You should plug it in so that you do not short the switch contact inside the button. a multimeter (set to ohms) would be useful to see if you can control the conductivity of the switch after you have plugged it in. if you use four pins "6 by 6mm" switches, like these:
Image

the pins placed farther apart (6.5mm) are actually connected together, so they should go into the same 5-hole row of the breadboard, while the pins that are 4.5mm spaced go into a different row of holes.

obviously if your switch is something completely different this doesn't apply, but the basic thing is that you connect its two wires to different 5-hole rows of the breadboard, as all the 5 holes of a row are connected together, so its no good to pith both wires of the switch into the same row.

this is a good, (but hardly perfect) example of using a 6x6mm button on a breadboard.
Image
pressing the button connects the GPIO pin to GND through a 330 Ohms "safety resistor". Note that no (10K Ohm) pull-up resistor to 3V3 is used, as it really should have, probably the software controlled internal (+- 50K) pull up is set to on, which works, but can be a bit sensitive to interference, adding a 10K pulp between the GPIO and 3V3 would be better.

I also notice that the drawing is wrong in the sense that the LED's are drawn the wrong way around!
If you look closely you can see the transparent inside of the LED isn't symmetrical, but on one side has a "arrow/pin", and on the other side a "cup" (which holds the light emitting chip), the "cup" side is always the cathode of the LED (its a nice memory aid, cup=cathode, its also often the shorter lead) and so should be connected with the negative side (GND in this case) for the light emitting diode to be in conduction.

robindb97
Posts: 7
Joined: Thu Jun 19, 2014 11:45 am

Re: where do i place button

Thu Jun 19, 2014 4:56 pm

how do i turn off led when button is prssed?

robindb97
Posts: 7
Joined: Thu Jun 19, 2014 11:45 am

Re: where do i place button

Thu Jun 19, 2014 5:03 pm

here is the button how it looks
Image

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12110
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: where do i place button

Fri Jun 20, 2014 12:46 am

robindb97 wrote:how do i turn off led when button is prssed?
you write a program that reads the button, and turns the LED of when you detect a key press. Its not rocket science.
I would advice to read a few free magpie magazines, they contain lots of the jigsaw puzzle pieces you need, maybe even the whole puzzle.

http://www.themagpi.com

and yes, that is a typical 6x6mm button, but it seems from the picture that it's pins are a bit short for a breadboard. Then I suppose soldering longer wires to them is out of the question? It shouldn't be, (out of the question) as soldering is easy! the most important knowledge you need is to know which end to hold it by! and its one of the most useful skills you can learn quickly. Look it up on youTube, there are some nifty instruction movies there to help you.

User avatar
Cancelor
Posts: 757
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: where do i place button

Fri Jun 20, 2014 8:54 am

Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12110
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: where do i place button

Sat Jun 21, 2014 3:31 pm

about the second link, and "Finished Tux Crossing – Breadboard layout" I can add that it is using one of the GPIO's that is normally used for I2C, (but can be turned into normal GPIO's in software), and those do have (1K8) pull-ups, so no other pull-up is necessary. Also, Its missing the "safety resistor", but as long as you know what you are doing (not programming the GPIO as output, outputting a high, and then shorting that high by pressing the button) there is no problem.

this is one more or less ideal button/switch connection configuration:
Image

Return to “Beginners”