Pages: 1 2 [3] 4 5   Go Down
Author Topic: Simulate push button with arduino  (Read 7478 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 143
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

they are split horizontally like i said before, so talking about the power button:
the bottom legs are 0v when camera is on and when i press the button, it goes to 3.3v
This is how they are split


so to drive this pushbutton through a pnp transistor,
is it simple as just driving it HIGH for pressing (closing switch) and LOW for open switch?

About the mode button, since the top legs are 3.3v when open, and when i press the button they get 0v (i just need a 1N4148 transistor) and what code should i have for this one ?
« Last Edit: January 31, 2012, 06:45:06 pm by Carlcox89 » Logged

Offline Offline
Sr. Member
****
Karma: 1
Posts: 486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

from teh pic you posted before(the updated multi meter readings) you need a PNP for the power button, and a diode for the mode button

like the first pic below.

if the button is 0v when pressed(mode button) use the Button to Gnd method from the second pic. if 3v when pressed(Power Button), use the button to 3v method from the second pic.



* 808type3img2916.jpg (159.96 KB, 987x679 - viewed 39 times.)

* Scan 72.jpg (77.94 KB, 1653x1165 - viewed 38 times.)
« Last Edit: January 31, 2012, 07:03:25 pm by sirbow2 » Logged

http://dduino.blogspot.com all my Arduino/electronic projects!!!

{NEW} Getting Started, Learning, Reference + FAQ PDF!!:
[url]http://ar

0
Offline Offline
Full Member
***
Karma: 0
Posts: 143
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, correct.
But what about the code for pressing/releasing each one?
johnwasser told me that for the one that is 0v when pressed (actually mode button, that i have connected throough 1N4148) i had to do this:
digitalWrite(powerButton, LOW);
pinMode(powerButton, OUTPUT);  // Pull the signal low to activate the power button
delay(500);  // Wait half a second
pinMode(powerButton, INPUT);  // Release the power button.

never setting it to HIGH...
but what about the one that i driven by the PNP ?
Logged

Offline Offline
Sr. Member
****
Karma: 1
Posts: 486
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yes, for the diode method, you are just changing between floating and GND:
Code:
pinMode(powerButton, OUTPUT); 
digitalWrite(powerButton, LOW); //Pull the signal low(GND) to activate the power button
delay(500);  // Wait half a second
pinMode(powerButton, INPUT);  // Release the power button... floating

for the PNP it should be just regular LOW/HIGH
« Last Edit: January 31, 2012, 07:09:02 pm by sirbow2 » Logged

http://dduino.blogspot.com all my Arduino/electronic projects!!!

{NEW} Getting Started, Learning, Reference + FAQ PDF!!:
[url]http://ar

0
Offline Offline
Full Member
***
Karma: 0
Posts: 143
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok i think i forgot to connect the GND of the camera to the arduino one.
let me check
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 143
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

weird, now that i have GND of camera connected to arduino's ground, when the emitter leg is connected to the top of switch and collector (from pnp transistor) connected to bottom, camera switches on and off continuously without arduino  being on :o
« Last Edit: January 31, 2012, 07:38:23 pm by Carlcox89 » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What code are you using to drive the PNP transistor? The pin should be HIGH normally, and LOW to simulate pressing the button. Maybe you are holding the pin LOW?

For the mode button, you can either drive it as you already are, or since you have used a diode to connect it, you can just configure it as an output pin all the time and drive it the same way (that is, normally HIGH, but LOW to simulate pressing the button).
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 143
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the problem is that without arduino connected (by USB), but sharing grounds the camera turns on then afterthought few seconds off.. and does that continuosly.
I have a pushbutton connected to arduino (I have tested it separately) and when I press it goes high, when its normal its low.
so I just put the same code but to drive the pnp transistor (for power button)
so when I press it'd drive high the powerbutton of camera..but since the campera is looping on/off I don't know what's wrong
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, you need to change the circuits if you want the camera to work normally when the Arduino is powered down. Currently, when the Arduino is not powered, it will behave as if both buttons are pressed.

See attached. With this circuit, a logic HIGH on the digital pin simulates a button press. I'm suggesting using a mosfet for the low side switch, however an NPN transistor with a 10K resistor between base and pin instead of the 10K resistor between pin and ground will probably do.

The point marked A is the output of the low side switch (the one where you were using a diode before), and B is the output of the high side switch (PNP transistor as before).


* Scan 74.JPG (70.2 KB, 1653x1165 - viewed 46 times.)
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 143
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So, the (**) is a 2N1000 transistor ?
and A connects to actual mode button (top pins), that works like 3.3v and when pressed goes to 0v, correct?

And (*) can be any NPN transistor like 1N4148?
and B is connected to actual powerbutton (bottom pins) connected to collector and top pins to emitter, so that when i set HIGH it's like pressing the button, right?


* Scan 74.JPG (54.31 KB, 1480x454 - viewed 34 times.)
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So, the (**) is a 2N1000 transistor ?

No, 2N7000.

and A connects to actual mode button (top pins), that works like 3.3v and when pressed goes to 0v, correct?

And (*) can be any NPN transistor like 1N4148?
and B is connected to actual powerbutton (bottom pins) connected to collector and top pins to emitter, so that when i set HIGH it's like pressing the button, right?

Yes, except that 1N4148 isn't a transistor, it's a diode. Any small signal NPN transistor will do.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 143
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, my bad of course it's a diode!
Just need to go out to buy a 2N7000
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you have some small signal NPN transistors lying around, try one of those instead:

- emitter to ground
- base via 10K series resistor to Arduino pin
- collector becomes point (A) in my diagram
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Full Member
***
Karma: 0
Posts: 143
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I went out to buy the 2N7000 transistor for button A but forgot to buy one for (*) connection smiley-neutral


* Scan 74.JPG (54.31 KB, 1480x454 - viewed 31 times.)
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 143
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can i use a 2N2222 for the (*) connection ?
Logged

Pages: 1 2 [3] 4 5   Go Up
Jump to: