Below is the schematics of a circuit so far I finalized and soldered on a perfboard:
Basically the circuit converts 0...10V input voltage to 10mV pk-pk square-wave. The goal is to obtain a linear relation between the output frequency and the input voltage. Since LM331 known as quite linear, I used it as a voltage to freq. converter. But when varying the freq., LM331 also changes the duty cycle a lot. That was a problem in ADC side at the output. So to overcome this and to obtain around 50% duty cycle a 74HC74 follows LM331 by halving the frequency. Halving freq. is no problem because it will not affect the linear relationship between the input voltage and output freq.
The circuit works fine both in simulation and in real. I mean it does the job at first look.
But if you wait enough you see a drift in freq. output(at Q or at Fout).
Here are some observations from yesterday for 2.5V constant input voltage:
At 17:00 o'clock 924Hz
At 18:00 o'clock 918Hz
At 19:00 o'clock 919Hz
At 20:00 o'clock 913Hz
At 21:00 o'clock 917Hz
At 22:00 o'clock 912Hz
And today after powering on the circuit with again 2.5V input I measure the freq. output as: 936Hz which keeps increasing to 945Hz ect.
What I have noticed is, when I touch slightly with my finger or a pencil to the capacitor C1 or C3 I see dramatic changes at the output. The other components do not make such difference in response to a physical interaction.
For C1 I'm using a ceramic capacitor as you can see in the photo.
In the data-sheet of LM331 C2 is recommended 1u Mylar capacitor which I use ceramic. But interacting it physically does not make such change as C1.
In another forum I found this comment(in the quote I modified his cap names to be consistent with my schematics):
Finally I solved it.
I used C1 = 10nF NPO (very stable with varying temperature) capacitor in place of C1 = 10nF X7R (high temperature coefficient). As my circuit contains lot of transistors and Transformer, due to increasing temperature, the frequency was gradually increasing, which doesn't happen now after changing it to NPO.
Also, I added 47 Ohm resistor in series with C2 = 100 nF capacitor, which increased the stability further.
Does anybody have experience or idea about the issue? The capacitor types and tolerances are critical for LM331 in this circuit, I would be glad to hear your suggestions on these.