I have decided to use two IR led (38 kHz Pulse Generator with a 555 Timer) with the circuit as shown in this link
http://www.trainelectronics.com/artcles/PulsedIR/index.htm . Also i'll be using 2 ir receivers(
http://www.engineersgarage.com/sites/default/files/TSOP1738.pdf ).
Next step would be to calculate the time for the drop to calculate the time for the drop to travel from IR led 1 to IR led 2. So, i guess signal would be cut as the drop pass through the ir beam. I would like to know from the output of the receiver how to connect it to the arduino uno and what code would be suitable for this purpose? Thanks in advance.
//Speedometer
/*This program computes the speed of a projectile using photo interrupter LED/transistor pairs,
and displays the result on the serial monitor.
The time elapsed between activation of two successive photo interrupters is measured.
The distance between the respective sensors is divided by the time elapsed.
The resulting value corresponds to the average speed during the interval between the two sensors.
There are two photo interrupter pairs used to obtain average speed data.
-------------------------------------
|Sensor| |Sensor |
| 1 | | 2 |
-------------------------------------
|<-----gateDist-------->|
*/
//Constants
const int gate1Pin = 2; //assigns the first photointerrupter to digital I/O pin 2
const int gate2Pin = 3; //assigns the second photointerrupter to digital I/O pin 3
//Variables
long startTime;
long travelTime;
float gateDist = 0.03; //This is the spacing between gates in meters. The default
//is 0.03 m or 3 cm. This value should be adjusted accordingly
//if the gates are spaced closer or further apart. For example, for
//a gate spacing of 2.5 cm spacing you would need to
//replace 0.03 with 0.025, etc. for accurate result.
float travelSpeed = 0; //the speed of traversing the two gates
void setup(){
pinMode(gate1Pin, INPUT);
pinMode(gate2Pin, INPUT);
Serial.begin(19200);
}
void loop(){
if(digitalRead(gate1Pin)<1)
{
startTime = micros();
while(digitalRead(gate2Pin)>0);
travelTime = micros() - startTime;
travelSpeed = gateDist / travelTime * 100000000
;
Serial.print("The last velocity was ");
Serial.print(travelSpeed,0);
Serial.print(" centimeters per second");
}
}
Guys let me know what u think about this program. I am assuming that it will work just fine for my project.
Also, let me know how i could enhance it to have better results.
thanks