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
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