Audio Amplifier and Envelope Follower for Animatronics

10K6311

Intro: Audio Amplifier and Envelope Follower for Animatronics

I had a specific requirement to synchronize an RC servo to an audio sound track. In my case, it was to synchronize the mouth movements of an animatronic figure (Peter Penguin) to whatever he is saying. His speech would be recorded on an audio track; a stereo .WAV file.

These figures would be used to create an animated scripted display for a holiday walk through attraction.

This instructable concentrates on the design and construction of the circuit. It does not go in to detail of the supporting hardware and software used to produce the final effect. It does cover these topics with a broad brush.

I call the circuit an AAEF – an Audio Amplifier and Envelope Follower Circuit.

STEP 1: Parts

  • custom PCB from ExpressPCB
    LT1013 Linear Technology Op Amp
    LM386 Audio Amplifier
    2 - 100nF ceramic capacitors
    capacitor, 33uF, 6.3V
    1N5817 diode
    3 - resistor, 100K, 5%, 0.125W
    resistor, 43K, 5%, 0.125W
    resistor, 50K, 5%, 0.125W
    resistor, 1M, 5%, 0.125W
  • 100K Bourne trimpot, audio taper
  • 200K Bourne trimpot, linear taper
    1/8” stereo audio jack
    Breakaway 0.1” header pins

STEP 2: Circuit Discussion

There are two independent portions of the circuit. The first is a simple audio amplifier using an LM386 IC, which will amplify one half of the stereo signal. The second half is used as the input to the remainder of the circuit, to synchronize the mouth movements.

The schematic of the device is shown in the picture.

To clarify – one stereo channel (irrelevant whether it is the left or right, so long as the convention is consistent). This is dependent on the wiring of the stereo 1/8” jack. The second channel contains raw audio to be played through the amplifier.

There is some lag in processing the signal to move the mouth, so an editing program such as Audacity can be used to manually shift the signal so it more closely matches up with the audio. I found a delay of 0.3 seconds on the second channel produced good results. Also, if there is some detail in the original audio that the processed signal does not pick up, Audacity can be used to insert a tone with the appropriate amplitude into the control signal.

The use of an LM386 is not critical. If better sound quality is desired, another amplifier can be used. This entire circuit could be left off from the AAEF and an external amplifier used.

Note that the Schottky 1N5817 diode may not be necessary

STEP 3: Amplifier Circuit

There is nothing special here. It basically is a simple amplifier taken from the datasheets

STEP 4: Audio Envelope Follower Circuit

This portion of the circuit starts with audio input corresponding to the spoken output. It is then scaled up to almost the supply voltage (less the limitation of the op amp). This is then sent through an RC network to smooth out the signal to DC. Refer to the picture to see how the transformation appears.

At this point, the circuit has accomplished its function. The output is then fed into an ADC on the microcontroller operating the animatronic, which reads the value and changes the parameters for the RC control to move the mouth to the desired position.

STEP 5: Circuit Construction

The PCB diagram attached is of the boards I designed using ExpressSCH and ExpressPCB and had made for construction.

The positioning of the largest component, the audio jack, determined the placement of the remaining subsystems/components. The LM386 and its associated components fit right above the jack. Its large output capacitor then was positioned to the right of it.

This left the lower right of the board for the envelope follower circuitry. Note that some real estate has to be given for circuitry to stabilize the unused op amp in the design. This is the purpose of the two 100K resistors on the lower right corner of the board.

In the space above the op amp and aforementioned resistors, C4 and R4 form the RC network to smooth out the audio signal envelope.

There is nothing particularly difficult about the assembly, other than careful soldering technique. Some of the pads are close together, and care must be taken not to use too much solder nor heat, lest solder bridges/ short circuits arise. Or in the case of too much heat, pads may lift from the pcb. The board and component leads must be very clean. Also, I used IC sockets for the two ICs, to minimize the possibility of heat damage during soldering to the ICs. Also, if an IC needs replacement, it is a much simpler proposition.

STEP 6: Summary


This circuit or derivative can be used for other purposes as well. It is a variant of the ideas used by Scary Terry in his animatronic circuit – except his is an on/off circuit. This circuit allows access to intermediate values, providing (IMHO) more realistic mouth movements. But instead of mouth movements, this could process ANY audio input and map it to a series of defined states. It could be used with a control track consisting solely of tones, to program any set of possible actions.

The embedded video demonstrates the AAEF in action. A link is also provided to the video, Animatronic Penguin Talks

9 Comments

Great project! My current project is not robotic but requires an envelope follower so I decided to build that portion of your circuit. However, there are several obstacles in doing that. First, the two schematics for the EF are not the same. The values of C3 & R3 in 1st schematic are different from C4 & R4 in 2nd one. Also R2 is different. But it gets worse. The 1st schematic shows R3 as 50K 5%. No one makes a 50K 5% resistor.
Is there any possibility you could post the correct values for these components? (I'm sure it would benefit others as well). Thank you very much.
Definitely use a trim pot. 100K linear taper. This pot adjusts the gain of the op amp And is necessary to set because the audio output of your device will vary amongst sources. You want the output of the op amp to be near the top rail without clipping when driven by a loud sound.

Note that I didn’t have a pot model for LTSpice when I tested this, so the schematics show fixed resistors. The two resistors in the upper left of the schematic, on the input to the LM386, is also a trim pot. It sets the volume of the amplified audio track. It is a 200K AUDIO TAPER trim potentiometer.
Thank you sooo much. I used a 51K resistor for the output and a 200K trimpot and figured out that it controls the op amp gain. Since my audio levels are low to medium, I adjusted the gain to amplify them and the circuit works great!
Thank you again for your help, I appreciate it.
I added s comment. The resistor should be ~50K, use either a 47K or 51K. The 33uF is the correct capacitor value.

Sorry for the confusion. As I mentioned in the comments, I inadvertently mixed up an earlier development schematic.
Thank you very much. That's what I figured but wanted to be sure. Just one last thing, for the resistors at the op amp output - should I use a 200K trimpot as in the parts list, or fixed resistors? If fixed, then 43K and 100K? (I suppose either will work, but I'd rather use fixed if you can confirm the values.) Thanks again, your project inspired me to get moving on mine.
Someone pointed out differences in this schematic and the one posted in Step 1,

The earlier schematic, with the parts list, is correct. This values presented here were used while developing the circuit and that development circuit’s schematic was used in this step incorrectly.

Sorry for the confusion!
Incredible work! I have a group of high school students that are going to try to construct your project. Thank you for the inspiration.