Arduino “having11” Guy
Published © GPL3+

Frosty the SPyman

Frosty the SPyman's a snowman on a shelf that livestreams video and moves on his own! Santa can now be 100% sure that people are being nice.

IntermediateFull instructions provided2 hours194
Frosty the SPyman

Things used in this project

Hardware components

DFRobot Raspberry Pi 3
×1
DFRobot Raspberry Pi Camera Module
×1
Servos (Tower Pro MG996R)
×1
Adafruit PCA 9685
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Thonny IDE
MJPG Streamer

Hand tools and fabrication machines

Screwdriver

Story

Read more

Schematics

Schematic

Schematic img xctnlirw5e

Code

Python Code

Python
from __future__ import division
import time
import subprocess
import shlex

import Adafruit_PCA9685

pwm = Adafruit_PCA9685.PCA9685()

servo_min = 150
servo_max = 550

p=subprocess.Popen(shlex.split('./mjpg_streamer -o "output_http.so -w ./www" -i "input_raspicam.so"'))

def set_servo(channel, pulse):
    pulse_length = 1000000
    pulse_length //= 60
    pulse_length //= 4096
    pulse *= 1000
    pulse //= pulse_length
    pwm.set_pwm(channel, 0, pulse)
    
pwm.set_pwm_freq(60)

try:
    while True:
        pwm.set_pwm(0,0,servo_min)
        time.sleep(30)
	      pwm.set_pwm(0,0,350)
	      time.sleep(30)
        pwm.set_pwm(0,0,servo_max)
        time.sleep(30)
except KeyboardInterrupt:
    p.terminate()

Credits

Arduino “having11” Guy

Arduino “having11” Guy

33 projects • 224 followers
IoT, Arduino, and Raspberry Pi. I can create designs, code, and build projects for only $22/hr. Just message me with your project request.

Comments