How to simulate the depression of a push button connected to an Arduino, with another Arduino

arduinoswitches

I have an Arduino which uses several push buttons to simulate the keypad of a digital door lock. This microcontroller remembers the last four depressed buttons and turns a LED to green if the code is correct.

Now I would like to crack this lock with another Arduino which would send the De_Bruijn_sequence on the keypad to brute force it open. (See 'Uses' paragraph on this page)

Which component do it need to simulate a depression of a push button on the first circuit ? How fast can it be done ?

Best Answer

The answer to this question depends a lot on the specific circuit that is used to implement the push buttons. Typically push buttons are connected from the MCU input to GND. There is then often a pullup resistor from the MCU input to the VDD of the MCU. If this simple case exists in your situation and the pullup resistor has a value above say 1K ohms then you can safely just connect output pins of the second MCU directly to the MCU inputs of the first board. Remember to also interconnect the GNDs of both boards together.

With the direct connections you need to make sure that you never program the pin directions of both boards to be OUT at the same time or else damage to one or both MCUs could result. Another caution is that if you connect the second MCU whilst the push buttons are still attached then make sure that the switches are normally open type and that you do not push them while the second MCU is connected. It may be best to just temporarily disconnect the push buttons while the second MCU is connected.

Since the first MCU has to deal with real push button switch detection it has to implement switch debounce. The software of this first MCU may also be designed to detect just one switch press at a time. Thus the speed at which the second MCU can be programmed to simulate button presses will have to take the design constraints of the first system into account. You may simply be stuck with having the second MCU able to only operate slightly faster than a human can press the buttons manually.