When I left Part I of this blog, about the building of a small portable Crystal Tester and Frequency Counter :
I had just latched up the input RA4 of the PIC 16F628 microprocessor. This was caused, as usual, by ignorance on my part. A more thorough understanding of the PIC revealed that its inputs would not tolerate voltages below Vss.
This circuit, originally designed by Wolf Buescher, ( http://www.qsl.net/dl4yhf/freq_counter/freq_counter.html ) had been appropriated by Chinese Marketers and modified to add a crystal tester. Poor documentation and design in the modification had left the input weak and susceptible to damage. I went to Wolf's site and found a recommended preamplifier that could be added to the unit. While I waited for a replacement pre-programmed PIC to arrive I busied myself testing and modifying the pre-amp circuit. Here is the circuit that I eventually settled on:
One of my early concerns was how to regulate the gain as I wanted to have a fairly large input range of 500mV to 10 V peak to peak. Thanks to the usual sage advice from D_Hersey I was told not to worry about the waveform as the edges were all that matter in this application. Let the clipping begin. Another concern that I had was how to integrate the output of the Crystal Oscillator. The Crystal oscillator was obviously a poorly engineered "add on" as its output was also feeding a signal below Vss to the RA4 input of the PIC. Only the action of a small internal diode in the PIC was protecting the input from damage. Some bench prototypes of the Pre-amp were constructed and eventually I decided that the Crystal oscillator should be fed to the input of the pre-amp and the only connection to the PIC RA4 input would be the output of the pre-amp.
Here is a before and after block diagram of the signal flow:
Testing the prototype of the circuit showed that the pre-amp delivered a usable approximate 4 volt PP output shifted above the Vss level when the Oscillator was used and would also deliver a measurable signal to the RA4 input with an external signal with a voltage of 500 mV PP or more. External Signal voltage was tested to 20 volts PP and while there was clipping of the signal on the output of the pre-amp the signal continued to be readable by the PIC input and stayed within input parameters and above Vss. Here are some pictures of the testing and prototyping process:
The next step in the process was to plan how the new Pre-Amp would be interfaced with the existing circuit board. The original board had a 4 pin header with V-, 9V+, Input, and Ground. I wanted to make this 4 pin header usable for the attachment of the Pre-Amp. My needs would be Input from the Crystal Oscillator, +5 Volts, Output of the Pre-Amp, and the Ground. One trace on the original board had to be cut and the output of the Oscillator had to be rerouted to the pin previously used by the V-. Here is a picture of the modifications.
In the first picture, dead center, you can see the 9 volt trace which has been cut. A connection was next made between the output of the 7550 +5 volt 100 mA regulator and this header pin. If you look carefully in the middle picture you can see this jumper under the 4 pin angle header. The 7550 regulator is rated at 100 mA and is powering the PIC, the display, and now the pre-amp. During planning for this modification I had measured the current draw of the main board with a fully lit display at 25 mA. The new pre-amp will be drawing about 5 mA. The Crystal Oscillator circuit will continue to run directly off the 9 volt power source. In the third picture you can see, about mid picture the 1 nF capacitor that couples the oscillator circuit to the header pin labeled .
With all the testing and main board preparations made I began to plan the construction of the Pre-amp circuit. Here were my parameters for the circuit.
Make it on padded perf-board with the smallest foot print possible.
Low profile is important so resistors must lay against the board
Input and output headers so the board can be removed easily
I made a preliminary plan on one paper and then a board layout on another. I was able to compress the circuit into a 5 X 9 matrix. Here are the planning papers:
I wanted to use 1/4 watt resistors as that is what I had and they required more space. By using both sides of the board I was able to construct this small pre-amplifier circuit:
The black female header will mate with the angle header pins on the main board and also support the circuit board. There will be a insulated barrier between the two boards so that they can not short to each other. The small green header is the connection point for the BNC jack on the front of the unit. Here is a picture of the pre-amp mounted to the main board:
Now all that is left to do is to complete the assembly and run some tests.
The unit worked pretty much as would be expected for a $7.50 kit that had been modified by an old tinker. The pre-amp must have introduced a little noise to the PIC input which the PIC tries to decode so the unit does not stay at zero when no input is present but reads around 150 Hz. The input voltage sensitivity is satisfactory and goes down to 500 mV on moderate to low frequencies and as low as 200 mV at the higher frequencies. The unit will read only down to about 500 Hz as compared to 1 HZ when the input was connected directly to the RA4 input of the PIC. This is undoubtedly caused by the increasing impedance of the 47 nF capacitor in the pre-amp input at these low frequencies. As I continue to play with this unit I hope to make some minor improvements. The crystal oscillator seems to work very well with some crystals and not so well with others. I will also be investigating this problem. The oscillator problem always existed but it seems to have gotten worse with the pre-amp modification so this warrants additional investigation.
John
Top Comments