Published © CC BY-NC-SA

The Internet Monster

We are going to build a cute monster that repeats whatever the internet says, what can possibly go wrong?

IntermediateFull instructions provided20 hours1,714

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Google Voice Kit (V1)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Flower Pot
×1
Fake Fur
×1
Wood/Cardboard
×1
Plastic ornament balls
×1
Felt furniture pads
×2
Spray paint (White)
×1
Glue
×1
Hinge
×1
Camera Module V2
Raspberry Pi Camera Module V2
×1

Software apps and online services

Remo.tv
Raspbian
Raspberry Pi Raspbian

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

Custom TTS handler

Python
import os
import mod_utils
# Example for adding custom code to the controller
speaker_num = None
module = None

import time
import threading
from random import randint

import aiy.voice.tts 

# Servo setup
from gpiozero import Servo
mouthServo = Servo(26)


def talk():
    global talk
    while True:
        while talk:
            sleepTime = (randint(0, 2))/10
            mouthServo.min()
            time.sleep(sleepTime)
            mouthServo.mid()
            time.sleep(sleepTime)
        
        mouthServo.detach()

moveLidThread = threading.Thread(target=talk)
moveLidThread.start()

def setup(robot_config):
    global speaker_num
    global module
    
    speaker_num = robot_config.getint('tts', 'speaker_num')
    # Your custom setup code goes here
    
 
    # Load the appropriate tts module and call the default tts setup routine
    module = mod_utils.import_module('tts', robot_config.get('tts', 'type'))
    module.setup(robot_config)
       
def say(*args):
    message = args[0]

    # Your custom tts interpreter code goes here

    
    global talk
    talk = True
    # This code calls the default command interpreter function for your hardware.
    if len(args) == 1:
        module.say(message)
    else:
        module.say(message, args[1])

    talk = False

    mouthServo.detach()

Credits

Comments