hi
I have a project which i want to use an IR Receiver TSOP4840 40kHz
and an IR Led Transmitter 5mm - 940nm (100mW).The only thing i would like to do is to read ir reciever and know when the beam between ir led and ir reciever is broken.only the reading must be very fast.I think i must use interrupt pin.I can not find a sample code to start.
Can anyone help me to have a start?
Thanks
This IR Serial Thread may help. (IIRC it is for 38kHz)
If you only need to detect a beam-break I don't think there is any value using a TSOP4840
...R
only the reading must be very fast.
Is this because you want to detect something moving quickly like a bullet?
Grumpy_Mike:
Is this because you want to detect something moving quickly like a bullet?
yes.its a ballistic chronograf project.I accume its familiar to you?
Robin2:
This IR Serial Thread may help. (IIRC it is for 38kHz)If you only need to detect a beam-break I don't think there is any value using a TSOP4840
...R
So you think this cant be done with tsop4840?
alextech:
So you think this cant be done with tsop4840?
Sorry I don't help with Threads related to weapons.
...R
Robin2:
Sorry I don't help with Threads related to weapons....R
I respect that,but if does make any difference,this chronograf is for air rifle ,and i am athlete of target shooting.
thanks
alextech:
but if does make any difference,this chronograf is for air rifle ,and i am athlete of target shooting.
I am quite sure you have no intention of killing or injuring anyone but treating guns as "sport" or "athletics" is abhorrent. The only reason guns were invented was to make it easier for bullies to force people to do what they don't wish to do. Giving them a cloak of respectability is all wrong IMHO.
...R
Robin2:
I am quite sure you have no intention of killing or injuring anyone but treating guns as "sport" or "athletics" is abhorrent. The only reason guns were invented was to make it easier for bullies to force people to do what they don't wish to do. Giving them a cloak of respectability is all wrong IMHO....R
years back,knifes and shords was the weapons. now you use a knife to cook but if you want to heart something alive you can.I think it is a very large conversation ,and each of as has a different opinion.
do not want to argue,just say my point of view.
I'm not sure that a modulated IR beam setup will work for your application. While they are pulsed at 38KHz or so for noise immunity, they're meant to transport relatively low data rates by gating the 38KHz pulses on an off in by the low-speed data. Meaning each data bit consists of multiple 38KHz pulses. The Internal detection electronics are tuned for this low rate.
What you want is a fast photodiode connected to a fast gate (or flip/flop) that detects and holds the one-shot event. You could use several of these setups to detect these events as the projectile passes from one to the next. The flip / flops would trigger interrupt events in the processor to record each time of passage. With that information you could determine velocity, etc.
A problem I imagine you might have is getting everything lined up and stable enough such that the small rifle pellet is able to interrupt enough of the beam to be detected.
thanks for reply
finally i manage to do it with phototransitor.i put each phototransistor and ir led 200mm apart.
i use this code but are not fast enough.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int thresh =140;
int thresh2 =600;
int sens1 = A4;
int sens2 = A5;
int val;
int val2;
unsigned long Time,Time2;
float elap;
float mps;
void setup()
{
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("WAITING....");
Serial.begin(9600);
pinMode (sens1, INPUT);
pinMode (sens2, INPUT);
}
void loop()
{
val = analogRead(sens1);
val2 = analogRead(sens2);
Serial.println("First Sensor");
Serial.println(val);
Serial.println("Second Sensor");
Serial.println(val2);
val = analogRead(sens1);
val2 = analogRead(sens2);
//**********************************loop while greater than threshold
while(val >= thresh)
{ val = analogRead(sens1);
} //**********************************loop while less than threshold
while(val <= thresh)
{
lcd.clear() ;
Time=micros();
val = analogRead(sens1);
}
//*********************************loop while greater than threshold
while(val2 >= thresh2)
{
val2= analogRead(sens2); }
//*********************************loop while less than threshold
while(val2 <= thresh2)
{
Time2 = micros();
val2 = analogRead(sens2);
}
//******************************** calculate everything
elap = Time2-Time;
mps = (200000/elap)*100;// 1 / inches x 1000000( 1 / 2 x 1000000 = 500000 ) sensors are 20cm apart on my board
delay(100);
lcd.print("speed");
lcd.setCursor(6, 0);
lcd.print(mps,2);
Serial.println(mps);
}
now I would like to try photodiode bp w41N what i have,
I would appreciate any help about wiring and code.
thanks
TSOPxxxx is the wrong sensor for beam break.
It is not designed for continuous modulated IR signals.
The TSSPxxxx is.
A TSSPxxxx with a 5mm IR transmit diode has a ~3-5mm ⌀ 'beam'.
It will only detect things that cover (or fly directly through) that ⌀5mm beam.
Leo..
Wawa:
TSOPxxxx is the wrong sensor for beam break.
It is not designed for continuous modulated IR signals.
The TSSPxxxx is.A TSSPxxxx with a 5mm IR transmit diode has a ~3-5mm ⌀ 'beam'.
It will only detect things that cover (or fly directly through) that ⌀5mm beam.
Leo..
thanks
What do u think for w41N?
The BPW41N is just a photodiode (no amplifier, no demodulator).
Don't know what you are trying to do with that, and I don't really care.
I sort of agree with Robin2 (post 5, 7).
Leo..
alextech:
finally i manage to do it with phototransitor.i put each phototransistor and ir led 200mm apart.
i use this code but are not fast enough.
What does this mean? What did you manage to "do" if it's not fast enough? As you've probably figured out, the difficult part here isn't the programming, it's the electronics.
What's your setup now? Do you have schematics? How fast it is currently? What are you able to detect?
BTW, those Olympic Biathletes certainly are athletes and it's a fascinating SPORT.
Wawa:
The BPW41N is just a photodiode (no amplifier, no demodulator).
Don't know what you are trying to do with that, and I don't really care.
I sort of agree with Robin2 (post 5, 7).
Leo..
thanks for reply!
gfvalvo:
What does this mean? What did you manage to "do" if it's not fast enough? As you've probably figured out, the difficult part here isn't the programming, it's the electronics.What's your setup now? Do you have schematics? How fast it is currently? What are you able to detect?
BTW, those Olympic Biathletes certainly are athletes and it's a fascinating SPORT.
i done it with the wiring and the code for the parts i used.i made a chronograph for low speeds.its progress.step by step and with this forum help maybe i would finish the project.the resson i post the incomplete project,is to help somebody that need to measure low speeds or something else that use phototransistor.
thanks
alextech:
i done it with the wiring and the code for the parts i used.i made a chronograph for low speeds.its progress.step by step and with this forum help maybe i would finish the project.the resson i post the incomplete project,is to help somebody that need to measure low speeds or something else that use phototransistor.
thanks
OK, but since you haven't shared exact details of your current hardware setup or the measured performance it has been able to achieve, I can't really offer any advice on making it faster.
i use phototrasistor ,Wavelength of peak sensitivity 940nm and ir leds 940nm and wiring you can find here How to Measure Speed With Arduino (Of a Projectile) - YouTube think ,its not the code that must be faster,but the hardware, the problem is what hardware i must use to measure 1000 foot per second?