Hob2Hood - Control any kitchen hood with Electrolux/AEG hob

Hi. I'm completely new to the forum so please be forgiving.
I'm trying to make to work the Hob2Hood control module with relay module and this code - Arduino-Hob2Hood/Hob2Hood.ino at master · tuxedo0801/Arduino-Hob2Hood · GitHub

Code works Great but, my kitchen hood is a Little bit different - the buttons in my hood are pulse type - so I have been trying to modify the code so it will send only pulse by relays, not constantly ON oraz constantly OFF.

I Think this is the part where light relay is operated:

  // control light
  switch (light) {
    // Light OFF
    case 0:
      if (logLight) Serial.println("Light: OFF");
      digitalWrite(PIN_OUT_LIGHT, OFF);
      delay(10);
      break;
    // Light ON
    case 1:
      if (logLight) Serial.println("Light: ON");
      digitalWrite(PIN_OUT_LIGHT, ON);
      delay(10);
      break;
    default:
      break;
  }

With this code, relay module change to constantly ON when it receive the ON SIGNAL, and constantly OFF when receive the OFF SIGNAL.
I was trying to change it to make ON for 1 second, then back to OFF:

  // control light
  switch (light) {
    // Light OFF
    case 0:
      if (logLight) Serial.println("Light: OFF");
      digitalWrite(PIN_OUT_LIGHT, ON);
      delay(10);
      digitalWrite(PIN_OUT_LIGHT, OFF);
      delay(10);
      break;
    // Light ON
    case 1:
      if (logLight) Serial.println("Light: ON");
      digitalWrite(PIN_OUT_LIGHT, ON);
      delay(10);
      digitalWrite(PIN_OUT_LIGHT, OFF);
      delay(10);
      break;
    default:
      break;
  }

But this code completely breaks everything. Light relay sends pulse 3 times and it sends it even after receiving ventilation signal.
I do not know the C++ langugae so i was trying to modify code by intuition...

Can anyone help me with modyfing the code? The perfect code for me is like below:

SIGNAL RECEIVED - OPERATION

LIGHT ON SIGNAL - RELAY 1 PULSE
LIGHT OFF SIGNAL - RELAY 1 PULSE

VENTILATION OFF SIGNAL - RELAY 2 PULSE
VENTILATION 1 SIGNAL - RELAY 2 PULSE
VENTILATION 2 SIGNAL - RELAY 2 PULSE
VENTILATION 3 SIGNAL - RELAY 2 PULSE
VENTILATION 4 SIGNAL - RELAY 2 PULSE

And that's it. Simple ON/OFF pulse. I know it's not ideal but for me it's enough. Thank You for your time and help.

delay(10) means 10 ms delay. That may not even cause your relay to start reacting.

Try delay(1000) for a 1-second delay. And remember that a delay() call is blocking... actually, you're not allowed to use delay() to being with - at least not until you understand the why of that rule. After that, you're allowed to use the function at your leisure. Before, it's at your peril :slight_smile:

Hi! Thank you for your help. Yes, I’ve tried 1000 delay. It works but the relay is making On/Off 2 times (with delay 10 it makes it 3 times).

Even worse, after adding OFF line and 1000 delay to LIGHT relay is making pulse 2 times as a response for LIGHT SIGNAL and as a response for VENTILATION SIGNAL. I don’t understand why it moves light relay after VENTILATION SIGNAL?

For me it looks like the code “wants” to make the relay constantly ON - I added the OFF line but it tries to make it ON again and again for some time (even after receiving other signals, it tries to fix the error).

As I said - I’m am completely blue. I never ever coded anything and I’m trying only trial and error method.
If it helps, I can record a movie with every code.

It sounds to me (without having seen all of your code - HINT !) that you need to detect and take action when an input changes state from off to on rather than when it is on

See the StateChangeDetection example in the IDE

First of all, thank You for joining the Conversation. Second, below is the full code.

#include <IRremote.h>

/*
Siehe: http://knx-user-forum.de/forum/%C3%B6ffentlicher-bereich/knx-eib-forum/diy-do-it-yourself/37790-hob2hood-ir-protokoll-arduino/page2
Lüftung Stufe1 0xE3C01BE2
Lüftung Stufe2 0xD051C301
Lüftung Stufe3 0xC22FFFD7
Lüftung Stufe4 0xB9121B29
Lüftung Aus 0x55303A3
Licht An 0xE208293C
Licht Aus 0x24ACF947
*/

// IR commands from AEG hob2hood device
const long IRCMD_VENT_1 = 0xE3C01BE2;
const long IRCMD_VENT_2 = 0xD051C301;
const long IRCMD_VENT_3 = 0xC22FFFD7;
const long IRCMD_VENT_4 = 0xB9121B29;
const long IRCMD_VENT_OFF = 0x55303A3;
const long IRCMD_LIGHT_ON = 0xE208293C;
const long IRCMD_LIGHT_OFF = 0x24ACF947;

// Pins for input switches/controls for manual control of the hood
const int PIN_IN_VENT_1 = A0;
const int PIN_IN_VENT_2 = A1;
const int PIN_IN_VENT_3 = A2;
const int PIN_IN_VENT_4 = A3;
const int PIN_IN_LIGHT = A4;

// Pins for the output which controls relais which finally control the hood
const int PIN_OUT_VENT_1 = 2;
const int PIN_OUT_VENT_2 = 3;
const int PIN_OUT_VENT_3 = 4; // war: 4
const int PIN_OUT_VENT_4 = 5;
const int PIN_OUT_LIGHT = 6; // war: 6
const int PIN_OUT_EXT1 = 7;
const int PIN_OUT_EXT2 = 8;
const int PIN_OUT_EXT3 = 9;

// IR Receiver PIN
const int PIN_IR_RECEIVER = 11;

const int MODE_HOB2HOOD = 0;
const int MODE_MANUAL = 1;

// ventilation, light and mode status
int ventilation = 0;
int last_ventilation = 0;
int light = 0;
int last_light = 0;
int mode = 0; // 0 = hob2hood control, 1 = manual control

IRrecv irrecv(PIN_IR_RECEIVER); // create instance of 'irrecv'
decode_results results;

#define OFF HIGH
#define ON LOW

void setup() {
  // Setup relay-outputs
  pinMode(PIN_OUT_VENT_1, OUTPUT);
  pinMode(PIN_OUT_VENT_2, OUTPUT);
  pinMode(PIN_OUT_VENT_3, OUTPUT);
  pinMode(PIN_OUT_VENT_4, OUTPUT);
  digitalWrite(PIN_OUT_VENT_1, OFF);
  digitalWrite(PIN_OUT_VENT_2, OFF);
  digitalWrite(PIN_OUT_VENT_3, OFF);
  digitalWrite(PIN_OUT_VENT_4, OFF);


  pinMode(PIN_OUT_LIGHT, OUTPUT);
  pinMode(PIN_OUT_EXT1, OUTPUT);
  pinMode(PIN_OUT_EXT2, OUTPUT);
  pinMode(PIN_OUT_EXT3, OUTPUT);

  // define startup-state

  digitalWrite(PIN_OUT_LIGHT, ON);
  digitalWrite(PIN_OUT_LIGHT, OFF);
  digitalWrite(PIN_OUT_EXT1, OFF);
  digitalWrite(PIN_OUT_EXT2, OFF);
  digitalWrite(PIN_OUT_EXT3, OFF);

  Serial.begin(9600); // for serial monitor output
  Serial.println("Hob2Hood Starting ...");

  Serial.println(" ... Setup IR receiver");
  irrecv.enableIRIn(); // Start the IR receiver
  Serial.println("Hob2Hood ready ...");
}

void loop() {

  // read manual control inputs
  int inLight = analogRead(PIN_IN_LIGHT);
  int inVentilation1 = analogRead(PIN_IN_VENT_1);
  int inVentilation2 = analogRead(PIN_IN_VENT_2);
  int inVentilation3 = analogRead(PIN_IN_VENT_3);
  int inVentilation4 = analogRead(PIN_IN_VENT_4);


  // if any of the manual control inputs is IN USE (analog value >512) --> manual mode
  if (inLight >= 512 ||
      inVentilation1 >= 512 ||
      inVentilation2 >= 512 ||
      inVentilation3 >= 512 ||
      inVentilation4 >= 512 ) {

    if (mode == MODE_HOB2HOOD) {
      Serial.println("Switching to manual mode");
    }

    mode = MODE_MANUAL;

    if (inLight > 512) {
      // Beleuchtung einschalten:
      last_light = light;
      light = 1;
    } else {
      // Beleuchtung ausschalten:
      last_light = light;
      light = 0;
    }

    if (inVentilation1 > 512) {
      // set ventilation speed 1
      last_ventilation = ventilation;
      ventilation = 1;
    } else if (inVentilation2 > 512) {
      // set ventilation speed 2
      last_ventilation = ventilation;
      ventilation = 2;
    } else if (inVentilation3 > 512) {
      // set ventilation speed 3
      last_ventilation = ventilation;
      ventilation = 3;
    } else if (inVentilation4 > 512) {
      // set ventilation speed 4
      last_ventilation = ventilation;
      ventilation = 4;
    } else {
      // set ventilation off
      last_ventilation = ventilation;
      ventilation = 0;
    }

    controlHood();

  } else {

    // now we are in HOB2HOOD-mode, because no manual control is in use

    // check for previous mode
    if (mode == MODE_MANUAL) {
      Serial.println("Switching to Hob2Hood mode");
      // set to initial state
      ventilation = 0;
      light = 0;
      controlHood();

      // and switch to hob2hood mode
      mode = MODE_HOB2HOOD;
      irrecv.resume();
    }
    receiveIRCommand();
  }

}

// Receive and decode IR commands and control hood upon received command
void receiveIRCommand() {

  // have we received an IR signal?
  if (irrecv.decode(&results)) {

    Serial.println("Received IR command: ");
    Serial.println(results.value, HEX); // display it on serial monitor in hexadecimal

    switch (results.value) {

      case IRCMD_LIGHT_ON:
        light = 1;
        break;

      case IRCMD_LIGHT_OFF:
        light = 0;
        break;

      case IRCMD_VENT_1:
        ventilation = 1;
        break;

      case IRCMD_VENT_2:
        ventilation = 2;
        break;

      case IRCMD_VENT_3:
        ventilation = 3;
        break;

      case IRCMD_VENT_4:
        ventilation = 4;
        break;

      case IRCMD_VENT_OFF:
        ventilation = 0;
        break;

      default:
        break;
    }

    controlHood();
    irrecv.resume(); // receive the next value
  }
}

// control hood based on 'light' and 'ventilation' variables
void controlHood() {

  bool logLight = light!=last_light;
  bool logVent = ventilation!=last_ventilation;
  

  // control light
  switch (light) {
    // Light OFF
    case 0:
      if (logLight) Serial.println("Light: OFF");
      digitalWrite(PIN_OUT_LIGHT, OFF);
      delay(10);
      break;
    // Light ON
    case 1:
      if (logLight) Serial.println("Light: ON");
      digitalWrite(PIN_OUT_LIGHT, ON);
      delay(2000);
      digitalWrite(PIN_OUT_LIGHT, OFF);
      delay(2000);
      break;
    default:
      break;
  }

  // control ventilation
  switch (ventilation) {

    // Ventilation OFF
    case 0:
      if (logVent) Serial.println("Ventilation: OFF");
      digitalWrite(PIN_OUT_VENT_1, OFF);
      digitalWrite(PIN_OUT_VENT_2, OFF);
      digitalWrite(PIN_OUT_VENT_3, OFF);
      digitalWrite(PIN_OUT_VENT_4, OFF);
      delay(10);
      break;

    // Ventilation Speed 1
    case 1:
      if (logVent) Serial.println("Ventilation: 1");
      digitalWrite(PIN_OUT_VENT_2, OFF);
      digitalWrite(PIN_OUT_VENT_3, OFF);
      digitalWrite(PIN_OUT_VENT_4, OFF);
      delay(100);
      digitalWrite(PIN_OUT_VENT_1, ON);
      delay(10);

      delay(10);
      break;

    // Ventilation Speed 2
    case 2:
      if (logVent) Serial.println("Ventilation: 2");
      digitalWrite(PIN_OUT_VENT_1, OFF);
      digitalWrite(PIN_OUT_VENT_3, OFF);
      digitalWrite(PIN_OUT_VENT_4, OFF);
      delay(100);
      digitalWrite(PIN_OUT_VENT_2, ON);
      delay(10);
      break;

    // Ventilation Speed 3
    case 3:
      if (logVent) Serial.println("Ventilation: 3");
      digitalWrite(PIN_OUT_VENT_1, OFF);
      digitalWrite(PIN_OUT_VENT_2, OFF);
      digitalWrite(PIN_OUT_VENT_4, OFF);
      delay(100);
      digitalWrite(PIN_OUT_VENT_3, ON);
      delay(10);
      break;

    // Ventilation Speed 4
    case 4:
      if (logVent) Serial.println("Ventilation: 4");
      digitalWrite(PIN_OUT_VENT_1, OFF);
      digitalWrite(PIN_OUT_VENT_2, OFF);
      digitalWrite(PIN_OUT_VENT_3, OFF);
      delay(100);
      digitalWrite(PIN_OUT_VENT_4, ON);
      delay(10);
      break;

    default:
      break;

  }
  
  last_light = light;
  last_ventilation = ventilation;
  
}

What I have understood from Your post, is that I have to look for the solution in the different part of the code.
I was trying to make changes in this part, but nothing really happened:

// Receive and decode IR commands and control hood upon received command
void receiveIRCommand() {
  // have we received an IR signal?
  if (irrecv.decode(&results)) {
    Serial.println("Received IR command: ");
    Serial.println(results.value, HEX); // display it on serial monitor in hexadecimal
    switch (results.value) {
      case IRCMD_LIGHT_ON:
        light = 1;
        break;
      case IRCMD_LIGHT_OFF:
        light = 0;
        break;

Why are you doing an analogRead() to get the state of a switch, instead of a digitalRead()? (note: analog pins A0-A5 are really digital pins that happen to have analog input ability as well; A6 and A7 are analog in only).

How are those switches even wired? You don't use the internal pull-up resistor, so there must be an external one. Based on your code, that would probably be a pull-down resistor.

There is code in there for an IR receiver, but it doesn't seem to be used.

Start with one button and one relay, get that to work. Then add the rest of the buttons. Simplifying the project often helps a lot when trying to get it to work.

lonek_rwl:
What I have understood from Your post, is that I have to look for the solution in the different part of the code.

As a rule, the problem is in the part you didn't post...

I attached the schematic of my project. With original code everything works Great.

I need to change only one thing - Relays must do PULSE instead of CONSTANTLY ON/CONSTANTLY OFF

so, for example i changed the code of LIGHT control:

// control hood based on 'light' and 'ventilation' variables
void controlHood() {

  bool logLight = light!=last_light;
  bool logVent = ventilation!=last_ventilation;
  

  // control light
  switch (light) {
    // Light OFF
    case 0:
      if (logLight) Serial.println("Light: OFF");
      digitalWrite(PIN_OUT_LIGHT, ON);
      delay(1000);
      digitalWrite(PIN_OUT_LIGHT, OFF);
      delay(1000);
      break;
    // Light ON
    case 1:
      if (logLight) Serial.println("Light: ON");
      digitalWrite(PIN_OUT_LIGHT, ON);
      delay(1000);
      digitalWrite(PIN_OUT_LIGHT, OFF);
      delay(1000);
      break;
    default:
      break;
  }

But the code is gone mad. Insted of simply make ON - 1sec Delay - OFF it makes it 2-3 times. But worst part is that suddenly it makes it every time it receives other codes - when I send VENTILATION 1 signal it firstly make 2-3 times LIGHT ON/OFF and then VENTILATION 1.

That snippet comes with various variables that are obviously declared elsewhere. So there's no clue on how it's called, and what those variables are set to.

Again, the problem is in the part you didn't post...

For starters, are you sure you can reliably and correctly receive the commands sent to that IR receiver? (i.e. have it simply printed to the Serial monitor).

I've checked the receiving commands and found out that hob is sanding every signal 6 times - which explains why arduino is reacting with pulse signal 2 or 3 times!
I've updated the code like this:

// control hood based on 'light' and 'ventilation' variables
void controlHood() {

  bool logLight = light!=last_light;
  bool logVent = ventilation!=last_ventilation;
  

  // control light
  switch (light) {
    // Light OFF
    case 0:
      if (logLight) Serial.println("Light: OFF");
      digitalWrite(PIN_OUT_LIGHT, ON);
      delay(100);
      digitalWrite(PIN_OUT_LIGHT, OFF);
      delay(4000);
      break;
    // Light ON
    case 1:
      if (logLight) Serial.println("Light: ON");
      digitalWrite(PIN_OUT_LIGHT, ON);
      delay(100);
      digitalWrite(PIN_OUT_LIGHT, OFF);
      delay(4000);
      break;
    default:
      break;
  }

  // control ventilation
  switch (ventilation) {

    // Ventilation OFF
    case 0:
      if (logVent) Serial.println("Ventilation: OFF");
      digitalWrite(PIN_OUT_VENT_1, ON);
      delay(100);
      digitalWrite(PIN_OUT_VENT_1, OFF);
      delay(4000);
      break;

    // Ventilation Speed 1
    case 1:
      if (logVent) Serial.println("Ventilation: 1");
      digitalWrite(PIN_OUT_VENT_1, ON);
      delay(100);
      digitalWrite(PIN_OUT_VENT_1, OFF);
      delay(4000);
      break;

    // Ventilation Speed 2
    case 2:
      if (logVent) Serial.println("Ventilation: 2");
      digitalWrite(PIN_OUT_VENT_2, ON);
      delay(100);
      digitalWrite(PIN_OUT_VENT_2, OFF);
      delay(4000);
      break;

    // Ventilation Speed 3
    case 3:
      if (logVent) Serial.println("Ventilation: 3");
      digitalWrite(PIN_OUT_VENT_3, ON);
      delay(100);
      digitalWrite(PIN_OUT_VENT_3, OFF);
      delay(4000);
      break;

    // Ventilation Speed 4
    case 4:
      if (logVent) Serial.println("Ventilation: 4");
      digitalWrite(PIN_OUT_VENT_4, ON);
      delay(100);
      digitalWrite(PIN_OUT_VENT_4, OFF);
      delay(4000);
      break;

    default:
      break;

  }
  
  last_light = light;
  last_ventilation = ventilation;
  
}

Now relay is sanding pulse and is blocked for other signals for 4 seconds. That solves my first problem! Thank You!

Still remains second problem - Now Arduino always reacts firstly with LIGHT RELAY pulse, after receiving other signals.
As I said, i've checked the received commands and I'm sure that hob is not sanding LIGHT ON signal every time before other signals. Screenshot from monitor:

Zrzut ekranu 2021-01-10 o 13.23.59.png

EDIT:
I've Just realized, with this code Arduino is reacting to EVERY ir Signal - for my old SONY remote control too... - and is repeating last action...

Zrzut ekranu 2021-01-10 o 13.23.59.png

I give up...
please help. After adding this line:

digitalWrite(PIN_OUT_LIGHT, OFF);
delay(5000);

here:

case 1:
if (logLight) Serial.println("Light: ON");
digitalWrite(PIN_OUT_LIGHT, ON);
delay(100);
digitalWrite(PIN_OUT_LIGHT, OFF);
delay(5000);
break;

The relay is turning ON and OFF, BUT something is wrong because after that, code is trying to make the light ON after receiving any IR signal (even signals not included to the code).
It looks like code is checking the state of the relay and find out that light should be ON instead of OFF and tries to make it ON.

Can You please help me find out where in the code is part about checking the state? How to turn it off.
full code here - full code

it's time for the minimal example. Trim your code down to the absolute minimum that still demonstrates the problem at hand. Chances are that by doing so you will find the problem by yourself.

Very likely you do not get rid of the 2nd to 6th instance the IR signal is transmitted just by adding a delay. The codes will be received and just end up in a buffer until you come back to it and read them again.

It sounds like time to take a breath.
You have tha basics working, but need to understand the environment you’re working in.

Slow down.
Read about delay(), it’s not your friend.
Understand ‘states’ in your case they’re not just ON or OF... they transition from one to the other...
With the IR, and indeed push buttons, the input may occur multiple times, you need to understand ‘why’, and how to identify which events are important.

It’s a good project to learn with, but you need to learn, not just ‘do’.

wvmarle:
it's time for the minimal example. Trim your code down to the absolute minimum that still demonstrates the problem at hand. Chances are that by doing so you will find the problem by yourself.

I'll will try this today.

wvmarle:
Very likely you do not get rid of the 2nd to 6th instance the IR signal is transmitted just by adding a delay. The codes will be received and just end up in a buffer until you come back to it and read them again.

That's brilliant! I've checked how many times code is turning Light ON after receiving wrong codes (I was hoping that it will do it 5 times - 1st proper read and 5 in buffer - Hob is sending codes 6 times ) but it turns out it make it forever...:

Quick observation…
You don’t ‘just ignore’ the repeated codes, you should read them until you get two or three consecutive identical messages then you can be sure the ‘single’ message wasn’t corrupted during transmission, and ‘ignore’ the rest, unless it’s a repeating command.
Typically three consecutive occurrences is sufficient. The extras are ‘just in case’, e.g. you’re waving the transmitter around, or a flash of sunlight added a bit’ to the received data.

lastchancename:
Quick observation...
You don’t ‘just ignore’ the repeated codes, you should read them until you get two or three consecutive identical messages then you can be sure the ‘single’ message wasn’t corrupted during transmission, and ‘ignore’ the rest, unless it’s a repeating command.
Typically three consecutive occurrences is sufficient. The extras are ‘just in case’, e.g. you’re waving the transmitter around, or a flash of sunlight added a bit’ to the received data.

Thanks for Your advice. I've updated the screenshot from monitor.

After 1 TRULY CORRECT IR Signal, Code is misreading the WRONG IR signals (not included to the code) as a CORRECT IR signals. At this point I completely do not understand WHY?

Today I'll try to crop the code to the absolute minimum.

Probably a good time to post your latest updated code.

I DID IT! No experience, no knowledge and I did it!

As you advised, I cropped the code as much as it was still working, and still was working bad. It turns out i deleted 80% of the code and it was still working.
Then I found THIS artcile about steering the LED with IR Signal with a simple example of the code:

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

#include <IRremote.h>
#define irPin 8
IRrecv irrecv(irPin);
decode_results results;

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

pinMode(11, OUTPUT);
}

void loop() {
if (irrecv.decode(&results)) {

switch (results.value) {
case <tutaj wpisz kod przycisku który ma zapalać diode>;
digitalWrite(9, HIGH);
break;
switch (results.value) {
case <tutaj wpisz kod przycisku który ma gasić diode>;
digitalWrite(9, LOW);
break;

}

irrecv.resume();
}
}

I’ve changed my code to looks more like from the example - transfered SWITCH CASE from VOID CONTROLHOOD to VOID LOOP, deleted CASE NAMES and replace them with raw IR CODES and deleted all of the things with “=” or “!=” which as I understand was checking and fixing the STATES of the SWITCHES.

Code looks like this and is the most beautiful thing I ever wrote! I’m excited beacuse I’m actual understand every line of this code (or I Think i understand :))

#include <IRremote.h>
                                                                                                 
/* IR commands from hob2hood device
VENTILATION SPEED 1 = 0xE3C01BE2;
VENTILATION SPEED 2 = 0xD051C301;
VENTILATION SPEED 3 = 0xC22FFFD7;
VENTILATION SPEED 4 = 0xB9121B29;
VENTILATION OFF     = 0x55303A3;
LIGHT ON            = 0xE208293C;
LIGHT OFF           = 0x24ACF947;
*/

// Pins for the output which controls relais which finally control the hood
const int PIN_OUT_LIGHT_POWER = 2;
const int PIN_OUT_VENT_POWER = 3;

// IR Receiver PIN
const int PIN_IR_RECEIVER = 11;

IRrecv irrecv(PIN_IR_RECEIVER); // create instance of 'irrecv'
decode_results results;

void setup() {
  
  // Setup relay-outputs
  pinMode(PIN_OUT_LIGHT_POWER, OUTPUT);
  pinMode(PIN_OUT_VENT_POWER, OUTPUT);
  
  // define startup-state
  digitalWrite(PIN_OUT_LIGHT_POWER, HIGH);
  digitalWrite(PIN_OUT_VENT_POWER, HIGH);

  // for serial monitor output
  Serial.begin(9600);

  // Start the IR receiver
  irrecv.enableIRIn();
  
  Serial.println("Hob2Hood ready ...");
}

void loop() { 

  // have we received an IR signal?
  if (irrecv.decode(&results)) {
    
  Serial.println("Received IR command: ");
  Serial.println(results.value, HEX);     // display it on serial monitor in hexadecimal
  
    switch (results.value) {
      case 0xE208293C:
        Serial.println("LIGHT: POWER ON/OFF");
        digitalWrite(PIN_OUT_LIGHT_POWER, LOW);
        delay(100);
        digitalWrite(PIN_OUT_LIGHT_POWER, HIGH);
        delay(4000);
        break;
    }
    
    switch (results.value) {
      case 0xE3C01BE2:
        Serial.println("LIGHT: VENTILATION ON/OFF");
        digitalWrite(PIN_OUT_VENT_POWER, LOW);
        delay(100);
        digitalWrite(PIN_OUT_VENT_POWER, HIGH);
        delay(4000);
        break;
    }
    
    irrecv.resume(); // receive the next value
  }
}

If you’re only using Serial for debug/status messages, bump it up to 115200 ( same with your terminal program) then the processor will spend less time thinking about the serial comms.

The delay()s are less than desirable esp. the 4000, but in this project shoukd be ok ok...

Now that you have it working, you can explore the various improvements that have been discussed (remember to save your working code !)

good work sticking at it.

Quick update. I’ve connected relais to to the hood switches and everything is working.
I’ve realized that my hood have additional option to operate by a 433,92 MHz remote control (which was hidden deep in the “drawer with everything”). I ordered radio transmitter + receiver and I will try to operate hood by radio - it’s easier because it’s doesn’t need soldering.

Once again I need Your guidance.
I’ve tried to operate hood by 433 MHz transmitter and everything Works fine with this Code (it Just sends Command every second):

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {

 Serial.begin(9600);

 // Transmitter is connected to Arduino Pin #10 
 mySwitch.enableTransmit(10);

 // Optional set pulse length.
 mySwitch.setPulseLength(400);

 // set protocol (default is 1, will work for most outlets)
 mySwitch.setProtocol(11);

 // Optional set number of transmission repetitions.
 //mySwitch.setRepeatTransmit(20);

 pinMode(13,OUTPUT);

}

void loop() {
 mySwitch.send("0111111110111011");
 Serial.println("LIGHT: ON");
 digitalWrite(13,HIGH);
 delay(400);
 digitalWrite(13,LOW);
 delay(1000);


 mySwitch.send("0111111100111011");
 Serial.println("VENTILATION: 1");
 digitalWrite(13,HIGH);
 delay(400);
 digitalWrite(13,LOW);
 delay(1000);


 mySwitch.send("0111111010111011");
 Serial.println("VENTILATION: 2");
 digitalWrite(13,HIGH);
 delay(400);
 digitalWrite(13,LOW);
 delay(1000);


 mySwitch.send("0111111000111011");
 Serial.println("VENTILATION: 3");
 digitalWrite(13,HIGH);
 delay(400);
 digitalWrite(13,LOW);
 delay(1000);
 

 mySwitch.send("0111110110111011");
 Serial.println("VENTILATION: 4");
 digitalWrite(13,HIGH);
 delay(400);
 digitalWrite(13,LOW);
 delay(1000);


 mySwitch.send("0111111110111011");
 Serial.println("VENTILATION: OFF");
 digitalWrite(13,HIGH);
 delay(400);
 digitalWrite(13,LOW);
 delay(1000);

 mySwitch.send("0111111111111011");
 Serial.println("LIGHT: OFF");
 digitalWrite(13,HIGH);
 delay(400);
 digitalWrite(13,LOW);
 delay(1000);

}

Next thing should be easy, Just modify my Code to send the RF Command instead of relay pulse after receiving IR Signal from hob:

#include <IRremote.h>
#include <RCSwitch.h>
                                                                                                 
/* 

IR commands from hob device
VENTILATION SPEED 1 = 0xE3C01BE2;
VENTILATION SPEED 2 = 0xD051C301;
VENTILATION SPEED 3 = 0xC22FFFD7;
VENTILATION SPEED 4 = 0xB9121B29;
VENTILATION OFF     = 0x55303A3;
LIGHT ON            = 0xE208293C;
LIGHT OFF           = 0x24ACF947;

RF Commands to hood device:
VENT: OFF
Decimal: 32763 (16Bit) 
Binary: 0111111110111011 
Tri-State: not applicable 
PulseLength: 395 microseconds 
Protocol: 11
Raw data: 14220,560,92,624,664,304,664,304,664,304,664,304,668,300,668,300,668,300,668,300,280,36,272,64,48,164,144,704,252,76,224,144,136,

VENT: 1
Decimal: 32635 (16Bit) 
Binary: 0111111100111011 
Tri-State: not applicable 
PulseLength: 392 microseconds 
Protocol: 11
Raw data: 14228,556,92,624,668,304,660,308,660,304,664,304,476,68,488,16,200,468,36,360,428,92,152,16,160,304,44,288,244,116,200,172,76,

VENT: 2
Decimal: 32507 (16Bit)
Binary: 0111111010111011
Tri-State: not applicable 
PulseLength: 395 microseconds 
Protocol: 11
Raw data: 14224,312,336,28,568,28,424,16,1080,52,92,456,52,112,484,52,188,568,40,492,72,140,1028,44,248,884,140,644,108,124,56,20,436,

VENT: 3
Decimal: 32379 (16Bit) 
Binary: 0111111000111011 
Tri-State: not applicable 
PulseLength: 395 microseconds 
Protocol: 11
Raw data: 14224,312,340,624,2088,56,576,112,176,244,96,96,36,68,216,108,20,432,16,184,420,96,180,36,84,232,40,16,48,28,204,108,732,

VENT : 4
Decimal: 32251 (16Bit) 
Binary: 0111110110111011 
Tri-State: not applicable 
PulseLength: 395 microseconds 
Protocol: 11
Raw data: 14224,312,340,48,228,32,480,24,20,240,32,40,16,56,164,148,408,108,44,552,80,16,52,28,896,120,904,268,32,664,68,28,264,

LIGHT: ON
Decimal: 32187 (16Bit) 
Binary: 0111111110111011 
Tri-State: not applicable 
PulseLength: 395 microseconds 
Protocol: 11
Raw data: 14228,556,92,628,660,308,664,308,660,312,656,304,668,304,344,616,668,300,672,296,352,616,672,296,672,296,672,296,352,44,16,24,40,

LIGHT: OFF
Decimal: 32251 (16Bit) 
Binary: 0111111111111011 
Tri-State: not applicable 
PulseLength: 395 microseconds 
Protocol: 11
Raw data: 14224,556,92,628,660,308,664,308,664,304,660,304,664,308,344,620,668,300,668,296,668,128,196,124,252,700,136,124,244,32,224,264,56,
*/

// IR Receiver PIN
const int PIN_IR_RECEIVER = 2;

RCSwitch mySwitch = RCSwitch();
IRrecv irrecv(PIN_IR_RECEIVER); // create instance of 'irrecv'
decode_results results;

void setup() {
  
  Serial.begin(9600);
  Serial.println("Hob2Hood ready ...");
  mySwitch.enableTransmit(10);
  mySwitch.setPulseLength(400);
  mySwitch.setProtocol(11);
  mySwitch.setRepeatTransmit(15);
  pinMode(13, OUTPUT);
  irrecv.enableIRIn();
 
}

void loop() { 
  
  // have we received an IR signal?
  if (irrecv.decode(&results)) {
    
  Serial.println("Received IR command: ");
  Serial.println(results.value, HEX);     // display it on serial monitor in hexadecimal
  
    switch (results.value) {

      case 0xE208293C:

        mySwitch.send("0111111110111011");
        Serial.println("SEND RF: LIGHT ON");
        digitalWrite(13,HIGH);
        delay(400);
        digitalWrite(13,LOW);
        delay(1000);
        break;
        
    
      case 0x24ACF947:
        
        mySwitch.send("0111111111111011");
        Serial.println("SEND RF: LIGHT OFF");
        digitalWrite(13,HIGH);
        delay(400);
        digitalWrite(13,LOW);
        delay(1000);
        break;
     
    
      case 0xE3C01BE2:
       
        mySwitch.send("0111111100111011");
        Serial.println("SEND RF: VENTILATION 1");
        digitalWrite(13,HIGH);
        digitalWrite(13,LOW);
        break;
 
       
      case 0xD051C301:
        
        mySwitch.send("0111111010111011");
        Serial.println("SEND RF: VENTILATION 2");
        digitalWrite(13,HIGH);
        delay(400);
        digitalWrite(13,LOW);
        delay(1000);
        break;
        
        
      case 0xC22FFFD7:
        mySwitch.send("0111111000111011");
        Serial.println("SEND RF: VENTILATION 3");
        digitalWrite(13,HIGH);
        delay(400);
        digitalWrite(13,LOW);
        delay(1000);
        break;
        
        
      case 0xB9121B29:
        mySwitch.send("0111110110111011");
        Serial.println("SEND RF: VENTILATION 4");
        digitalWrite(13,HIGH);
        delay(400);
        digitalWrite(13,LOW);
        delay(1000);
        break;
        
       
      case 0x55303A3:
        mySwitch.send("0111111110111011");
        Serial.println("SEND RF: VENTILATION OFF");
        digitalWrite(13,HIGH);
        delay(400);
        digitalWrite(13,LOW);
        delay(1000); 
        break;
        
    }
    
    irrecv.resume(); // receive the next value
  }   
}

BUT
suddenly the hood is not reacting to the RF COMMANDS and I have no idea why. I’ve Just copied them from previous, working Code.
With previous Code where Arduino is sending commands every 1 second, it works for 100%.
Please advice me.