HowTo use Raspberry Pi & OpenCV to track objects & turn servo

Поделиться
HTML-код
  • Опубликовано: 27 авг 2024
  • How I made my Halloween skeleton head turn to watch people as they walk by using a Raspberry Pi Zero, servo, camera, and OpenCV python library.
    Parts:
    Pi Zero W (with wireless): www.adafruit.c...
    PWM Servo bonnet: www.adafruit.c...
    Servo: www.adafruit.c...
    USB to Barrel Jack cable: www.adafruit.c...
    Pi NoIR Camera (camera without an IR filter that's better at night): www.adafruit.c...
    camera cable that fits Pi Zero: www.adafruit.c...
    USB Hub: www.adafruit.c...
    mini HDMI to regular HDMI adapter: www.adafruit.c...
    BYOS (bring your own skeleton)
    Guides I followed:
    circuitdigest....
    learn.adafruit...
    singleboardbyt...
    www.instructab...
    pysource.com/2...
    running python programs at startup: www.dexterindu...
    (note you have to turn off the camera view in the code!)
    Sourcecode:
    github.com/cur...

Комментарии • 30

  • @kevinhoward9425
    @kevinhoward9425 2 года назад +2

    It is really neat to see your full process, Scott! I have a raspberry pi in the basement that has been waiting for me, and you are inspiring me to pull it out!

    • @CuriousInventor
      @CuriousInventor  2 года назад +1

      Ha! it's amazing how easy it was to get a servo working on it... just minutes. I need suggestions on an xmas project now... santa watching you?

    • @monkeyrave
      @monkeyrave 2 года назад

      @@CuriousInventor Love your stuff!! I would suggest attaching a nerf gun with drum and using another servo motor to engage the firing mechanism as well. I would like to take your idea and make something like this to ward off birds that are always pooping in my swimming pool.

  • @samuraitatin
    @samuraitatin Год назад +1

    I just subbed to your channel, it seams that you haven't been here in quite some time. But I find it very entertaining and informative.
    Thank you for that!

  • @tad2021
    @tad2021 2 года назад +1

    Congrarts on getting featured on Hackaday

  • @frollard
    @frollard 2 года назад +2

    that's pretty fun. I've wanted to do ...this...forever. Strikes me that it wants to have the camera/pi in the head, and then 'always try to center the view on the object of desire' - but that can be problematic for motion.

    • @CuriousInventor
      @CuriousInventor  2 года назад

      I think the openCV function looks for things that move relative to a background, so I'm not sure it would work if the entire frame was changing. Moving the camera kind of breaks it, but putting in the head is what I thought I would do initially.

  • @ConsultingjoeOnline
    @ConsultingjoeOnline 2 года назад +2

    Awesome project

  • @JohnSmithZen
    @JohnSmithZen Год назад

    Hey CuriousInventor. Just wanted to say hi. Always loved your videos. Informative AND funny!
    I hope you're doing well.

  • @gelatinskeleton8745
    @gelatinskeleton8745 2 года назад +1

    I REALLY appreciate this video....

  • @billywatson5149
    @billywatson5149 4 месяца назад

    Great video! I am using this code as inspiration for a color tracking project for school. I had a quick question about the remap function and how it works. I am currently having trouble utilizing the full frame to get an angle. It seems that it only registering an angle for a quarter of the frame.

  • @woolfy02
    @woolfy02 Год назад

    I wonder if it's possible to make it track an object fast? I've been trying to find a guide but, no luck yet.

  • @dogsnmore
    @dogsnmore 2 года назад

    Which RPi OS are you running? Which OpenCV release did you get installed? I've been trying to get OpenCV loaded onto a RPi Zero W for 2 months now and I've have no luck. Could you post an image of your SD to Github? Any help or direction would be greatly appreciated.

  • @trauatsgg3809
    @trauatsgg3809 2 года назад +1

    very good project! I tried installing open cv on my RPi4 and did not have good luck I followed all the links. the issue is that when I got down to the 'make -j4' it failed each time stating 'No targets specified and no makefile found.'

    • @CuriousInventor
      @CuriousInventor  2 года назад +1

      Fyi, i never did any “make” to build from source, i just installed using aptget… you dont have to build from source at least for my application. I had to completely wipe my pi at one point and start over :(

    • @trauatsgg3809
      @trauatsgg3809 2 года назад +1

      @@CuriousInventor Thanks for the response. I tried that way also. When I got to the step 'import cv2' I got an error. I wiped the Pi for the 3rd time. I tried a Pi3 and now Pi4. I wiped again now and giving it another try.

    • @CuriousInventor
      @CuriousInventor  2 года назад +1

      Make sure youre doing pip3 also, i think things can get installed where only python2 can see them as opposed to python3

    • @trauatsgg3809
      @trauatsgg3809 2 года назад

      @@CuriousInventor Intreresting. Ok I will try that again. last time I had the issue of importing cv2. Importing numpy was not a problem. I'm giving it another try. Thanks

    • @trauatsgg3809
      @trauatsgg3809 2 года назад

      same problem. when I go to import cv2, it fails

  • @mohitrahaman
    @mohitrahaman Год назад

    what processor and code does the dog tracking use?

  • @ikust007
    @ikust007 Год назад +1

    Where are you mate !?

  • @katygrete3463
    @katygrete3463 2 года назад

    Hey, very good project.I have rebuilt your project and it works fine. Only I noticed that the servos do not turn off. Can you include a routine in which the servos turn off when, for example, no movement is detected? Many greetings !

    • @CuriousInventor
      @CuriousInventor  2 года назад

      I think you'd need to use a mosfet to cut power to it, but that may have unintended consequences: forum.allaboutcircuits.com/threads/turning-off-servo-power-while-not-in-use.158019/

    • @katygrete3463
      @katygrete3463 2 года назад

      @@CuriousInventor Hello,
      thanks for the answer but I meant if you can also solve this in software / program?

    • @CuriousInventor
      @CuriousInventor  2 года назад

      I dont believe so, unless a special servo is used.

    • @Omkar_Srivastava
      @Omkar_Srivastava 8 месяцев назад

      Buddy which raspberry pi you used 3 or 4 1gb or 8gb

  • @deepakrajora8599
    @deepakrajora8599 2 года назад

    please help me as i show your videos you have great knowledge of things