Using GPIO pins on my own object detection program

I want to make an alert for my custom object detection program. I am getting the class names with the following code after that how can I use GPIO pins to make a simple buzzer alarm? or how can I use green, red led with GPIO pins?

while display.IsStreaming():
img = camera.Capture()
detections = net.Detect(img)
for detection in detections:
class_Name = (detection.ClassID)
print(class_Name)
if class_Name==1:
print(“hi”)

Hi @alper-tmzl ,

You can use Jetson.GPIO library for controlling gpio pins. Here is an documentation about how to use gpio pins.

According to your design, software pin controlling will be same led or buzzer alarm procedure. Pay attention that the current of gpio pins because there is a current limitation for gpio pins. You should use transistor for avoiding hazardous situations.

There is a detailed video tutorial below. I think you will find answers of your questions in this video.

Regards.

1 Like

Is it okay to use a random MOSFET Transistor for hazardous situations or is the transistor must be the same as in the video?

Thanks a lot for the quick help!

It does not have to be the same transistor but you should pay attention the gain of the transistor which you are using. You can find the calculations of the transistors gain so it may change according to use case.

1 Like