555 Timer as an A/D converter

25,862

Circuit Image

The 555 timer generates positive pulses. The pulse width is inversely proportional to the difference in voltage between the "ANALOG IN" voltage and the voltage across a 4.7 µF capacitor (approximately 2.5 volts). To calibrate this circuit, connect it to a Basic Stamp for measuring positive pulses and apply a known voltage. For instance, if the circuit outputs the number 2092 when supplied with 15 volts, the coefficient can be calculated as 2092 * (15 - 2.5) = 26150. This allows for voltage measurement using the Basic Stamp with the formula: voltage = 26150/pulse + 2.5. Adjustments may be necessary to accommodate the Basic Stamp's computational limitations. The circuit's accuracy is comparable to many digital voltmeters within the tested range of 6 to 18 volts, similar to a 10-bit A/D converter. Accuracy may vary with processor clock speeds and the +5 supply voltage. The conversion time is less than 0.1 seconds, but it will not measure voltages below 5 volts. Additionally, verify the accuracy of the +5 volts supply; if it is 5.2 volts, the formula should use 2.6 instead. Debug lines can be uncommented to obtain pulse values during the calibration loop: `debug cls pulsin 0, 1, w2` (using pin 0), `debug w2`, `w1=26150` (the coefficient for calibration). The calculations will then adjust for integer-only operations in the Basic Stamp: `w4=w1/w2`, `w3=w4*100`, and other iterative adjustments to derive the final voltage reading in hundredths of volts.

The 555 timer IC is a versatile device widely used in various timing applications. In this circuit configuration, the timer operates in a monostable mode, producing a pulse output based on the input voltage and the capacitor's charge. The pulse width can be finely tuned by altering the input voltage, allowing for precise voltage measurements.

The calibration process is critical for ensuring accurate readings. By establishing a reference voltage and calculating the coefficient, the circuit can reliably convert pulse counts into voltage values. The relationship between the pulse width and the input voltage is leveraged to create a linear approximation of the voltage measurement, making it suitable for integration with microcontroller platforms like the Basic Stamp.

The implementation of debug lines is essential for monitoring performance during the calibration process. It facilitates real-time adjustments and ensures that the system operates within its specified accuracy range. Furthermore, the limitations regarding voltage measurement below 5 volts must be accounted for, as they may affect the applicability of this circuit in lower voltage environments.

Overall, this circuit exemplifies a practical application of the 555 timer in voltage measurement, demonstrating its effectiveness and reliability when properly calibrated and utilized within its operational parameters.The 555 timer will put out positive pulses. The pulse width is inversely proportional to the difference in voltage between the voltage at "ANALOG IN" and the voltage of the 4. 7uF capacitor(let`s say 2. 5 volts). To calibrate this circuit, hook it up to a Basic Stamp measuring positive pulses, and give the circuit a known voltage.

Let`s say you get the number 2092 when you give the circuit 15 volts. Your coefficient is 2092 * (15 - 2. 5) = 26150. Now you are ready to measure voltage with your Basic Stamp. Use the formula: voltage = 26150/pulse + 2. 5. You will have to modify this to work within the limits of the Basic Stamp`s math. The accuracy of this circuit rivals many digital voltmeters within the range I tested it (6 volts to 18 volts), about the same as a 10 bit A/D converter. The accuracy will shift with the processor clock and the +5 supply, so it is pretty good. Conversion time is under 1/10 second. Please note it will not measure voltages below 5 volts. Also, check the accuracy of your +5 volts. If it is 5. 2 volts, you will need to use 2. 6 in the formula. `uncomment the debug lines to get pulse value while calibrating loop: `debug cls pulsin 0, 1, w2 `I used pin 0 `debug w2 w1=26150 `This is the coefficient you will need to calibrate.

w4=w1/w2 w3=w4*100 `I am going to get around the integer-only Stamp math. w4=w2*w4 w1=w1-w4*10 `remember the Stamp has left-to-right math w4=w1/w2 w3=w4*10+w3 w4=w2*w4 w1=w1-w4*10 w4=w1/w2 w3=w4+w3 w3=w3+250 `250 is really 2. 5 volts debug w3, "volts * 100" `we get a reading in hundredths of volts goto loop 🔗 External reference