Project Circuit help!

Hey all! :slight_smile:

I am seeking any advice on an issue I am having with a project. I am a beginner with circuitry and electronics, so please bare with and correct my ignorance and misuse of terminology!

I am making a simple interface with 6 buttons. Each button has a 3mm white (~3.2-3.4v) led inside it. The buttons work by connecting the VCC (3.3v from arduino mega) to a wire that goes into a digital pin and a resistor (220 ohm) that goes to the arduino ground. I’ve attached a screenshot of the schematic for one button/led pair. Now I have made the same circuit but for 6 led and “buttons” and they all share the common ground.

When I tested with one, it worked fine (when the wires in the button touched, the digitalPin immediately read “1” and when released in read “0”). However, when I wired up all six, they work except when I release the wire it takes about 5-10 seconds for the digitalRead to drop back to “0”. I will add that even when the led’s are not connected to the circuit, the buttons still hang at “1” when all 6 are connected. I hope this makes sense!

Why is this? I can make guesses, but I’m sure I am far from understanding the problem. Do I need to insert a diode between the common ground and each switch? Any guidance or advice is greatly appreciated!! I feel a little lost about how to move forward.

Hi Redraw your schematic to show which of the 5V,3.3V or Vin pins of the UNO you have the push button connected to.

Also, make R2 = 10K not 220R , 220R is to low and is loading up your supply rail when you press the button.

R1 as 220R for the LED is okay.

You do have a separate resistor for each button and a separate resistor for each LED?

Can you post a picture of your project do we can see your layout?

Tom.... :)

Hey, thanks so much for the reply!

Ok I will try and get ore clear images/schematics of the full project tomorrow.

The buttons are connected to the 3.3v pin (I know it's hard to tell in the schematic). I will try changing the resistors to 10k! Sounds like that may be the issue (I hope). Yes each button and led will have their own resistor.

Thanks again, and I'd love to hear any other input

Hey so how did you figure out I needed a 10k resistor for r2? I am just trying to learn how to do this right. How did you figure the variables for the ohms law equation (particularly the current) for the push button? Or is it more just your experience working with circuits?

I am gonna try replacing those resistors now!

Thanks!

Others will have a better answer - but part of this is seeing what others have done and what is in tutorials and knowing what has worked in the past. There are certain "magic" numbers for values of things like resistors and capacitors. I think 10k is one for some input stuff, some of my designs I use 470 ohms for the resistors on my LED's - that in part came from a tutorial on another processor.

So make some notes on what works, also look up or get a how to do it book (or you can find stuff online many times from companies that sell equipment - Sparkfun has some that I have used for instance) - I have a couple of books on how do do things and resistor values as well as diagrams are in them and I have bookmarks in them for how to do things and for projects I am thinking about doing in the future

Good Luck

Hi,

Hey so how did you figure out I needed a 10k resistor for r2?

https://www.arduino.cc/en/Tutorial/DigitalPins

The controller ICs have internal pull-up resistors that can be used if you switch input to gnd, they are in the range 20K to 50K.

So its usual to use similar if you are adding them externally, 10K has been found the best in most cases, to act as a pull-up or down resistor and still leave the input pin with good input impedance.

LED resistor..

http://www.evilmadscientist.com/2012/resistors-for-leds/

Tom..... :)