# How to control on off buttons

I want to control some external hardwares on off buttons using arduino, like mobile phones numerical buttons, and camera on off buttons. I can do this with relay, but always relays causing chatter problem.

When I measure these button's two points It showing 2.72 volts, but in button pressed condition voltage level is zero. So is there anything possible for using common transistors like BC547, 2n2222.

Actually what is happening while pressing the button why this is goes zero.

I can do this with relay, but always relays causing chatter problem.

No they don't.

When I measure these button's two points It showing 2.72 volts

Is this across the button's two connectors?

but in button pressed condition voltage level is zero.

Well no surprise here if two points are at the same potential then the voltage measured between these two points will be zero.

You need to measure the voltage between the ground of the circuit and the two sides of the button. You could see one side being ground and the other being a voltage. Although that is only if the circuit in the thing you are measuring is a simple one. There are lots of ways these buttons could be wired up, for example they could be in a scanning matrix.

The fool profs way to simulate the button press is to us an optically isolated FET. If you use a transistor you have to make a common ground between the two circuits.

yes, I measured each points of the buttons between Ground. When I measure the input point with reference to ground It is the same 2.72 volt, the output point and ground zero but in button pressed condition each point of the buttons are zero. Can you please elaborate how to use optically Isolated fets, with circuit diagram.

Thank you

Grumpy_Mike: No they don't. Is this across the button's two connectors?

No I did it with relay actually I've connected both two input and out pin of the buttons with relay's common and normally opened pin, when I give a signal using arduino relays are giving button press connection to the external hardware. But's for long button press sometimes it's causing chatter.

but tell me how to use optically isolated fet pls.

Thank you.

But's for long button press sometimes it's causing chatter.

That makes little sense. It would be the short press that would give you problems if any.

What do you mean by chatter?

but tell me how to use optically isolated fet pls.

You wire the FET output across your button and you wire the LED input like you would wire any other LED with a series resistor.

Grumpy_Mike:
What do you mean by chatter?
You wire the FET output across your button and you wire the LED input like you would wire any other LED with a series resistor.

Chatter means it is relay bouncing the common port is on and off randomly.

so if led blinks the fet will switch on the button is it

Chatter means it is relay bouncing the common port is on and off randomly.

Yes but that doesn't square with what you said before:-

But's for long button press sometimes it's causing chatter.

If it is only contact bounce then that would not be worse on long presses, it would make no difference, that is why I don't think bounce is the problem. The other device should have contact debouncing built in. You could try a small capacitor across the relay contacts 0.1uF if you have to ask the value.

yeah I tried even though I can't control this, and also i tried pullup resistor, hysteresis everything.

I tried for LDR with LED it is working perfectly.

and tell me I asked these question to many technical people near around me everybody said make it with transistor even though they can't give me transistor circuit.

How you know about these stuffs, and can you refer me how to get practical knowledge very well.

one more probs in LDR.

in ordinary button program in arduino samples I tried to LDR instead of push button. But it's not working.

but it only working for below 3 volt. Is there anyway to solve this.

Thank you so much.

How you know about these stuffs,

I have been doing electronics since 1965, you pick up a few things you know.

and also i tried pullup resistor, hysteresis everything.

I am not sure what you mean by hysteresis, I am also sure that you do not know what this means either.

in ordinary button program in arduino samples I tried to LDR instead of push button. But it’s not working.
but it only working for below 3 volt. Is there anyway to solve this.

Yes there is a way to solve this but only if you describe exactly what you are doing. That means posting a schematic of what you are doing along with the code you are doing it with.

and tell me I asked these question to many technical people near around me everybody said make it with transistor even though they can’t give me transistor circuit.

I don’t believe that. Attached is a diagram of how to use a transistor.

Grumpy_Mike:
I am not sure what you mean by hysteresis, I am also sure that you do not know what this means either.

Hysteresis for reverse current protection in relay coil current between load current.

Pullup resistor for noise filter in Uln 2003 Ground pin to signal Output pin(relay driver noise filter).

If thing I m wrong and I don’t know these things.you can directly search on Google.

But your solution with LDR is most useful. I didn’t find it on google.

This is the example program which I’m working on. I need to use some thing instead of push button.

/*
Button

Turns on and off a light emitting diode(LED) connected to digital
pin 13, when pressing a pushbutton attached to pin 2.

The circuit:

• LED attached from pin 13 to ground

• pushbutton attached to pin 2 from +5V

• 10K resistor attached to pin 2 from ground

• Note: on most Arduinos there is already an LED on the board
attached to pin 13.

created 2005
by DojoDave http://www.0j0.org
modified 28 Oct 2010
by Tom Igoe

This example code is in the public domain.

*/

// constants won’t change. They’re used here to
// set pin numbers:
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin

// variables will change:
int buttonState = 0; // variable for reading the pushbutton status

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}

void loop(){
// read the state of the pushbutton value:

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}

Thank you

Grumpy_Mike: I have been doing electronics since 1965, you pick up a few things you know.

.... he said, way too modestly, since one of those "few things" is a PhD

Hysteresis for reverse current protection in relay coil current between load current.

Just as I thought, that is not what hysteresis means, that is a back EMF protection diode. It should be on anyway but in no way affects your problem.

Pullup resistor for noise filter in Uln 2003 Ground pin to signal Output pin

That is so totally wrong and will do nothing.

Your problem is mechanical, if the relay contacts are bouncing then you need either a better relay or to put a capacitor across the relay contacts.

But your solution with LDR is most useful

I did not post a solution with a LDR, that is a transistor in the picture.

Grumpy_Mike:
I did not post a solution with a LDR, that is a transistor in the picture.

I’m not saying today that transitor picture, I’m saying about your earlier one which is simlar to ldr opto-Isolator.

t your earlier one which is simlar to ldr opto-Isolator.

I think you are confusing LDRs with photo transistors or FETs. They are totally different things and work in totally different ways.

OHHH ok sir anyway that problem solved Right now I have new problem, I'm currently doing DTMF decoder chip 8870 for that we have to input via Headphone but at the same time I need to disconnect it whenever i want, I can do this with relay, I'll connect one of the pin directly to the DTMF pin and another one to the relay common and relay n/o to circuit. So that I can de activate it when never I want using arduino.

is it possible to do it with anything without relay. pls help me.

thank u!

but at the same time I need to disconnect it whenever i want,

Why? There is no need to ever disconnect the chip. And what do you mean by disconnect anyway?

Removing the power from a chip that you are feeding with an input is one of the best ways of destroying it.

If you do not need the input from the chip at any time then stop looking at the outputs with your code.

Grumpy_Mike: Why? There is no need to ever disconnect the chip. And what do you mean by disconnect anyway?

Removing the power from a chip that you are feeding with an input is one of the best ways of destroying it.

I'm not going to disconneting the power input, only I'm going to interrupt the signal.

Grumpy_Mike: If you do not need the input from the chip at any time then stop looking at the outputs with your code.

ohhh ok thats nice plan thank u sir

The circuit:

• LED attached from pin 13 to ground
• pushbutton attached to pin 2 from +5V
• 10K resistor attached to pin 2 from ground

here I want to use transistor instead of push button pls give me appropriate circuit diagram sir.

Thanks