I have been looking around for a simple sinewave circuit that provides a sweepable frequency with a stable amplitude for little cost.
Analog circuits that offer a stable, easily sweepable frequency with a stable amplitude output appear to be relatively complex but not too expensive. An integrated circuit such as an XR2206 is quite expensive, costing between $6.50 and $14.00 depending on where you go (this is just for the chip).
Luckily, the sinewave i need doesn't actually have to be very sinusoidal at all. I just want it to have less prominent harmonics than, say, a square wave. Which brings me to a low-cost, very low-fi digital logic approach.
Low-fi Digital Approach
The concept is actually quite simple. By using a 4051 multiplexer, it is possible to generate custom waveforms with eight stages. By choosing the correct resistors for the voltage division
that feeds the eight channels on the 4051, it is possible to get a very compromised approximation of a sinewave. This technique would also rely on a 4040 binary counter or similar and a squarewave clock input for the counter. Below you can see an ideal representation of this situation of power supply voltage versus step.
The main issue is that real-world, locally available resistor only come in the E24 series as a maximum 'resolution' of resistance. What is the E24 series? Well, its pretty much a number series of 24 unique values between 10 and 100 in which resistors are available in various magnitudes. In other words, although it may be possible to get the resistance ratio (and thereby voltage output) of the eight voltage dividers close to the above diagram, it will not be possible to get those exact ratios.
Since the resistors that are available locally only have a maximum precision of 1%, the aim of balancing the resistance values is to be within this margin of error when compared to the 'ideal' values that should be used to produce the shape shown on the graph.
The following table shows the relationship between degrees, the sine function and the equivalent ratio for eight steps. It is then possible to reconcile the ratio value with a voltage value and also a resistance value. 112KΩ has been chosen to represent a resistance ratio of 1. Ra and Rb implies the following voltage divider circuit:
Vcc --- Rb ---| --- Ra --- Gnd
So, the choice for which resistors to choose becomes quite simple. No resistors are required for a ratio of 1 or a ratio of 0, because vcc or ground can be connected to the channels / steps in question. Which leaves only three values left to approximate - 560.00k, 955.98k and 164.02k
56 is in the E24 series, so 560kΩ is a real world value. Neither of the other two values are available, so they have to be approximated by putting two resistors in series. For 164.02k, a 120k plus a 43k are enough, producing a precision that is approx. -0.62% below the ideal value. For 955.98k, a 910k plus a 47k are enough, producing a precision that is approx. +0.11% above the ideal value.
Results coming very soon. Like, tomorrow. Or even today. Although i am a bit sick : (