Pages: [1] 2   Go Down
Author Topic: IR connection  (Read 805 times)
0 Members and 1 Guest are viewing this topic.
Bologna
Offline Offline
God Member
*****
Karma: 5
Posts: 502
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!!!
« Last Edit: July 26, 2012, 07:51:50 am by SUBSEA » Logged

Leeds, UK
Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Bologna
Offline Offline
God Member
*****
Karma: 5
Posts: 502
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46026
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Bologna
Offline Offline
God Member
*****
Karma: 5
Posts: 502
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

  if (Serial.available()>0){

    if(Serial.read()=='2'){
      digitalWrite(13, HIGH);
   
    }
 
  }
}
Code:
void setup(){
  Serial.begin(9600);
  pinMode(13,OUTPUT);
}
void loop(){
  digitalWrite(13,HIGH);
  Serial.print('2');
}


* Untitled Sketch_bb.jpg (58.3 KB, 1057x602 - viewed 9 times.)
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46026
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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'.
Logged

Bologna
Offline Offline
God Member
*****
Karma: 5
Posts: 502
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank a lot paulS. How can i do this?
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3114
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Bologna
Offline Offline
God Member
*****
Karma: 5
Posts: 502
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3114
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 548
Posts: 46026
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Bologna
Offline Offline
God Member
*****
Karma: 5
Posts: 502
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok. Thank a lot. only a question... What is this???:
 
Code:
) 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?
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://arduino.cc/en/Reference/BitWrite
Logged

Bologna
Offline Offline
God Member
*****
Karma: 5
Posts: 502
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, but i don't understand how i can send different messages...  smiley-sad
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24320
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
usually modulated on top of a 38 MHz carrier,

sp. "38kHz"
Logged

"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.

Pages: [1] 2   Go Up
Jump to: