RetroPie Hall Effect Sensor... Possible?
-
Hello! I'm still very new to the world of RetroPie and all the things that it's capable of, but I'm currently inspired to create a totally stand alone travel RetroPie box (complete with wireless controllers (if I can get those working), a power supply (anker 13400 power bank, unless you guys have another suggestion?), and a 10" screen in the box lid (with speakers on either side... Gosh, a lot more of a project then I thought!).
The idea is that instead of an on/off switch for the system, I put a hall effect sensor and a magnet in the box lid and appropriate spot in the box bottom so when you open the lid, the system boots up. The issue is, after all the research I've done, I find similar goals for 3d printers and the like in mind, but nothing tired directly to the RetroPie.
So, down to the question... Is it possible? I see a lot of python coding for it, but they aren't running RetroPie, just Raspbian. I feel like it should be possible, but like I said, I'm very new and very ignorant, hence my asking. haha
-
@cjohnson26 Yes it's possible by ease. Just used the same way to switch on/off LCD display.
gpio_hall=24 hall_func() # commands are init, status und reset { case "${1,,}" in init) echo $gpio_hall > /sys/class/gpio/export echo in > /sys/class/gpio/gpio$gpio_hall/direction ;; status) hall=$(cat /sys/class/gpio/gpio$gpio_hall/value) ;; reset) echo $gpio_hall > /sys/class/gpio/unexport ;; *) echo "ERROR!" return 1 ;; esac }
-
Wow, I'm floored! haha Is this the code I put into the command line once the Pie is booted up? And that's it? (Other then of course having the actual hall sensor set up appropriately) And this will behave just like an on/off switch?
As it stands the RetroPie is a unplug and plugin way to start it. If I input this code now, without having the hall effect sensor up, will it still boot up without the sensor being in place?
-
@cjohnson26 the Pie will boot and the function of these few lines are just to ask status for a sensor after the has booted.
But for your idea to work as on off switch for booting up a device this also works but you do not need a code or something. Just connect the hall effect sensor like a switch on a power device like the Mausberry or a Pimoroni on off SHIM and it will act like a button press. For switching of you need to ask status then you can use that code.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.