GPIO input/button to clear current detections & GPIO output to LED

Jetson Xavier
Deepstream 4
Jetpack 4.3

I’f like to add some GPIO features to my deepstream_app.c

  1. How would I add a GPIO input (gpio256) which I make high (1.8v) and get that to cancel the detection what are currently on the screen?

Basically a reset button

  1. When a certain detection occurs “person” i would like a different GPIO (gpio422) to go high so that it lights an LED

Ideally i’d like the Xavier to also play an audio file (of any type) at the same time as lighting the LED

thanks chris

You can read/write the gpio sys node - /sys/class/gpio/ in your application


  1. create the gpio node
    for exmaple,
    echo 345 >/sys/class/gpio/export
    echo in >/sys/class/gpio/gpio345/direction
    export the gpio from kernel space with gpio direction
  2. read the gpio value
    cat /sys/class/gpio/gpio345/value

thanks, and this would allow realtime communication with deepstream whilst it is running?

every time “person” is detected the GPIO will trigger?

GPIO R/W is very realtime/quick, but the latency from person detection to GPIO write depends on your implementation,

Thank, I just meant that it will work whilst deepstream is running rather than having to close the app.

Is there a command which will “clear/cancel all current detections”?

Or is there a keyboard hot key which will do this?

I know Q will close the app, are there other hotkeys?

Thanks Chris

don’t understand your question. it’s just a few code lines in deepstream code…

clear/cancel all current detections
what does this mean? exit program?

I’m trying to make an alarm, when an object has detected without moving for 30 seconds an alarm will sound.

I’m trying to plan for a situation when something is falsely detected (for example a motorbike is wrongly detected as a bicycle). In this situation I would like to cancel/reset the app without closing and restarting it.

I will also try to record this so that I can see when things are wrongly detected. I’m aware the detection will immediately start again but this will restart the 30 second counter

Hopefully that makes more sense?

Thanks Chris

PS. is there a list of which keys have functions in deepstream, for example q for quit?

thank you for all your help with this, making progress

the gpio does now trigger (although I need to tweak it still) thanks :)


do you know how I can get a sound file wav or mp3 (or other if better) to play when a detection has been made?

was thinking of using Canberra-gtk-play or sound-play

many thanks chris

there is gstreamer plugins to play mp3.

great! thanks

I can’t find anything in the deepstream plugin guide.

Can you give me some names? or a link to compatible plugins?

thank you again

Search MP3

fantastic thanks!