IR Transmitter

bibble235
Posts: 13
Joined: Mon May 28, 2018 11:23 pm

IR Transmitter

Postby bibble235 » Fri Jun 01, 2018 9:05 am

Hi,

I have bought

https://www.jaycar.us/arduino-compatibl ... e/p/XC4426

And want to run it on a ESP wroom 32

I am very new to all this but come from an IT background. I used the code below and cannot see the IR working with a digital phone which does show when I use a remote.

Code: Select all

int IRledPin = 17;

void setup() {

	pinMode(IRledPin, OUTPUT);
	Serial.begin(9600);
}



void loop() {
	delay(2000);
	SendNikonCode();
	Serial.println("Sending IR signal");
	delay(300);
}

void pulseIR(long microsecs) {

	cli();

	while (microsecs > 0) {
		digitalWrite(IRledPin, HIGH);
		delayMicroseconds(10);
		digitalWrite(IRledPin, LOW);
		delayMicroseconds(10);
		microsecs -= 26;
	}
	sei();
}

void SendNikonCode() {

	pulseIR(2080);
	delay(27);
	pulseIR(440);
	delayMicroseconds(1500);
	pulseIR(460);
	delayMicroseconds(3440);
	pulseIR(480);
	delay(65);
	pulseIR(2000);
	delay(27);
	pulseIR(440);
	delayMicroseconds(1500);
	pulseIR(460);
	delayMicroseconds(3440);
	pulseIR(480);
}
I have some questions
- is this the easiest way to test id the transmitter works?
- esp32 talks about IR, is there an on board IR
- is there a code sample for this
- what library should I use to get an IR transmitter to work


I assumed the middle pin is for the 5v as this was the case with the receiver. I does not show on the pinout but adding this to check I have not blown the transmitter.

I have got the receiver working so I am not a complete idiot but please be gentle with me.

Thanks all,

Iain

keckert
Posts: 8
Joined: Tue Apr 03, 2018 8:44 pm

Re: IR Transmitter

Postby keckert » Sun Jun 03, 2018 11:18 pm

I find very little useful information about that IR transmitter. The "datasheet" shows:
  • 5 volt operation
  • Two pins: signal and ground.
  • There is a place on the board to put a surface-mount resistor, but there is no resistor mounted there.
I would assume that this device is a bare IR LED. That does not match the description of it being a 5 volt device. Since the ESP32 operating voltage upper limit is 3.6 volts, your LED is not directly compatible with the ESP32. You can still use it if you have a level shifting amplifier circuit. See the two-resistor and one-transistor circuit in my GitHub:
https://github.com/kimeckert/ESP32-RMT- ... driver.png

The code at this site is an example of transmitting a simple pattern through the ESP32 RMT peripheral.
https://github.com/kimeckert/ESP32-RMT-server

The ESP32 has a smart IR driver circuit, the RMT. See the ESP32 documentation. The aforementioned GitHub example uses the RMT to transmit IR codes. Other sample code is at:
https://github.com/espressif/esp-idf/tr ... _nec_tx_rx
This is an example of the ESP32 decoding a hex value and sending the resulting pattern through the RMT.

The easiest way to test an IR LED is to look at it through a cell phone camera. You probably should not point the LED directly into your camera. You should be able to see the LED off-axis when the LED is forward biased.

fejess
Posts: 2
Joined: Sat Jul 07, 2018 4:07 pm

Re: IR Transmitter

Postby fejess » Wed Aug 22, 2018 11:48 am

Hello,

I'm working on the same thing, just in my case there is no way to use RMT.
gpio: 23,22,21,19,18,25,26,27 are for ETH
gpio: 16, 17 for hardware Serial (RS485)
uart1: gpio 9, 10 cant use.

But there is a gpio 32 as digital OUTPUT.
The same way as @bibble235 wrote it looks like working.
Successfully copyed a signal with logic analyser.

At the moment I waiting for prototype board to test the signal.

Searched in github, but nothing useful library for digitalWrite signal creator.

Have you found something already? Or I need to write a lib for this :/

fejes

Deouss
Posts: 425
Joined: Tue Mar 20, 2018 11:36 am

Re: IR Transmitter

Postby Deouss » Wed Aug 22, 2018 12:47 pm

Maybe this post will help

https://esp32.com/viewtopic.php?f=17&t=5960&p=25764

I worked recently on IR receive/send and had no issues using RMT.
It actually works very good with higher frequencies like 50-100khz
I'm not sure if you have to use any library but I was not using Arduino.
You have 8 RMT independent channels to use as infrared transceiver on esp.

mikemoy
Posts: 626
Joined: Fri Jan 12, 2018 9:10 pm

Re: IR Transmitter

Postby mikemoy » Wed Aug 22, 2018 12:51 pm

I assumed the middle pin is for the 5v as this was the case with the receiver. I does not show on the pinout but adding this to check I have not blown the transmitter.
They are using that board as dual purpose, that's why there are other placed for parts that are no on it.
You need to be using the circuit @keckert showed to drive it. That IR led cannot handle +5v directly.
Odds are if you shot +5v into it, you already toasted the IR led.

Who is online

Users browsing this forum: No registered users and 117 guests