Using one microcontroller to “press” another’s buttons

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
cmcbrady
 
Posts: 12
Joined: Wed Dec 12, 2018 11:58 pm

Using one microcontroller to “press” another’s buttons

Post by cmcbrady »

The short version of my question is what do I need to do to have one microcontroller act like a button input on a second microcontroller, is it just a matter of code and a jumper wire or is another electronics component also required?

The longer version is that I have a project to programmatically interact with a Nintendo switch. Trying to do this more directly with one board has not been fruitful so far but I think I could be really close by combining a second microcontroller with a pico board loaded with firmware from gp2040.info so it acts as a USB game pad using pins as button inputs. The gp2040 firmware works quite well and I’ve tested with some buttons on a breadboard successfully. Where I am getting stuck is how to use an output pin on an second board to act like the button (pull to ground when “pressed”). I am naively connecting the boards directly with just a jumper wire and in code setting the pin high/low for unpressed/pressed, no smoke and it works very unreliably. My draft is two pico boards so if it all zaps itself I’m not out so much but the goal is to control the gp2040 pico with a raspberry pi to add Computer Vision to the program logic that “presses the buttons” on the game controller.

Hopefully the description makes enough sense, my electronics skills are not terribly strong so I feel I am missing something on the connection between them. I do know enough that the two boards have a common ground and that sending high out from one board and into another like this is probably not completely wise.

Thanks!

User avatar
adafruit_support_bill
 
Posts: 88041
Joined: Sat Feb 07, 2009 10:11 am

Re: Using one microcontroller to “press” another’s buttons

Post by adafruit_support_bill »

am naively connecting the boards directly with just a jumper wire and in code setting the pin high/low for unpressed/pressed, no smoke and it works very unreliably.
Do you also have a direct ground wire connection between the boards?

User avatar
cmcbrady
 
Posts: 12
Joined: Wed Dec 12, 2018 11:58 pm

Re: Using one microcontroller to “press” another’s buttons

Post by cmcbrady »

Yes, both boards are connected to a common ground.

Thanks!

User avatar
adafruit_support_bill
 
Posts: 88041
Joined: Sat Feb 07, 2009 10:11 am

Re: Using one microcontroller to “press” another’s buttons

Post by adafruit_support_bill »

That should work as long as both processors use the same logic level. The 3040 and the Pi are all 3.3v, so that should be fine. If you post your code and some photos of your setup we can try to spot any problems.

User avatar
cmcbrady
 
Posts: 12
Joined: Wed Dec 12, 2018 11:58 pm

Re: Using one microcontroller to “press” another’s buttons

Post by cmcbrady »

Thank you very much for the sanity check, I had some serious tunnel vision going on with this project.

I started from scratch building up a simpler test script and am now successfully mashing buttons on my Switch with a circuitpython script using both a pico and a raspberry pi 4!

Thanks!!

User avatar
adafruit_support_bill
 
Posts: 88041
Joined: Sat Feb 07, 2009 10:11 am

Re: Using one microcontroller to “press” another’s buttons

Post by adafruit_support_bill »

Good to hear that is all working. Thanks for the follow up.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”