Hello, for my project I need to simulate pressing a button on my car's keyfob. I already opened it up and set it up so i have four wires(two per button for two buttons) and it works if I tap wires together(I also have a 1.5k resistor on the end of one wire for each button....it seemed like a good idea? lol idk). However when I connect the wires to an optoisolator on my board it doesn't activate.(I tested the optoisolator with a multimeter and it is working fine) It seems like maybe the optoisolator isn't the best solution anyways since I don't think I really need the isolation(keyfob runs off of a 3.3v battery). Could I use a transistor to replace the optoisolator? Would this transistor work:http://www.digikey.com/product-detail/en/P2N2222AG/P2N2222AGOS-ND/920244? Also can I use a 1.5k resistor instead if 1k? Any help would be greatly appreciated. I am so close to finishing a year long project and this is one of the last things I need to figure out.
Thank you
also if anyone needs any further information please ask.
A transistor will only work if there's enough volts.
I'd try driving it directly with the Arduino pin. Figure out which side is ground and connect that to Arduino ground. Connect the Arduino pin to the other side of the switch through a resistor. Try 5K. Go downwards if it doesn't work (2.2K, 1K, etc...)
To press the switch do:
pinMode(x,OUTPUT);
digitalWrite(x,LOW);
To release the switch do:
pinMode(x,INPUT);
digitalWrite(x,LOW);
Also you need to know the correct polarity of the two wires for each switch you are trying to control as a transistor or opto output will only switch if the polarity of the controlled circuit is correct. However if you were to use small 5vdc reed relays to control the fob buttons then you wouldn't need to know anything about the voltage or polarity of the fob button wires, just wire each relay contacts across the fob button contacts.
I do know the polarity and I would prefer to indirectly control the buttons(something in between). That reed relay sounds like it might be good except it might be a little too big(unless theres some that are smaller than the 4 pin across ones). Also I'm sorry, but I don't quite understand what you mean by the transistor needs enough volts. Where does it need enough volts from? The keyfob runs at 3.3v and the arduino pins are 5v so I'm guessing the keyfob is too low voltage for the transistor?
Does anyone know why the optoisolator method isn't working? I wired it like this Optocoupler, but instead of an led its attached to the buttons(with correct polarity I checked, double checked then checked again).
The relay would work.
The specs tel us it works at 10 mA which would sugest you can directly connet it to your Arduino (but i wouldn't do that).
But as it is a coil, it might draw a larger current while switching on.
You need a diode across it's coil anyways.
The 3.3 volts is the power supply to the device, which doesn't tell anything about the voltage at those switches.
I was looking at that spec sheet for this: http://www.digikey.com/product-detail/en/9007-12-01/306-1280-ND/1914956 This one looks like it has the diode built in. Do you think this would be a reliable(long term) component. Also I can't tell, but it looks like the pins are wider apart than my board's holes(my board is the same as an arduino's holes). Is there something I should look for in the datasheet? Also how would i connect it? Like what type of resistor if any and would I just send a pin HIGH in the code? Thank you again.
cmat1120:
I was looking at that spec sheet for this: 9007-12-01 Coto Technology | Relays | DigiKey This one looks like it has the diode built in. Do you think this would be a reliable(long term) component. Also I can't tell, but it looks like the pins are wider apart than my board's holes(my board is the same as an arduino's holes). Is there something I should look for in the datasheet? Also how would i connect it? Like what type of resistor if any and would I just send a pin HIGH in the code? Thank you again.
Well that appears to be a 12volt relay coil so not that easy to use in an arduino. But there are many 5vdc reed relays that draw 20ma or so and yes you can wire them directly to an arduino output pin and use digitalWrite() commands, but use a diode across the coil if one is not built into the relay.
So I found a reed relay similar to the other one I posted but it is 5v instead of 12. I think I can use this, but I would like to know if there is a more reliable(solid state maybe) option available. Or maybe I'm underestimating the reliability of a reed relay. If so please tell me.
Also how would I attach this to my pcb board? It uses .1" spacing I think(same spacing as a breadboard), but the relay uses .2" spacing. Is there an adapter or should I bend the legs or what?
cmat1120:
So I found a reed relay similar to the other one I posted but it is 5v instead of 12. I think I can use this, but I would like to know if there is a more reliable(solid state maybe) option available. Or maybe I'm underestimating the reliability of a reed relay. If so please tell me.
Nothing unreliable about a reed relay if used within it's contact ratings, probably more reliable then the button switches used on the fob.
Also how would I attach this to my pcb board? It uses .1" spacing I think(same spacing as a breadboard), but the relay uses .2" spacing. Is there an adapter or should I bend the legs or what?
So the relay will use every other hole, what is the problem? .2" spacing works fine with holes that are spaced at .1" intervals.
Lefty
First, check the polarity of each pair of wires from the buttons. Next, check whether the 2 buttons have a common positive wire, or a common negative wire, or neither.
If they have a common negative wire, then I'd use a 2N7000 small signal mosfet to control each one, with the source terminals connected to the common negative wire. A small signal NPN transistor will also probably work (emitters to the common negative wire).
if they have a common positive wire, you can use small signal P-channel mosfets or PNP transistors (source or emitter terminals to the common positive wire).
If they don't have a common wire at all, then use opto isolators.
cmat1120:
I do know the polarity and I would prefer to indirectly control the buttons(something in between). That reed relay sounds like it might be good except it might be a little too big(unless theres some that are smaller than the 4 pin across ones).
One last thing: I need parts that will last a long time and be reliable. I would prefer non mechanical components if it would work.
Solid state relays exist but they're designed for switching mains electricity and are quite big.
That chip is like four little relays in a single package, the only catch is that they have a small resistance. Does your keyfob work if you connect the contacts via a 100ohm resistor?
When you were trying the opto-isolators, did you try measuring the voltage across the pins connected to your wires connected to the fob? If it was was being told to "connect" the wires, you should have seen the voltage between those two points go to zero.
I like opto-isolators because they are "simple".... and should work. Should. That word again.
I think ill give the optos one more go, I can't quite get why they don't work since they seem so simple to use. Also the keyfob works with a 1.5kohm resistor in between so the resistance of that analog switch seems fine. Maybe I'll use that since it should fit on my board better and then I can use the trunk button too.
Also thank you for all the responses. I have plenty of options to try now.