Hello everyone,
I've been looking around the web for tutorials but I guess it's a bit confusing. Is it possible to send data such as 1 or 2 to a receiver? And how is this achieved? Will I need a 3 pin detector or just a 2 pin?
Thank you
Hello everyone,
I've been looking around the web for tutorials but I guess it's a bit confusing. Is it possible to send data such as 1 or 2 to a receiver? And how is this achieved? Will I need a 3 pin detector or just a 2 pin?
Thank you
SeanD:
Hello everyone,
I've been looking around the web for tutorials but I guess it's a bit confusing. Is it possible to send data such as 1 or 2 to a receiver? And how is this achieved? Will I need a 3 pin detector or just a 2 pin?Thank you
The answer is YES you can (how do you change channels on your TV????)! Here is a great tutorial from LADYADAAAAA!!! =D Overview | IR Sensor | Adafruit Learning System
Google "IRDA"
Hello there, baselsw,
So basically the commands are just different wavelength at a certain frequency?
Would it be possible for you to put it into simple laymen description? The details of that website is a bit overwhelming for me. Thanks
So basically the commands are just different wavelength at a certain frequency?
No, a certain wavelength has a specific frequency
Hello there,AWOL,
I read through the whole article but would you be able to interpret it for a completely new person for infrared?
Thanks
Different pulsewidths, not wavelengths. The data in IR is generally encoded as a certain time HIGH and a certain time LOW within a period. Typical is 1t HIGH/2t LOW for zero and 2t HIGH and 1t LOW for one.
t is the minimum pulse width. A typical value of t is 500us. So each bit takes 1.5ms.
Using the above encoding, to receive, you would trigger an interrupt on the rising edge, count 1ms, then check to see whether the signal is still HIGH or if it is LOW. If it is still HIGH, then the data is one, and if it is LOW, the data is zero.
Note: There are other ways to do it as well, this is just a typical example.
Using a 3 pin decoder, it will demodulate the signal for you so all you will need to deal with are pulse widths. The frequency of the receiver needs to match the frequency of the transmitter. Other than matching them up, you wouldn't have to mess with the frequency.
However, to transmit, you would have to generate that carrier on your own. An easy way is to output a PWM of 50% at the frequency on one pin for the carrier, and output your pulse widths on another pin and use an AND gate to combine them and output that to an IR LED. This will send the carrier only when your pulse-width pin is high. You would use 33% (~1t) and 66% (~2t) duty cycles on your pulse width pins for your bits.
The information is sent as a series of pulses. The transmitter flashes a light, the receiver sees the flashes and amplifies it into a digital signal (Hi, Lo, perhaps 5V/0V, or 3.3V/0V). In this case, the light is infrared so the unaided eye cannot see it.
So the receiver seeing Hi-Lo 5 times and a break might say "I just received a '1' , and seeing Hi-Lo 10 times might say "I just received a '0' ".
Follow on circuits might look for discrete messages, like 1001, or 1010, or 0110, and act accordingly, or be programmed to ignore anything not recognized.
Hello there CrossRoads and Retroplayer,
In the case that Crossroad mentioned about "flashes of light", how do you register that? I tried doing a digitalRead(), but how do you calculate the time it flashes per Milliseconds/seconds/minute? I tried doing an increment counter but its behaving really weird.
Any help?
Let's reel this in. If you are using a receiver module, you don't need to be concerned about the 'flashes of light.' The module will demodulate the signal for you. The output will be pulses represented in length, and you would decode it as I mentioned above.
Without using a decoder, you would see bursts of the carrier that represented when the data was HIGH. The decoder strips the carrier out and leaves you with only high and low.
This site will give you some nice visuals to see what I am talking about:
It is focused on remote formats, but the overall concept is the same as sending whatever data you want.
Hi Retroplayer,
Okay so I followed the article on the link posted by baselsw. I got the LED to transmit and receive on two different Arduino.
Arduino 1 sends signals to Arudino 2. My problem now is that I also want Arduino 2 to send signals back to Arduino 1 too, but it's not working.
Here is the loop();
void loop(){
//@CODE 1
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(light, HIGH);
SendNikonCode();
}else {
digitalWrite(light, LOW);
}
// @END CODE 1
// @CODE 2
if(pulseIn(irPin,LOW,10000)){
hit=true;
//delay(66);
//Serial.println("You pressed a button");
counter++;
}else{
if( hit ){
hit=false;
Serial.println(counter);
}
counter = 0;
}
// @END CODE 2
}
Code 1 is currently used for Arudino 1 to send.
Code 2 is currently used for Arudino 2 to recieve.
When I put them both together, then the device won't recieve anymore, although it can send.
the SendNikonCode() has a few delay() in them, so I'm thinking this is the problem.
any idea? Are they any tutorials on how to transmit and receive seamlessly? Like Arudino 1 can control Arudino 2 and vice versa?
If you put the receiver on an interrupt pin, it will step out of whatever it is doing and run the code. But that could break your delays.
Hi Retroplayer,
Do you have any good tips or tutorial on this? I've been doing a lot of googling for it, but it all seems very complicated.