Go Down

Topic: [Solved]Problem with button reading (Read 309 times) previous topic - next topic

akiskaps

Feb 01, 2019, 07:50 pm Last Edit: Mar 05, 2019, 12:01 am by akiskaps
Hello, I am trying to make a midi controller using arduino. The circuit is very simple, it contains 8 potentiometers(right side in picture) and 9 arcade buttons(left side). After soldering the components, i am not able to read values from any button, although the potentiometers readings are all fine. I think I have soldered the yellow wires of buttons in the wrong place(the wires they read values from buttons).Thanks in advance, any help will be apreciated!

larryd

OP image




All yellow wires on left side components are shorted out by the black wires.

Always start with a SCHEMATIC!



No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

akiskaps

Really thanks for the reply. You are absolutelly right about the schematic and thank you for the advice(that was my first circuit). I didnt actually understand what i did wrong, should i desolder the yellow wires and solder them in other place ?

larryd

#3
Feb 01, 2019, 08:22 pm Last Edit: Feb 01, 2019, 08:36 pm by larryd
Switches are usually wired in one of three ways.

See the 3 examples in this drawing:




Show us a schematic of what you are attempting to wire up.

It is possible the yellow wire should be moved to the top of the red component but we need to be told what that component is and 'we need a link to the data sheet of that switch' !

It seem like your switches should be wired as S1 in the above schematic.








No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

akiskaps

Thank you all for your responses, you helped me a lot! I just desoldered the yellow wires and soldered them before the 10k resistor and everything works perfect!!!

larryd

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

PieterP

#6
Feb 01, 2019, 10:09 pm Last Edit: Feb 01, 2019, 10:11 pm by PieterP
Thank you all for your responses, you helped me a lot! I just desoldered the yellow wires and soldered them before the 10k resistor and everything works perfect!!!
You don't need the resistors at all, the Arduino has them built-in. You can just connect a button between the Arduino pin and ground, and enable the internal pull-up resistor using pinMode(pin, INPUT_PULLUP). (See the leftmost switch in the picture of reply #3.)

Pieter

larryd

You don't need the resistors at all, the Arduino has them built-in.

Pieter
It appears the OP has those resistors as pull downs, red wire might be +5v, black wire GND, yellow wire INPUT pin.

But, who knows without a schematic :(


No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

PieterP

It appears the OP has those resistors as pull downs, red wire might be +5v, black wire GND, yellow wire INPUT pin.
I think so too, but just so he knows for his next project :)

akiskaps

You don't need the resistors at all, the Arduino has them built-in. You can just connect a button between the Arduino pin and ground, and enable the internal pull-up resistor using pinMode(pin, INPUT_PULLUP). (See the leftmost switch in the picture of reply #3.)

Pieter
Oh that is very interesting and usefull for future projects. Can you please tell me if all pins(Digital & Analog) have this ability? And if so i have to use them as pull-up resistors or I can use them as pull-down resistors too?

It appears the OP has those resistors as pull downs, red wire might be +5v, black wire GND, yellow wire INPUT pin.

But, who knows without a schematic :(



Yes, I am using them as pull-down resistors and you described the wires correctly. I learnt from my mistake and i will make a schematic before any soldering etc.

PieterP

Oh that is very interesting and usefull for future projects. Can you please tell me if all pins(Digital & Analog) have this ability?
Yes. The analog pins on most Arduinos are full-fledged digital pins, with analog functionalities as an "extra".
The only exception I'm aware of are the analog-only A6 and A7 pins on ATmega328P TQFP boards like the Arduino Nano.

And if so i have to use them as pull-up resistors or I can use them as pull-down resistors too?
They are pull-up only, but there is absolutely no need for pull-down resistors for buttons. You just invert the logic in software.

Go Up