loading
I needed to switch something with 2 buttons but only 2 wires where installed.
So this is how i solved this problem:

Step 1: Part List

2 pushbuttons
2 220 ohm resistors
2 LED's
Arduino (mini Pro in my case)
Some wires

Step 2: How to Connect

1 resistor between the GND and the analoge port (A0).

The 2 wires from the analoge port and the 5v to the remote control.
In the remote control 1 220 ohm resistor after one of the 2 buttons (see drawing).

Connect the LED's to digital pin 11 and 13. For testing not with a resistor but if you gonna use LED's you need to put a resistor between the LED and the GND.

Step 3: The Program

Upload the program to your arduino and you are ready!

/* 2 wire 2 button control
By floris@deboktor.nl
nov 2013

req:
-2 x 220 Ohm resistors,
-2 x push buttons,
-2 x LED's,
-Arduino
-some wires
*/
const int ledPin1 = 11;
const int ledPin2 = 13;
const int limit = 450; //if the 2 resistors have the same value then the limit should be about half of 1023

int AnalogeValue = 0;

void setup() {
Serial.begin(9600); //for testing purpose
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop(){
AnalogeValue = analogRead(0);
Serial.println (AnalogeValue);
if (AnalogeValue>(2*limit)){
digitalWrite(ledPin2, HIGH);
digitalWrite(ledPin1, LOW);
}
else
if (AnalogeValue>limit){
digitalWrite(ledPin1, HIGH);
digitalWrite(ledPin2, LOW);
}
else {
digitalWrite(ledPin1, LOW);
digitalWrite(ledPin2, LOW);
}
}
nice instructable... using a simmilar aproach you could also detect broken wires or a short circuit if you add a resistor parallel to the switch... so you would need to sense a certain voltage if all is ok... the principle is called namour...

About This Instructable

1,766views

10favorites

License:

More by fpoels:2 wire 2 button Remote Arduino Iphone controlled led without a computer or internet 
Add instructable to: