IR signals at the UN

Hello everyone

Friday noon, 12 o'clock, 2 hours before my weekend:

Chef: "Hey Moritz, I still have to make an appointment and then I'm not back until Monday, you can take care of the projector problem and a blog post is still missing for today..."

Me: "What beamer problem?"

Chef: "Just look, see, until next week"

After a short search I was able to identify "the problem". Despite discreet signs, the last user does not appear to have turned off the beamer again:

So how do you ensure that the beamer is not only switched to standby with the remote control, but that it is disconnected from the mains (because of the connected peripherals) ?

With one

Attention! Working with mains voltage is reserved for electricians trained in Germany! There is a danger to life!

The idea:

To turn on the beamer, the wall switch is actuated and the device is connected to the mains. This is then in standby mode. To get an indication, the user selects the source via the remote control by pressing the corresponding button. After a short start time we have a picture.

If the user switches off the beamer via the remote control as usual, it should then be disconnected from the mains.

The library needed to work comfortably with the IR diodes:

https://github.com/z3t0/Arduino-IRremote

As usual, it can be loaded from Git as a *.zip file, and via Sketch -> Include library -> . Install ZIP Library... be integrated.

The wiring:

Un IR diode Relay module
Gnd Gnd Gnd
5v +
3.3V Vcc
D4 S
D11 Data

 

Since it is a bit more time-consuming to record the complete signal to decode and then match, we simply use the examples enclosed with the library. To do this, we open the iRrecvDemo.ino file and load it onto our microcontroller:

 

/*
 * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
 * An IR detector/demodulator must be connected to the input RECV_PIN.
 * Version 0.1 July, 2009
 * Copyright 2009 Ken Shirriff
 * http://arcfn.com
 */

#include <IRremote.H>

Int RECV_PIN = 11;

IRrecv irrecv(RECV_PIN);

decode_results Results;

Void Setup()
{   Serial.Begin(9600);   In case the interrupt driver crashes on setup, give a clue   to the user what's going on.   Serial.println("Enabling IRin");   irrecv.enableIRIn(); Start the receiver   Serial.println("Enabled IRin");
}

Void Loop() {   If (irrecv.Decode(&Results)) {     Serial.println(Results.Value, Hex);     irrecv.Resume(); Receive the next value   }   Delay(100);
}

 

After opening the serial monitor, when pressing the corresponding button on the remote control, we see:

The sketch returns us with a hex code: "CIAA09F6" This appears the "OFF" button of the remote control every time you press a button.

In principle, therefore, only an if loop is missing in the loop, which sets a pin to HIGH when the hex code is received.

Here is the modified code:

 

#include <IRremote.H>
Int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results Results;



Void Setup()

{   Serial.Begin(9600);   pinMode(4, Output);   Serial.println("Enabling IRin");   irrecv.enableIRIn();   digitalWrite(4, Low);   Serial.println("Enabled IRin");

}



Void Loop() {   If (irrecv.Decode(&Results)) {     Serial.println(Results.Value, Hex);         If(Results.Value == 0xC1AA09F6){ Enter 0x+Code here!         Serial.println("OFF detected");         digitalWrite(4, High);         Delay(100);
}     irrecv.Resume(); Receive the next value   }   Delay(100);

}

 

If the device is disconnected from the mains, the pin falls back to LOW. In order to switch the beamer on again, the switch on the wall must be switched off and then switched on again.

I wish all readers a nice weekend and a lot of fun tinkering.

 

For arduinoSpecials

5 comments

Heiko

Heiko

Hallo,
tolle Idee.
Habe bei mir das ganze mit einem Taster in der Wand. Ca. 2sec drücken damit der Arduino startet und ein Relais einschaltet zur selbserhaltung der Spannung und ein Relais für den Baemer.
Wenn die AUS Taste der Fernbedienung erkannt wird, schaltet der Arduino nach einer wartezeit zum abkühlen des Baemers, beide Relais aus und die ganze Anlage ist somit wieder Spannungslos.
Gruß Heiko

Matthias

Matthias

Hallo,
interessante Idee.

Noch eine Ergänzung: packt den Arduino gleich noch an dieselbe Steckdose wie den Beamer…

joedro

joedro

Wichtig ist auch zu sagen das es zwei unterschiedliche Typen des IR gibt.
Dort ist die Beschaltung der 3 Pins unterschiedlich.

Stefan Jaroni

Stefan Jaroni

Hallo,
nette Lösung. Würde allerdings über eine Verzögerung nachdenken. Zumindest bei den meisten älteren Beamern wird nach dem Ausschalten ein Nachlauf zum Abkühlen empfohlen. Das Bild ist dann zwar aus, aber der Lüfter läuft noch nach. Geht aber nur wenn der Beamer nicht gleich vom Netz getrennt wird. Also: Nach Empfang des „OFF“ Signals erst verzögert das Relais abfallen lassen. Sonst könnte Hitzetot des Beamers/ der Lampe drohen.
Gruß
Stefan

joedro

joedro

Über IR habe ich Rollos gesteuert.
Für die Auswertung des IR-Code wird nicht
results.value == 0xC1AA09F6
die volle Länge benötigt.
Es genügt das letzte Byte.

Leave a comment

All comments are moderated before being published

Recommended blog posts

  1. Install ESP32 now from the board manager
  2. Lüftersteuerung Raspberry Pi
  3. Arduino IDE - Programmieren für Einsteiger - Teil 1
  4. ESP32 - das Multitalent
  5. OTA - Over the Air - ESP programming via WLAN