Go Down

Topic: How can I pulse a ir led for a reciever? (Read 2 times) previous topic - next topic

a_lehmann

Hey there,

I've already done some projects with Arduinos but this topic is rather complicated for me.
The project is a lazer tag clone and I have problems to deal with the infrared transmission.

I would be very thankful if you could help me along with these issues.

1. The first thing I am curious about is how to get enough current for the led.
I chose a Osram LD 274 because it is cheap and nearly as "bright" as the Vishay TSAL 6100 which nearly everbody recommends.
In the data sheet there is the description that you could use it with 1 Ampere for 100 microseconds (at 2.5 Volts).
Because the Arduino does not provide that much current, I wanted to use a npn-transistor which can handle 1 A and a capacitor, which can provide 1 A.
Because I am very new to capacitors, could you give me a hint which type is the right for this task?

2. These ir recievers always have bandpasses (for example a 38 khz). How do I deal with this on the emitter side?
Am I writing the transistor base high/low at 38 khz, maybe like
Code: [Select]
digitalWrite(outPin,HIGH);
delayMicroseconds(26);
digitalWrite(outPin,LOW);
delayMicroseconds(26);

(because one oscillation at 38 khz is around 26 us)
Is this right? And could the capacitor-, led- and transistor-circuit handle this?

3. Which informations (and how) would I get on the reciever side with a 38 khz reciever (for example the TSOP 31238)?
I read something aboud pulseIn(). The description in the reference is really too short for me, I don't know if I got it.
Is there a possibility to make this with interrupts? Because the code should be able to take a shot even if it is playing a jingle or something.

Again, I would be very thankful for help. It is hard to deal with all the tutorials around because the english used is not very easy for someone who's mother tongue is not english like mine.

Greetings

Alex

Grumpy_Mike

Quote
Am I writing the transistor base high/low at 38 khz, maybe like

I would change the PWM frequency to 38KHz and use an analogue write to turn it on. Then use code like you put to pulse it. Do you want the pulses to carry any information?

Quote
I wanted to use a npn-transistor which can handle 1 A and a capacitor, which can provide 1 A.

The transistor part is easy but the capacitor is not. It is not the way to do it. You need to provide a power supply that will supply that current. One problem with a capacitor is that the voltage drops as it discharges. The other is that you will need a physically very large capacitor.

Quote
Which informations (and how) would I get on the reciever side with a 38 khz reciever

You will see a signal on the digital pin you connect to the receiver, this will match the pulses you send, not the 38KHz modulation.

Quote
I read something aboud pulseIn().

That will only measure the period of the pulse, you know what that is because you sent it. What you want to know is if you have received one or series of pulses if you are receiving data. The only way to do this effectively is by using interrupts.

Given your basic state of knowledge would you not be better off copying some one elses design rather than trying to design your own system?

a_lehmann

#2
Jul 13, 2011, 04:02 pm Last Edit: Jul 13, 2011, 04:51 pm by a_lehmann Reason: 1
Quote
I would change the PWM frequency to 38KHz and use an analogue write to turn it on. Then use code like you put to pulse it. Do you want the pulses to carry any information? [...] You will see a signal on the digital pin you connect to the receiver, this will match the pulses you send, not the 38KHz modulation.


Alright, I think I already understood it shortly after I posted my question. The 38 KHz pulse is something like a carrier frequency (right?). So if I change the PWM to 38 KHZ, I could use this code:
Code: [Select]
analogWrite(outPin, 128);
delay(10);
analogWrite(outPin,0);
delay(10);

to have the ir reciever HIGH for 10 ms?

Quote
You need to provide a power supply that will supply that current. One problem with a capacitor is that the voltage drops as it discharges. The other is that you will need a physically very large capacitor.

I wanted to use something like a 9 V battery as power source. Is it possible to get current around 1 A out of it? I was afraid it doesn't work because of the inner resistance (don't know how high it is).

edit: I just tested it with an AA battery and it were about 1.5 to 1.7 A (and it did not get hot :P)

Quote
Given your basic state of knowledge would you not be better off copying some one elses design rather than trying to design your own system?

Yeah, I know, it would be easier... But I am too ambitious for it :P and not that bad ;)

Thank you so far for your answer, it was really helpful.

Grumpy_Mike

Quote
I could use this code:

Yes. However check the data sheet to see if 10mS is too long for the receiver.

Quote
I wanted to use something like a 9 V battery as power source.

As you say this is not good as you won't get that much current from one, but fine on the AA battery.

Best of luck with this.

a_lehmann

Quote
Best of luck with this.

Thank you, you helped me very much. I'm now ordering the parts.

Go Up