Hello everybody;
i found a scheme at arduino forums:
i will use this for resistance measurement.
but i cant figure out how to calculate frequency of oscillator depending on resistance.
is there a mathematical formula for this.
thank you
Hello everybody;
i found a scheme at arduino forums:
i will use this for resistance measurement.
but i cant figure out how to calculate frequency of oscillator depending on resistance.
is there a mathematical formula for this.
thank you
I had a flowmeter that had exact same output. it is likely to have a magnet to change the voltage (reed switch).
I used this to calculate the time. You can then divide 1/time to get frequency.
/*
ReadAnalogVoltage
Reads an analog input on pin 0, converts it to voltage, and prints the result to the Serial Monitor.
Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu).
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
This example code is in the public domain.
*/
//unsigned long duration;
unsigned long timeOneLoop;
unsigned long timeStart;
unsigned long timeFinish;
int sensorValue;
float voltage=0;
float TotalFlow;
bool CountStarted=true;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
//pinMode(A0, INPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// print out the value you read:
//duration = pulseIn(A0, LOW);
//Calculate pulse
// read the input on analog pin 0:
sensorValue = analogRead(A0);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
voltage = sensorValue * (5 / 1023.0);
//Serial.println(CountStarted);
if(voltage<1 && CountStarted) {
Serial.println("Started");
//Serial.println(millis());
timeOneLoop=millis();
CountStarted=false;}
else{
if(voltage>1 && CountStarted==false){
CountStarted=true;
timeOneLoop=millis()-timeOneLoop;
Serial.println("total time is:");
Serial.println(timeOneLoop);
TotalFlow = 10000.00/(timeOneLoop*4);
Serial.println("Total Flow is (L/Sec):");
Serial.println(TotalFlow);
}
}
delay(100);
}
The TLC272 doesn't have rail-to-rail outputs, so the oscillation frequency maybe less well defined
than the equations suggest as the rising exponential curve will intersect with the ill-defined
max output voltage (* 0.909)
Comparators are much more appropriate for this kind of relaxation oscillator, and the classic 555
is an example of this.