puchacz
Posts: 23
Joined: Wed Feb 13, 2013 2:19 pm

Gpio - IR Receiver

Fri Mar 01, 2013 7:46 pm

Hello, i've got IR receiver which i want to use with my raspberry pi but not sure how :)

IR Rec: tsop 31238

My connection to RPi :

+ 3.3v -> R220Ohm -> 2 pin on receiver
- Gnd on 1 pin on receiver
Data 3 -> R2.2KOhm -> 3 Header pin / 8 wiring pi pin on my raspberry

thats my program:

...
pinMode(8, INPUT);
while(digitalRead(8))
{
std::cout<<"no signal"<<std::endl;
}
std::cout<<"pin state changed"<<std::endl;
...

it doesnt work :) How to run this receiver :)
Last edited by puchacz on Fri Mar 01, 2013 9:15 pm, edited 1 time in total.

User avatar
joan
Posts: 12745
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Gpio - IR Receiver

Fri Mar 01, 2013 9:10 pm

Any specs for that device? I can't find tsop 3128 as an IR receiver.

puchacz
Posts: 23
Joined: Wed Feb 13, 2013 2:19 pm

Re: Gpio - IR Receiver

Fri Mar 01, 2013 9:14 pm


User avatar
joan
Posts: 12745
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Gpio - IR Receiver

Fri Mar 01, 2013 9:36 pm

Connections seem OK.

It'd be worth double checking that the software pin 8 maps onto the pin you are using on the gpio header.

Your code fragment seems incomplete.

You need something like

Code: Select all

pinMode(8, INPUT);
pinState = -1;

while (true)
{
   newPinState = digitalRead(8);
   if (newPinState != pinState)
   {
      pinState = newPinState;
      print pinState;
   }
}

puchacz
Posts: 23
Joined: Wed Feb 13, 2013 2:19 pm

Re: Gpio - IR Receiver

Fri Mar 01, 2013 9:41 pm

i quess something must be wrong (too big resistors?) becouse even lirc_rpi dont react on any ir pilot. I will check it

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: No registered users and 9 guests