Haunt Forum banner
1 - 20 of 21 Posts

·
Registered
Joined
·
28 Posts
Discussion Starter · #1 · (Edited)
Raspberry Pi audio servo controller

I've just started working on writing software to use a Raspberry Pi an an audio servo controller to control the jaw of a skull (filling the role otherwise filled by a Scary Terry type board, or Jawduino or Wee Little Talker). The code will be released as free open source once I've got the initial version working, but I'm curious whether or not others are interested and might use it if available.
 

·
Registered
Joined
·
28 Posts
Discussion Starter · #6 ·
I'm definitely interested. I have a few pi zeros and zero w's waiting for something to do.
I should have something posted within 1-4 weeks. It's actually coming along more quickly than I expected, but I'm awaiting some parts for more testing of the code. A Pi with WiFi, like the Zero W, will probably be easier to work with (in headless mode), since you'll want to edit some setup files. I'm using a Pi 3A for development, but I plan to test it on a Pi Zero W as well.
 

·
Registered
Joined
·
3 Posts
I would definitely be interested but why stop with a single servo controller? Anybody ambitious enough to write code to drive a three axis skull (four servos - Up/down, side/side, left/right, jaw) and coordinate it with a soundtrack? Now that would be cool!
 

·
Registered
Joined
·
28 Posts
Discussion Starter · #9 ·
That would be cool. What I'll be doing is a bit simpler. I'll use the Raspberry Pi as the audio servo controller for the jaw, but it will include a TRIGGER_OUT pin that then can be used to start running a canned routine on a specialized servo controller for the other servos in the skull. I use a Maestro servocontroller from Pololu for that. They already have a nice piece of software for writing the servo routines and saving it on the controller for stand-alone operation.
 

·
Registered
Joined
·
3 Posts
Good info, ViennaMike, thanks! I don't have time these days for much programming but do you know if the RPi has enough output pins to control four servos?
 

·
Registered
Joined
·
28 Posts
Discussion Starter · #11 ·
Good info, ViennaMike, thanks! I don't have time these days for much programming but do you know if the RPi has enough output pins to control four servos?
It does have enough output pins. It's limited to two hardware PWM timers, though (only one on older boards). So you need a GPIO library that supports DMA PWM (which is good enough for servo control, whereas software PWM is not. There's a c library that supports up to 8 servos (https://github.com/richardghirst/PiBits/tree/master/ServoBlaster), so it's definitely possible. In python, you'd want a GPIO library that supports DMA PWM.

The nice thing about an external servo controller like the Maestro is that it already has a scripting language for writing complex control scripts for the sets of servos (sending movement commands is the EASY part :) ). For what you had suggested in your previous note, you'd probably want to create a simple language like that to make the coding easier and more flexible.
 

·
Registered
Joined
·
3 Posts
I see what you mean about the Maestro. For $20 or so, I'm sure it's worth the investment to save a bunch of programming pain. Which version of Maestro do you use? It looks like the Micro-Maestro 6 would be enough to control a three axis skull. How difficult is it to coordinate the servo operation with a soundtrack? I currently use VSA to drive my three axis skull but am getting tired of having to run cables from a laptop to drive the prop. I would much rather go with something like a Boobox but they're relatively expensive... an RPi and Micro-Maestro looks like a good alternative solution.
 

·
Registered
Joined
·
28 Posts
Discussion Starter · #13 ·
I've used the 6 channel micro for a 3-axis skull. That one has somewhat less memory than the larger ones, but so far I haven't found that to be an issue.
I've programmed it two ways.

When I built Yorick (a skull connected to a Raspberry Pi serving as an Alexa device) I used Vixen (version 2, not the completely different version 3) to program the controller, as there is a servo controller plugin for Vixen 2. There's even a 3D skull add-on someone made to help visualize things. It was quite a pain, to be honest, but I really liked the results (you can google "alexa" and "yorick" to see video).

For simpler things, I just opened my sound file with Audacity to view the timing, and hand-coded the movements using the Maestro's built in scripting language. It takes a little getting used to how to code in it, but it's not bad, and worked fine.
 

·
Registered
Joined
·
28 Posts
Discussion Starter · #14 ·
While I love this stuff, why use a pi to make a Jawduino? Arduino is cheaper. Will the raspberry pi allow it to do more?
Bottom line, yes. Although folks have added to the Jawduino, the basic Jawduino takes audio from an outside source and controls a servo. End of story. This Pi implementation can be on all the time, but can also trigger off of either an outside sensor like a PIR, can light up LED eyes and trigger another prop or device, can either use an outside audio source or store the audio on the Pi (no external shields required), play multiple files in order, and also offers the option of filtering out high and low frequencies before determining the jaw setting, as the Wee Little Talker does.

I'm developing it on a Pi 3A+, but I'm pretty sure it will run on a Pi Zero and plan to test that, so it's pretty cheap. You do also need a USB sound card, but I picked up one that's working well for $5 from Adafruit.
 

·
Registered
Joined
·
28 Posts
Discussion Starter · #15 ·
I use raspberry pi's for all kinds of props. Here's a link to my talking skull implementation if you want it:

https://github.com/crpalmer/pi_lib/blob/master/talking-skull.c

I use this for playing random audio tracks and I also use it with a microphone (which let's people make a prop talk).

I also create an Android app which let's you remotely control the audio. Very nice platform for prop control.
Thanks! I'm pretty much a novice at C, but from what I could follow, a lot of good stuff there (and in your library in general).
 

·
Registered
Joined
·
28 Posts
Discussion Starter · #16 · (Edited)
ChatterPi initial version is up and running!

Good news, the initial version of my Raspberry Pi audio servo controller software, which I've named ChatterPi, is complete. You can see a video demo:
(the jaw is controlled by ChatterPi, the other movements with a Maestro servo controller). There's a full write up, with links to the code and a complete Users' Manual on my blog: https://www.mcgurrin.info/robots/690/
UPDATE: 7/13/2020: this note orginally stated that it would not run on a Pi Zero. I found the section of code that was taking to long and rewrote it. It now runs fine on a Pi Zero, saving a few bucks in implementation!
 

·
Registered
Joined
·
28 Posts
Discussion Starter · #18 ·
Sweet Work! And thanks for the mention of my site in your Blog. I will have to give this a try, Now where did I put that Pi...
:biggrinkin: You're welcome. I definitely freely used concepts and features from the Scary Terry boards, your Jawduino, as well as the Wee Little Talker.
 
1 - 20 of 21 Posts
Top