IR Emitter

dev board Arduino UNO
chip ATmega328p
sensor infrared
features infrared IR emitter

Before starting

Dependancies

Ensure the following requirements are available:

Pre-requisites

Try these simpler examples:

Buy the components

Description

Get the HEX code to emit using the IR receiver program. This code contains both IR receiver and IR emitter logic.

Code

Download code
#include <IRLibAll.h>

IRrecvPCI myReceiver(2);  // Arduino UNO PIN 2
IRdecode myDecoder;

IRsend mySender;

void setup() {
  Serial.begin(9600);

  myReceiver.enableIRIn();
  Serial.println("Ready to receive IR signals...");

  Serial.println("Ready to receive character into the serial monitor...");
}

void loop() {
  if (myReceiver.getResults()) {
    myDecoder.decode();
    myDecoder.dumpResults(true);
    myReceiver.enableIRIn();
  }

  // Send a character into the serial monitor
  if (Serial.read() != -1) {
    // Decoded NEC(1): Value:CE01F Adrs:0 (32 bits)
    mySender.send(NEC, 0xce01f, 32);  // Get the HEX code with IR receiver
    Serial.println("Sent Eco Blank to the projector");
  }
}

Makefile

.PHONY: lint compile upload clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

compile:
	arduino-cli compile --fqbn arduino:avr:uno ./

upload:
	arduino-cli upload -p /dev/cu.usbmodem14* --fqbn arduino:avr:uno ./

clean:
	rm -f .*.hex
	rm -f .*.elf

flash: lint compile upload clean

Serial console

Serial output from the firmware.

IR Emitter serial console

Schematic

Wire up the hardware accordingly

IR Emitter schematic

Prototype

A photo of the actual setup.

IR Emitter prototype

References