| Parallel Port |
|
In order to read analogical signals, it is necessary to make the respective conversion to Digital Signal. then NE555 Timer generates variable pulses (it has like answer a frequency) from two resistances and a capacitor. This approach of data acquisition implies the following steps:
1. To adapt the physical variable in study so that one behaves like electrical resistance
2. To calculate the values of the remaining resistance and the capacitor
3. To connect the output of the timer to one of the bits of the status record
4. To elaborate a program that calculates the frequency from the entrance pulses
5. To make the measurements with known values of reference
6. To construct a model of transformation of frequency to the variable in study (regression, interpolation)

Fig. Timer NE555
Electrical source
Vcc 5 volts
Ground
The source of 5 volts to feed this circuit can be obtained directly from the PC Power Supply, or the port of games (to see power supply).
Generic circuit

Fig. Generic circuit
NE555 Timer generates a pulse according to the values of two resistance and a capacitor.
The following formula is used to calculate the period of this pulse.
Where:
Ra |
: |
Value of the resistance connected to pins 7 and 8 |
Rb |
: |
Value of the resistance connected to pins 2 and 7 |
CAP |
: |
Value of the polarized capacitor connected to ground and pins 2 and 6 |
Like example, see the following values:
Ra: 540 ohm
Rb: 620 ohm
CAP: 1 microfarad =
Farads
Being
![]()
T= 0,00123354 seconds
What a pulse with a frequency generates of
![]()
![]()
The calculated frequency can differ from the frequency that is showed cause the NE555 Timer has elasticity effects in the resistance as in the capacitor of this circuit.
In a case of practical application, the Ra resistance will be due to maintain fixed and also the Capacitor, so that the variable that will be analyzed is the Rb resistance. As this resistance varies, the timer will generate different frequencies. The generated frequency is based on the variations of the resistance in study.
The following algorithm allows to read and to calculate the frequency generated by timer NE555.
/* Beginning *
ctd_pulso_alto =0
ctd_pulso_bajo =0
leer_tiempo_de _sistema
/* main *
while the passed time has not surpassed 1 second to do
beginning
if bit_leido it is in high then
beginning
ctd_pulso_alto = ctd_pulso_alto+1
while bit_leido it is in stop doing
beginning
aim
aim
if bit_leido it is in low then
beginning
ctd_pulso_bajo = ctd_pulso_bajo+1
while bit_leido he is in low doing
beginning
aim
aim
aim {of while}
/* Calculations *
frequency: = (ctd_ pulso_alto+ ctd_pulso_bajo) /2
/* Aim *
aim
In this example the variables of the generic circuit are defined to make the reading of temperature with the use of a thermo-resistance.
The thermo resistance that is used was obtained from the bulb of temperature of the control system of refrigeration of an automobile.
Next the circuit with the specific parameters of this practice is described.
Practical circuit

Fig. Circuit I practice
The thermo resistance (bulb) varies its resistance according to the temperature. When varying this resistance, the circuit also generates a variable frequency.
In this specific case, it turns out simpler to make a series of measurements with the aid of a thermometer, so that the respective frequency for each measurement is registered.
The following data were obtained previously with a circuit like the described one, and with the aid of a mercury thermometer
Experimental data:
Temperature |
Frequency |
120.0 |
1500 |
89.0 |
870 |
82.0 |
820 |
70.0 |
725 |
60.0 |
640 |
40.0 |
460 |
35.8 |
420 |
33.8 |
405 |
30.0 |
366 |
27.0 |
339 |
24.7 |
318 |
22.5 |
297 |
20.2 |
280 |
10.0 |
204 |
0.0 |
135 |
From these data the following algorithm of interpolation can be used:
/* the data types are defined *
type puntos=es a record with types "x", and "y" of real type
and data are a variable of that type
data are an adjustment from 1 to 50 of type points
/* Beginning *
To load the vector data [i] .x and data [i] .y with the values of the table of
Experimental
data.
Tama_vector has the number of rows of the table of experimental data
/* to construct the function *
interpolar function (with num_buscado parameter of real type) gives back a data of real type
variables i of
Integer type
x1, x2, y1, y2 of Real type
output of Real type
sale is Boolean type
beginning
i=1
sale=false;
while (i<tama_vector) and (sale=false) to do
beginning
if (num_buscado>=datos [i+1] .y) and
(num_buscado<=datos [i] .y) then
beginning
x1=datos [i] .x
y1=datos [i] .y
x2=datos [i+1] .x
y2=datos [i+1] .y
sale=true
aim
i=i+1
aim
salida=0
if
sale is true then
beginning
salida= (x2-x1)/(y2-y1) * (num_buscado-y1) +x1
aim
interpolar=salida
aim
/* Utilizar *
To call to the function with the frequency read previously
To unfold, to make graphs, etc.
/* Aim *
Questions? pparalelo@hotmail.com