Nicu Hodos bd53ec9837 remove unused/redundant libraries:
- orphan .gitmodule for RF24
- Adafruit-GFX-Library-Tiny v1.2.2: it is the same as the official version of the same version
- Adafruit_LED_Backpack-Tiny v1.1.6: the only difference it is the
  inclusion of TinyWireM.h instead of Wire.h
2025-09-18 12:05:25 +02:00
..
2025-09-06 22:05:47 +02:00
2020-11-04 22:12:38 +01:00
2024-12-02 09:11:59 +01:00
2024-06-04 21:02:38 +02:00
2024-10-15 17:33:15 +02:00

A gateway for 433 MHz devices

It uses rc_switch library for controlling wall sockets.

It supports receiving:

  • serial commands for controlling wall switches - all protocols
  • RC commands from wall switches remotes - protocols 1 and 2
  • sensors states over Protocol 2

It acts as a serial gateway, communicating in JSON format, and it is connected to a Raspberry Pi running Home Assistant.

It uses an Arduino Pro Mini 5v 16 Mhz. The original bootloader has been replaced with Optiboot using this tutorial: https://andreasrohner.at/posts/Electronics/How-to-make-the-Watchdog-Timer-work-on-an-Arduino-Pro-Mini-by-replacing-the-bootloader/

Receive RC

Sensors

Sensors transmit state using Protocol 2 and the gateway translates them into JSON over serial.

Protocol structure
   STATE
     |
1010|1|101010101|1010101010101|10101
----|-----------|-------------|-----
TYPE|    VALUE  |     VCC     |  ID
Sensors types
enum SensorType : unsigned short {
	GENERIC = 4,
	HUMIDITY = 5,
	TEMPERATURE = 6,
	CONTACT = 7
};
Sensors IDs
enum SensorId : unsigned short {
	WINDOW1 = 1,
	WINDOW2 = 2,
	WATER_SENSOR = 3,
	TEMP_SENSOR = 4,
	LIGHT_SENSOR = 5,
	MOVEMENT_SENSOR = 6,
	OIL_SENSOR = 7
};

Stairs temperature

Value and voltage
{
  "sensor": {
    "id": 4,
    "diagnostic": {
      "voltage": 2.239
    },
    "temperature": 16.2
  }
}
Value only
{
  "sensor": {
    "id": 4,
    "temperature": 16.2
  }
}

Oil sensor

Value and voltage
{
  "sensor": {
    "id": 7,
    "diagnostic": {
      "voltage": 4.282
    },
    "value": 13
  }
}

Switches

Gateway receives remote commands over RC Switch and translates them into JSON over serial

Protocol 1

on
{
  "rcSwitch": {
    "protocol": 1,
    "state": true,
    "group": "1",
    "channel": 1,
    "raw_value": 5571921
  }
}
off
{
  "rcSwitch": {
    "protocol": 1,
    "state": false,
    "group": "1",
    "channel": 1,
    "raw_value": 5571921
  }
}

Protocol 2

{
  "rcSwitch": {
    "protocol": 2,
    "value": 2650807673
  }
}

Other protocols

{
  "rcSwitch": {
    "protocol": 4,
    "value": 1234567890
  }
}

DHT

Reads local DHT11 sensor and outputs JSON over serial

{
  "dht11": {
    "temperature": 31.9,
    "humidity": 45
  }
}

Receive commands

It receives commands over serial, in JSON format, and executes them.

Protocol 1

on
{
  "rcSwitch": {
    "protocol": 1,
    "group": "00001",
    "channel": 1,
    "state": true
  }
}
off
{
  "rcSwitch": {
    "protocol": 1,
    "group": "00001",
    "channel": 1,
    "state": false
  }
}

Protocol 2

{
  "rcSwitch": {
    "protocol": 2,
    "value": "10010110000000000001110101111001"
  }
}

Other protocols

{
  "rcSwitch": {
    "protocol": 4,
    "value": "010001101001100101110100"
  }
}