I'd like to hack this..

Discussion in 'The Projects Forum' started by DR1, Dec 14, 2013.

  1. DR1

    Thread Starter New Member

    Sep 13, 2012
    23
    0
    I have a backup keyfob for my car I'd like to hack. I know the rules on car projects so I'll keep this about electronics. I took out the circuit board for the fob and I'd like to add an Attiny85 for control. The key fob has 4 buttons, I'll just be working with 2. Here's a pic of the board. After connecting both grounds, would I just have to solder leads to the + of each button going to a pin on the attiny? Then, by sending that pin high, it would mimic the button being pressed. Am I going about this the right way?
     
    Last edited: Dec 14, 2013
  2. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I'm not sure if this will be closed down by the moderators as an "automotive modification". Technically it seems to be an external accessory, not part of the car but that's just my personal opinion.

    Regarding your question, all 4 contact sets have one side connected to the ground plane, so it is not using matrixed keys, just simple "connect to ground when pressed" type keys.

    That is common in these type devices as the keys connect directly to the micro's pins, and use the microcontroller's internal pullup resistors on the pins.

    So assuming that is true you can easily connect the 4 keys to 4 output pins on your ATtiny, but both circuits need to have the grounds connected too.

    I would use 4 resistors to connect them, a value of 270 ohms should be fine and give some protection against shorts etc.
     
  3. DR1

    Thread Starter New Member

    Sep 13, 2012
    23
    0
    Hello RB, thanks for the reply. Seems like this shouldnt be too hard of a project. One part Im stuck on, Im using a dev board which uses 5V logic. Would I need something to first drop to 3V, then add a 270 ohm resistor?
     
  4. alexfreed

    Member

    Oct 8, 2012
    72
    10
    No. You can configure the uC pins to be outputs set to 0 when active and high-Z when not, essentially emulating open collector. Or use actual open collector/drain buffers to make the program simpler.
     
  5. GopherT

    AAC Fanatic!

    Nov 23, 2012
    5,984
    3,722
    You can also use an analog switch IC (CD4066, or 74HC4066), the switch will simply connect any two pins when a third pin is driven high, disconnect when the third pin is low. A single IC will have 4 switches on it.
     
  6. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    There are a couple of other methods, you can use a two resistor voltage divider on each 5v output pin. Since you already plan to use a 270 ohm series resistor to connect to the keypads, just put a 470 ohm resistor from each keypad to ground. That will give you about 3.2v as your HI level.

    Another way is to use a series diode on each pin, this will act something like the open-drain (open-collector) output that Alexfreed mentioned.
     
  7. Austin Clark

    Member

    Dec 28, 2011
    409
    44
    Uhm, why not just use a simple NPN transistor to pull down the pad to ground when the microcontroller pin goes HIGH? It would literally require a single resistor and transistor, both very tiny and cheap.
     
  8. BobTPH

    Active Member

    Jun 5, 2013
    782
    114
    Why? The microcontroller can just as well pull it low itself, as suggested previously with no additional components.

    Bob
     
  9. Austin Clark

    Member

    Dec 28, 2011
    409
    44
    Good point, that's much better, if the micro must be cable of such a configuration and sinking enough current, which it more than likely is.
    You could use the pins signals in multiple places if you used a transistor though I suppose. That idea slipped my mind after having read it, I was mainly responding to the later suggestions that seemed needlessly complex to me.
     
  10. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    It's a good suggestion for some apps, it definitely gives the open-collector (switched pulldown) capability.

    If you used NFETs instead of NPN transistors, you don't even need the base resistor as the FET gate can be driven driect from the micro's output pin.
     
    Austin Clark likes this.
  11. DR1

    Thread Starter New Member

    Sep 13, 2012
    23
    0
    So Im stuck. Im having a problem with the connection. Im using an Arduino Uno for this project atm. I made the voltage divider and its putting out 3.15V. I used the 5v pin on the Arduino and tested with a multimeter. Works. But when I replace that 5V wire with the I/O pin Im using and send that pin HIGH, it only shows .05V rather than the 3.15V. Im confused.
     
  12. GopherT

    AAC Fanatic!

    Nov 23, 2012
    5,984
    3,722
    Is the power supply common (-) of the micro connected to the common (-) of the key fob?
     
  13. Kermit2

    AAC Fanatic!

    Feb 5, 2010
    3,768
    928
    If one side of the switch is ground, then most likely it operates on a NEGATIVE going pulse edge. Holding the key down would GROUND that signal line. The micro should be programmed to send a 0 volt output pulse.
     
  14. DR1

    Thread Starter New Member

    Sep 13, 2012
    23
    0
    I took the fob out of the circuit for now, til I get this problem fixed. I get 5v out of the 5V pin and 4.8V out the I/O when pulled HIGH. The 5V pin though can supply max 500mA. The I/O pins have a max of 40mA. Like I stated, the voltage divider works fine with the 5v pin, so has to be difference in current. Not sure how exactly to go about fixing it.

    I have a couple N Channel mosfets, would I be able to attach the I/O pin to the gate then use the 3.3v on the Drain. Ground to Source?
     
  15. GopherT

    AAC Fanatic!

    Nov 23, 2012
    5,984
    3,722
    I think it is time to post a schematic, I'm lost.
     
  16. KMoffett

    AAC Fanatic!

    Dec 19, 2007
    2,574
    230
    Used CD4066 analog switches many years ago to start and stop several stopwatches. Just wire them in parallel with the stopwatches' switch contacts.

    Ken
     
Loading...