Go Down

Topic: IR connection (Read 1 time) previous topic - next topic

Subsea

Jul 26, 2012, 01:39 pm Last Edit: Jul 26, 2012, 02:51 pm by SUBSEA Reason: 1
hello everybody! Today I had some problems with a Infrared connection between two adruino boards. i don't want use the ken shriff librarie's. I' ve a phototransistor (2 pin) and a TSOP (3 pin). Can you help me to solve this problem?
Thank a lot!!!

countrypaul

If you want any help, I suggest you indicate what the problem is, how it occurs, and what if anything you have tried.

Subsea

thanks countrypaul for the answer! I want to turn on 4 led. For example: an arduino send '1': the 2 arduino reads '1' and turn on pin 13. it's impossible?

PaulS

Quote
For example: an arduino send '1': the 2 arduino reads '1' and turn on pin 13. it's impossible?

No. But you have to define how you send a '1' with a phototransistor or TSOP.

Then, you need to define how you receive data with a phototransistor or TSOP, and decide what it was you received.

Subsea

I think a serial connection (if it is possible) like this, but the RX doesn't receve anything.
my code is this:
Code: [Select]
void setup(){
  Serial.begin(9600);
  pinMode(13,OUTPUT);
}
void loop(){

  if (Serial.available()>0){

    if(Serial.read()=='2'){
      digitalWrite(13, HIGH);
   
    }
 
  }
}

Code: [Select]
void setup(){
  Serial.begin(9600);
  pinMode(13,OUTPUT);
}
void loop(){
  digitalWrite(13,HIGH);
  Serial.print('2');
}

PaulS

If you expect the IR transmitter to know how to do something useful to "send" a '2', I'm afraid you are sadly mistaken.

If you expect the IR receiver to know how to convert a bunch of blinking to a '2', I'm afraid you are sadly mistaken.

You have to make the IR transmitter flash in some specific way, usually modulated on top of a 38 MHz carrier, that means '2'.

You have to make the IR receiver demodulate the data from the 38 MHz carrier, and decode the HIGH/LOW times to determine that they mean '2'.

Subsea

Thank a lot paulS. How can i do this?

dxw00d

Try the playground. I found this one there - http://tthheessiiss.wordpress.com/2009/08/05/dirt-cheap-wireless/

Subsea

Yes, something like this! But can turn on 4 different pin with those code?

dxw00d

I see no reason why it couldn't be expanded to do that.

PaulS

Quote
But can turn on 4 different pin with those code?

Depends on what you write the code to do. Given that that project appears to be able to send any data over serial, you could send "1", "two", "Tres" , and "Something A Bit Like Four", and then receive and interpret the data to know which pin to toggle.

Of course, you could make the process easier by judicious choice of what to send.

Subsea

Ok. Thank a lot. only a question... What is this???:
Code: [Select]
) Mode
 bitWrite(TCCR1A, WGM10, 0);
 bitWrite(TCCR1A, WGM11, 0);
 bitWrite(TCCR1B, WGM12, 1);
 bitWrite(TCCR1B, WGM13, 0);

 // Toggle OC1A and OC1B on Compare Match.
 bitWrite(TCCR1A, COM1A0, 1);
 bitWrite(TCCR1A, COM1A1, 0);
 bitWrite(TCCR1A, COM1B0, 1);
 bitWrite(TCCR1A, COM1B1, 0);

 // No prescaling
 bitWrite(TCCR1B, CS10, 1);
 bitWrite(TCCR1B, CS11, 0);
 bitWrite(TCCR1B, CS12, 0);

 OCR1A = 210;
 OCR1B = 210;

I don't understand what it means... can you help me  :smiley-sad-blue:?

Nick Gammon

http://arduino.cc/en/Reference/BitWrite
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Subsea

ok, but i don't understand how i can send different messages...  :(

AWOL

Quote
usually modulated on top of a 38 MHz carrier,


sp. "38kHz"
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up