Basic question : Connecting a button

To connect a LED a resistor is required to limit current.

What about buttons (momentary push buttons) ? Is a resistor needed ?

If I configure a pin as InterruptPort in Port.ResistorMode.PullUp mode does it mean I can safely connect it (using jumper wire for example) to GND to trigger it ?

[quote] I configure a pin as InterruptPort in Port.ResistorMode.PullUp mode does it mean I can safely connect it (using jumper wire for example) to GND to trigger it ?


Sorry for the long answer. ;D

Mike; Yes! to the first or second question :slight_smile:

But to bee clear you don’t need a resistor on the button. The pull up resistor is there to set the input pin in a known state so it’s not ‘floating’, but it’s not a current limiting resistor for say a LED.


[quote]Mike; Yes! to the first or second question

Yes! :smiley:

If you enable weak pullups… You don’t require a resistor (as its provided by the ARM micro)

You can just ground the pin via a push button…

I think Mike’s spaced out!!!

Cheers Ian

Since I am in a learning mode: why don’t you need a resistor? Is pressing the button not creating a short?

Rob, you can use a resistor to limit the current that will flow when either the connection is made or the connection is broken (depending on whether you expect at-rest state of high or low)

I tend to always limit the current with a resistor, and have my switches pulled down to ground when not pressed.

Yes you will DAMAGE FEZ if you connect a button to a pin with no resistor and make that pin output using OutputPort.

The resistor is not required but if you are not sure of what you are doing then a resistor will protect your FEZ.

I personally do not use resistor but I also completely understand the circuit I am working on so I would not make the mistake of making an OuputPort on a pin that is connected to a switch.

@ Gus: But the pin in question would be an input if there is a push button… And the micro powers up tristate with pullup enabled.

If someone connects a button through (pin X) to ground And then configures as an output, then send the pin high, then presses the button!! resistor or no resistor that pin is gone. They must put it down to stupidity…

@ RobV: If the pin is configured as an input it wont short if you ground the pin and it wont fry it you connect it to 3.3v… When you design your project, you know what pins are gonna be input and ouputs. So it shouldn’t be a problem…

Actually this is the first processor I’ve worked on that has pull ups/ downs on Input as well as output.

Cheers Ian

Actually with 1K resistor the pin is safe. This is to protect against misuse.

Do you mean in parallel with the button?

I actually keep thinking that someone wouldn’t possibly misuse in this fashion!!

I suppose you have to treat people with kid gloves…

Its a good job there is more that one opinion on this forum… I don’t give people the benefit of the doubt…

Cheers Ian

This is coming from one that has fried a Domino.
I’m wondering. Is it possible to make a safety shield where all pins and the processor is protected, but still would work as normal?
When we play around with these devices on a breadboard errors are easily made. So is it possible to make some sort of safety net for us?
And no, -i’m not thinking of a component shield :slight_smile: but something for us that likes to mess around with bare components.

Any time you leave something up to a user to connect, you have the chance of it being screwed up. I don’t think any shield would help here - you connect something that was meant to be to ground to 5v and you hurt things.

Having said that there are plenty of shields that have more “formal” breadboard or prototyping area. [url][/url] for instance.

You can make a super protector shield but then that would cost as much as the FEZ itself so it is not worth it

@ Geir: Yours was a forgivable error the pins were configured as ouputs and the LE’D’s were current limited.( I gave that some thought by the way, If you had only one resistor and one led was on and the other two were off “I think thats the configuration of tri LED’s” you could short the domino pins quite easily)

Most people incorporate optocouplers in final designs. Bullet proof input / output protection for general purpose pins, We do. they are pence / cents for a quad coupler.

Cheers Ian

@ Gus;
This is scary stuff. Can you confirm what IanR is saying?

My RGB colors are random numbers from 0-100 on a PWM signal. Should I set a lower limit? As it is now one might be at 100% and the other two at 0%.

@ Geir: Im not trying to panic you at all, I was pondering this problem for a few days can. you give me the part number / descrition of your tri LED and I can check its data sheet…

I can’t understand why a possible 12mA could have overloaded the ouput pin of your domino ( especialy with PWM ) I would have thought that three resistors, one per colour…

See the attached picture… ( the 180 ohm resistors are a bit on the small side )

The shear fact that they are diodes, prevent possible shorting ( I was merely speculating ) I’d love to know why your board smoked… Please disregard that specific comment!!

Cheers Ian

Hi Ian
The RGB LEDs where some cheap eBay ones so I really haven’t got any datasheet, but I have used them in the past with no problem.
I do agree that a current limiting resistor on each color is probably the correct way to go, and as the Red color is so dominant it is a good way to balance out the intensity.
However for my Crystal ball I have things behind transistors so I should be ok, but thanks for your interest in my case.
This is how it’s hooked up now.