I have bought a Xiaomi MiKey which enables me to trigger events with my mobile phone. It is a 3.5mm jack with a button, you can configure the button to do whatever you want with an app or you can write your own app to do it.

I'm also working on a project with a Raspberry Pi 3, currently I'm using a toggle switch to toggle between setup-mode and production-mode. I thought maybe I can use the Xiaomi MiKey to toggle between those modes.

I'm not really familiar with this kind of buttons and with 3.5mm ports so I hope you could tell me if this is possible or not and push me a bit more in the right direction. I've found this question that wants something that is a bit comparable to what I'm trying to achieve. Is the expansion board that splits the jack to gpio something like this or isn't that the way to go for me at all?

Thanks in advance


If you're willing to do some soldering (which is a single-wire job), then yes, you can use it with your Pi.

This video shows you how. Basically you wire the 3.5mm ground to pin 5 on the GPIO header, then run the script mentioned here (or write your own) to listen for the button press.

I think pin 5 also lets you start the Pi too, so it's a dual startup and shutdown button.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.