# Pins and Resistor

So, I have a TSOP1736 infrared receiver and I want to use it with this code.

First, the receiver has 3 pins. The datasheet says that “Supply Voltage” is Pin 2 and “Supply Current” is Pin 3, so the “data” pin is 1, right?

Second thing, in the datasheet, it says that “Supply Current” should be 5 mA. I think that all the arduino I/O pins use 40 mA, so R = V/I, so, I should use a 82.5 Ohm resistor between the Arduino pin and the TSOP pin, right?

Sorry for the n00b electronic questions, but I’m really newbie.

Regards

5 /0.005 = 1000 (not accounting for the device just looks like you were 1 0 off)

the datasheet i pulled for this part shows the standard config as G V O, if the dome is facing towards you

http://www.datasheetcatalog.org/datasheets/208/301092_DS.pdf

IR can be fun, so good luck!

Your over complicating it. Here is a data sheet that shows pins and list their function and requirements.

http://www.datasheetcatalog.org/datasheets/208/301092_DS.pdf

To wire up for an Arduino, wire Device pin 1 to an Arduino ground pin,
Wire device pin 2 to the Arduino +5vdc pin. Wire device pin 3 (received signal) to the desired Arduino digital input pin of your choice, such as pin 2 in the code example you linked. No resistors are required.

Lefty

i havent tried one on arduino, but the last time i hooked one of these things up directly to 5v it started to go, I caught it before it burned out and it still worked (all be it at diminished performance)

while it is true the basic setup schematic on this particular parts datasheet only shows a small r/c filter to smooth power

i havent tried one on arduino, but the last time i hooked one of these things up directly to 5v it started to go,

This IR receiver IC is designed to be powered and wired directly to +5vdc and ground, there is no need for a current limiting resistor, it is not an LED, it is a IC. I’ve wired one up to a breadboard before and it worked as designed with just a ground, +5vdc, and a signal wire to hook to a digital input pin.

Lefty

I know its not a led : , but just goes to show always read the data sheet

I connected the receiver and everything went awesome.

Now, I want to use the Arduino as a remote control.

I hooked up the IR LED on Pin 13 (it already has an internal resistor, right?) and I am trying to reproduce the code I got from the receiver. The thing is that it ain’t working.

``````long times[] = {0, 0, 2680, 3552, 4068, 4880, 5400, 5768, 6292, 6652, 7176, 7988, 8944, 9316, 9832, 10204, 10720, 11092, 11608, 11976, 12496, 12864, 13388, 13748, 14272, 14636, 15152, 15524, 16040, 16412, 16928, 17300, 17820, 18188, 19152, 19960, 20484, 20848, 21364, 21732, 22248, 22620, 23140, 106432, 109116, 109980, 110504, 111312, 111836, 112196, 112712, 113084, 113604, 114420, 115380, 115744, 116268, 116636, 117156, 117524, 118036, 118408, 118924, 119296, 119812};

int IRpin = 13, i, st;
char c; unsigned long j;

void setup() {

Serial.begin(115200);
Serial.println("<----- Arduino Remote ----->");

pinMode(IRpin, OUTPUT);

}

void loop() {

Serial.println("Waiting for order...");

while (Serial.available() == 0) {}
c = Serial.read(); st = LOW;

Serial.print("Pushed button: ");
Serial.print(c); Serial.println("");

for (i = 1; i < 65; i++) {
digitalWrite(IRpin, st);
j = micros();
while (micros() - j < times[i] - times[i-1]) {}
if (st == LOW && i != 1) st = HIGH;
else st = LOW;
//    Serial.print("In the "); Serial.print(i); Serial.print(" iteration\n");
}
digitalWrite(IRpin, LOW);

delay(2000);
}
``````

Is anything wrong in my code?

I’m afraid that “it isn’t working” is awfully vague. Can you be more specific?

Do you see the “Waiting for order…” message?
Do you ever see the “Button pushed” message?

“It is not working” means that the TV ain’t doing nothing when I press.

<----- Arduino Remote ----->
Waiting for order…
Pushed button: 1
Waiting for order…
Pushed button: 2
Waiting for order…
Pushed button: 1
Waiting for order…
Pushed button: 1
Waiting for order…
Pushed button: 3
Waiting for order…

So, the program runs, but has no effect on the TV.

I hooked up the IR LED on Pin 13 (it already has an internal resistor, right?)

No, that won’t work right. The internal resistor for the on-board pin 13 LED is not avaible for your externally wired IR LED. It will need it’s own resisstor in series with your external IR LED.

Lefty

The LED I’m using is this: TSUS4300.

I hooked up a 200 Ohm resistor, does that value work?

Thanks

Yes it’s a bit high but it will do.

Is anything wrong in my code?

Well I would say yes.

I can’t see how you are modulating the IR, it just looks like you are turning it on and off. If you are driving a TV set it will require that it be modulated. That means turned on an off rapidly on top of the timings you have. This modulation frequency is typically 38KHz but can range from 32KHz to 40KHz. Do you know what modulation frequency your TV is expecting / your remote gives?

I think that it is 38 Khz, but not sure. So, can you correct my code?

think that it is 38 Khz,

I can’t see you using any modulation at all in this sketch.

All I can see is you doing this:-
digitalWrite(IRpin, st)
when st is not defined the first time round the loop
then:-
while (micros() - j < times - times[i-1]) {}
which does nothing, just a delay for a number of micro seconds defined by the array.
then:-
if (st == LOW && i != 1) st = HIGH; else st = LOW;
Which toggles st all except the first time round the loop and sets st for the first time.
So where do you think the 38KHz comes in and do you know it is 38KHz anyway?

So it’s not a matter of correcting the code but writing it.
Look at the code here:-
Building a Universal Remote with an Arduino