The envelope detector circuit will be used to detect the amplitude of the signal coming from the amplifier. The output will be fed into an analog input on the micro-controller. Here is the initial schematic that I’ll be using for this portion of the design:
The first two elements (C15 and R14) form a high-pass filter (Fc = 339 Hz) and also bias the op-amp to ground. U3D drives D6 and C16 which form a simple peak detector. The output of this peak detector is low-pass filtered by R18 and C17 to smooth the output. U3C provides adjustable amplification if needed, and buffers the output. R21 and C18 will provide a final low-pass filter to reduce any noise in the signal before it enters the microcontroller.
Now would be a good time to tell you about a little trick I’m holding up my sleeve. Often overlooked, the built-in analog comparator in many micro-controllers will be very useful in this design. I plan on using it to perform the entire function of the zero-cross detector, by way of feeding the output from the amplifier directly into a analog input to the micro-controller. I also plan on using this built-in comparator to perform the threshold detection of the envelope input which will be fed into a separate analog input. The microcontroller has a built-in multiplexer that can select the appropriate signal quickly, and perform the comparison. This comparison can also trigger an interrupt for precise time measurement. This will eliminate the need for external parts, thereby reducing cost and size, and should give the processor even more control and flexibility.
I’ve sent the PCBs off for manufacturing and next time we’ll look at results of these initial designs and see how they work.