News How to Build A Person-Following Creepy Head for Halloween with a Raspberry Pi

Oct 4, 2021
1
1
10
Went to set this up and ran into problems with the code when building on the "bullseye" release. Is the code Python 2 or Python3?
 
  • Like
Reactions: andrsg
Oct 6, 2021
1
0
10
Code:
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
Looking in indexes: https://pypi.org/simple, [url=https://www.piwheels.org/simple]https://www.piwheels.org/simple[/url]
Collecting objectdaddy==0.0.4
  Using cached [url=https://www.piwheels.org/simple/objectdaddy/objectdaddy-0.0.4-py3-none-any.whl]https://www.piwheels.org/simple/objectdaddy/objectdaddy-0.0.4-py3-none-any.whl[/url] (32.9 MB)
Collecting rtsparty==0.0.1
  Using cached [url=https://www.piwheels.org/simple/rtsparty/rtsparty-0.0.1-py3-none-any.whl]https://www.piwheels.org/simple/rtsparty/rtsparty-0.0.1-py3-none-any.whl[/url] (4.0 kB)
Collecting RPi.GPIO==0.7.0
  Using cached [url=https://www.piwheels.org/simple/rpi-gpio/RPi.GPIO-0.7.0-cp35-cp35m-linux_armv7l.whl]https://www.piwheels.org/simple/rpi-gpio/RPi.GPIO-0.7.0-cp35-cp35m-linux_armv7l.whl[/url] (67 kB)
Collecting flask
  Using cached [url=https://www.piwheels.org/simple/flask/Flask-1.1.4-py2.py3-none-any.whl]https://www.piwheels.org/simple/flask/Flask-1.1.4-py2.py3-none-any.whl[/url] (94 kB)
Collecting requests
  Using cached [url=https://www.piwheels.org/simple/requests/requests-2.25.1-py2.py3-none-any.whl]https://www.piwheels.org/simple/requests/requests-2.25.1-py2.py3-none-any.whl[/url] (61 kB)
ERROR: Could not find a version that satisfies the requirement opencv-contrib-python==4.5.1.48 (from objectdaddy)
ERROR: No matching distribution found for opencv-contrib-python==4.5.1.48
Makefile:12: recipe for target 'install' failed
make: *** [install] Error 1

Getting error on step 3,
When running
cd ~/halloween_mannequin_head/ make install
Fix was to run fresh install of rasberrypi OS
 
Oct 9, 2021
3
0
10
So I got this working. I used a pi camera but want to switch to my logitech usb webcam in hopes of getting a wider view. I am completely new to this and don't know how to make that happen if it is possible at all. The goal would be to have a wider area that the head can track someone. Thanks for any help!
 
Oct 10, 2021
4
0
10
Thanks for the write up. I am having an issue that the make run gets hung on setting up servo.
I have tried a few diff servos marketed as rpi compatible, verified the 5v but still hangs there with no error or indication of issue. Any thoughts?
 
Oct 10, 2021
4
0
10
So I got this working. I used a pi camera but want to switch to my logitech usb webcam in hopes of getting a wider view. I am completely new to this and don't know how to make that happen if it is possible at all. The goal would be to have a wider area that the head can track someone. Thanks for any help!
did you run into any unknowns while setting up? I am also using the pi cam but the make run hangs on setting up servo.
 
Oct 10, 2021
4
0
10
Oct 9, 2021
3
0
10
did you run into any unknowns while setting up? I am also using the pi cam but the make run hangs on setting up servo.
I don't remember where it did not work the first few times I tried it, but going in and deleting the user name and address worked. I believe it was the part I struck through below. I know it says only edit if, but you have to remove that part I believe. Anyway, that is what I did.

# Only edit this if you’re using a RTSP camera; leave blank if you’re using a Pi camera
STREAM_URI=rtsp://username:password@camera_ip_address/live
 
Oct 9, 2021
3
0
10
I don't remember where it did not work the first few times I tried it, but going in and deleting the user name and address worked. I believe it was the part I struck through below. I know it says only edit if, but you have to remove that part I believe. Anyway, that is what I did.

# Only edit this if you’re using a RTSP camera; leave blank if you’re using a Pi camera
STREAM_URI=rtsp://username:password@camera_ip_address/live
I had to reinstall. And now I am getting stuck at the servo.
 

dakrath

Distinguished
May 23, 2012
3
0
18,510
I've set this up with a 3B+ and a Wyze cam. The servo moves, but it is pretty jerky, delayed, and also exhibits a weird stuttering behavior from time to time. It does not really track me correctly at all. Any idea what I could be doing wrong? My kid is crying over this not working :ROFLMAO:

By the way is there any way to make the servo run slower/smoother?
 
Last edited:
Oct 7, 2021
1
0
10
I've set this up with a 3B+ and a Wyze cam. The servo moves, but it is pretty jerky, delayed, and also exhibits a weird stuttering behavior from time to time. It does not really track me correctly at all. Any idea what I could be doing wrong? My kid is crying over this not working :ROFLMAO:

By the way is there any way to make the servo run slower/smoother?

I did the Wyze cam as well and used a Pi4. Exact same result. I don't think I've actually seen or heard of anyone who's actually gotten this working.
 
Oct 23, 2021
6
0
10
I'm also hanging at 'setting up servo'. Am powering the servo separately so only connection in pin 3 for the pwm.
..an ideas?
 
Oct 23, 2021
6
0
10
I tried changing the servo_controller to use gpiozero instead of pri.gpio but can't get it to run and get the error "ModuleNotFoundError: No module named 'gpiozero'". Guess I'll have to learn how python applications actually work!
 
Oct 23, 2021
6
0
10
So I got this working. I used a pi camera but want to switch to my logitech usb webcam in hopes of getting a wider view. I am completely new to this and don't know how to make that happen if it is possible at all. The goal would be to have a wider area that the head can track someone. Thanks for any help!
Any tips on how to get it working with the pi camera? Mine just hangs on setting up servo.
 
Oct 23, 2021
6
0
10
So I got this working. I used a pi camera but want to switch to my logitech usb webcam in hopes of getting a wider view. I am completely new to this and don't know how to make that happen if it is possible at all. The goal would be to have a wider area that the head can track someone. Thanks for any help!
Any tips on getting the pi camera to work? I can't get the rtsp stream to open. Not sure what the rstp uri is.
 
Nov 3, 2021
1
0
10
Any tips on how to get it working with the pi camera? Mine just hangs on setting up servo.
I don't think it's the servo. I edited the ~/halloween_mannequin_head/env/lib/python3.7/site-packages/objectdaddy/object_detector.py file and added to line 90:
Python:
print(end_time-start_time)

Since it's running the process_frame function, I'm assuming that it's trying to find the image. There seems to be an issue with the image detection, but I don't know enough python to figure out how to fix it.
The numbers are the number of seconds that it takes to process each image.
Code:
Starting Script
INFO:root:Starting application
INFO:root:Starting stream
INFO:root:Loading ML models
INFO:root:Setting up servo
1.2585079669952393
1.0548059940338135
1.0403172969818115
1.077369213104248
1.0986859798431396
1.0585334300994873
1.121502161026001
1.1280672550201416

That's about as far as I've gotten.