Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinout #7

Closed
Atzingen opened this issue Oct 13, 2015 · 22 comments
Closed

Pinout #7

Atzingen opened this issue Oct 13, 2015 · 22 comments

Comments

@Atzingen
Copy link

Can you tell me if the pin conection is GPIO0 ( irsend(0) ) to GND or to 3.3V ? This two possibilits would invert the led status/
In Arduino is generaly is positive GPIO to GND but because the esp8266 can give low current most blink examples use gpio to 3.3V

@markszabo
Copy link
Collaborator

To GND by default

@mocheffendi
Copy link

When we put LED IR to GPIO0 ESP 8266 ESP 12E always at programming mode, can I change to another GPIO ?

@markszabo
Copy link
Collaborator

Sure, just use eg. irsend(1) instead of irsend(0) and connect your ir led to GPIO1

@xCite1986
Copy link

if connect the gpio0 to the led the esp would go in flashmode, change to gpio2 the blue light on the esp-01 stay bright (uart-mode?)

someone a simple idea how to solve that problem??

http://www.esp8266.com/viewtopic.php?f=13&t=1730

@mocheffendi
Copy link

Use irsend(5) to use gpio05

@xCite1986
Copy link

xCite1986 commented Jan 25, 2016 via email

@mocheffendi
Copy link

Sorry
I think, you need to use esp12E, there is more pin to use.
Gpio00 and gpio02 can't be used for ir send.

@Atzingen
Copy link
Author

If you are not using Serial, there are two more pins available (rx and tx) in esp8266-01 that can be used like regular gpio.

@xCite1986
Copy link

thanks for the hint :)

i would try this solution first
images

if this won't work i'll try to get out another gpio directly from the chip.
images 1

@markszabo
Copy link
Collaborator

I think you may be able to use GPIO0 and GPIO2 for irsend, if you connect the led in reverse order, and change the library a bit.
1.) Connect the led to any pin and the other leg of the led to Vcc (instead of normal GND). Use resistor as usual.
2.) Open IRremoteESP8266.cpp in text editor and go to line 305, to function IRsend::mark(int time). You need to change the following lines:
310. digitalWrite(IRpin, HIGH);
312. digitalWrite(IRpin, LOW);
321. digitalWrite(IRpin, LOW);
Change these lines to the opposition (LOW to HIGH and HIGH to LOW) like this:
310. digitalWrite(IRpin, LOW);
312. digitalWrite(IRpin, HIGH);
321. digitalWrite(IRpin, HIGH);
I think this should work, since now the led is by default connected to Vcc, so ESP8266 can boot normally. Let me know if it works, and if does, I may write an article on Wiki, because this could help others too.

@xCite1986
Copy link

hey mark.

yes, now they boots up perfectly... but the ir-led is always "bright"

edit: but hey - they works.

@markszabo
Copy link
Collaborator

hm could you try this simple sketch:
void setup() {
pinMode(0, OUTPUT);
digitalWrite(0, HIGH);
}
void loop() {
delay(1000);
}

Change 0 to 2 if you are using that pin. This should leave your led turned off. Now change from digitalWrite(0, HIGH) to digitalWrite(0,LOW), and run it. It should turn on the led and keep it that way.
Is it doing this? You can use a normal led instead of the IR led to test it. The important thing is, to use the previous setup: connect the led to the pin and to Vcc.

@xCite1986
Copy link

void setup() {
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
}
void loop() {
delay(1000);
}

= dark LED

void setup() {
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
}
void loop() {
delay(1000);
}

= bright LED

VCC connected to LED+, GPIO2 on LED-

@markszabo
Copy link
Collaborator

This is exactly the expected behavior. Now if you edited the library correctly, it should set the pin HIGH in the end of the transmission, thus it should be dark.

Are you sure you are editing the code of the library which is used by the arduino IDE? Try to make some obvious mistakes, like write a non-existing command in the library, save it, and then try to compile some code in the IDE using the library. It should throw an error message.

Maybe you have to restart the IDE to recognize the changed library, but for me I don't have to do that.

@xCite1986
Copy link

set ...


void IRsend::mark(int time) {
// Sends an IR mark for the specified number of microseconds.
// The mark output is modulated at the PWM frequency.
long beginning = micros();
while(micros() - beginning < time){
digitalWrite(IRpin, LOW);
delayMicroseconds(halfPeriodicTime);
digitalWrite(IRpin, HIGH);
delayMicroseconds(halfPeriodicTime); //38 kHz -> T = 26.31 microsec (periodic time), half of it is 13
}
}


...to ...

void IRsend::mark(int time) {
// Sends an IR mark for the specified number of microseconds.
// The mark output is modulated at the PWM frequency.
long beginning = micros();
while(micros() - beginning < time){
digitalWrite(IRpin, xxx);
delayMicroseconds(halfPeriodicTime);
digitalWrite(IRpin, xxxx);
delayMicroseconds(halfPeriodicTime); //38 kHz -> T = 26.31 microsec (periodic time), half of it is 13
}
}


...and save the file gets errors in compiling

C:\Program Files (x86)\Arduino\libraries\IRremoteESP8266\IRremoteESP8266.cpp: In member function 'void IRsend::mark(int)':
C:\Program Files (x86)\Arduino\libraries\IRremoteESP8266\IRremoteESP8266.cpp:310:25: error: 'xxx' was not declared in this scope
digitalWrite(IRpin, xxx);
^
C:\Program Files (x86)\Arduino\libraries\IRremoteESP8266\IRremoteESP8266.cpp:312:25: error: 'xxxx' was not declared in this scope
digitalWrite(IRpin, xxxx);
^
Fehler beim Kompilieren.


so the IDE works correctly.

But hey.. sending IR codes still works.

if the code/library to be used in battery-powered devices, it would be better the LED would be off while "standbying"

@markszabo
Copy link
Collaborator

Well, if sending IR codes works, then you can simply turn of the led after sending with digitalWrite(2, HIGH).

Btw are you sure, that you also changed the library in the 321. line? It's in the function IRsend::space(int time) and it should be digitalWrite(IRpin, HIGH) for you (the default is LOW).

@xCite1986
Copy link

okay, i will try 👍

thanks for help and quick response

yes, line 321 was also HIGH

2016-01-26_20-34-42

@rajasekarsarangapani
Copy link

good day all,
i like to say thank you for this library creator and supporting members,
its decoding perfectly but ESP8266 Restarting, If receive continuous IR Signal ,
Iam using gpio13 to connect ir receiver(TSOP1738)

iam using samsung TV remote
page1
page2

@bragasil
Copy link

bragasil commented Jan 26, 2018

you can use esp-01 without problems (GPIO 2 = irsend(2)). just change irinverter to true (irsend.cpp) and add the lines below in setup (.ino) and use vcc default for IRemiter.
void setup() {
pinMode(2, OUTPUT);
digitalWrite(2, HIGH);
}

@crankyoldgit
Copy link
Owner

@bragasil Do you have a circuit diagram for your ESP-01 circuit that we can have so we can show ESP-01 users how to do this?

@crankyoldgit
Copy link
Owner

If you use the code in the master branch (or any release after v2.3.2)
You can do what @bragasil suggested by using the library as normal, but use/change your code to:

IRsend irsend(2, true);  // Use gpio 2 and invert the signal. i.e. Normally HIGH.
//  See https://github.com/markszabo/IRremoteESP8266/blob/master/src/IRsend.cpp#L27 for more details.

@bragasil
Copy link

remembering that at the time of uploading the firmware the led should not be connected. Another issue is that if the infrared led is low power, it is not necessary to use a drive or even a resistor.

Repository owner locked as resolved and limited conversation to collaborators Jun 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants