← Back to context

Comment by demondemidi

19 days ago

I don't think you understand how GPIO is used on a Raspbery Pi. You can flip GPIOs in a BASH script, or set events on them in Python. GPIOs are first-class citizens in Rpi land, which is what makes it so convenient: you get GPIOs + Linux, seamlessly.

I have a Pi4 hooked up to a motion detector, a camera, a solenoid and some SCRs for a floodlight. A python script waits for an event interrupt from the motion detector on a GPIO. Then it turns on the lights and opens a door via GPIO, and starts recording in another thread (via a pipe to gstreamer). When the motion times out, it pushes the video to an private S3 bucket (using my own handshake for a token so that it can't be spammed).

(I used to have some GPIOs connected to motorized cat toys so that I could trigger them remotely while watching an realtime stream, but that throttled the above camera which was more important.)

... It is also a BLE gateway that monitors 4 temperature sensors, and also pushes that data up to the cloud with another python script.

... and it also is an MQTT gateway for a few NXP WiFi devices scattered around the yard, and their data ... you guessed it... is pushed up to the cloud (they control sprinklers because BLE doesn't have the range). I can log into my personal website and turn sprinklers on from anywhere my phone works.

Sure I could do the WiFi and BLE with a PC, but why waste the energy and space when I can use a tiny Pi that is already doing a bunch of other things?

I just keep adding things to it because I have my own cloud system (HomeAssistant is a big fat bloated joke).

Having a good BLE sensitivity and WiFi chip on a tiny linux board that runs dozens of python processes listening to GPIOs, and running Gstreamer would be too much of a hassle with a PC and far beyond an arduino.

GPIOs are first-class citizens in Linux SOC land: every single ARM/RV SOC since before the Pi allows sysfs GPIO management using the exact same API.