Wireless connection to Fracarro CE3N wired alarm system

Hello everyone,
I would like to share my project to wirelessly connect a door sensor to an old Fracarro CE3N alarm control unit, for which wireless interfaces are no longer available.
For the Door Sensor, I used a Zigbee sensor, while for the interface with the Fracarro alarm system, I used an ESP32 DEVKIT V1 and a 5V channel relay module with optocoupler.

Unfortunately, I made a mistake in purchasing that relay because it needs a signal with a tension higher than 3 volts usually provided by the ESP32.

Nevertheless, I managed to interface it with the ESP32 with the help of a transistor and a resistor as per the diagram shown below.

In this way, the GPIO25 output drives the relay that closes the NA contact, triggering alarm Line 8 of my alarm control panel.
From the alarm control panel, I captured the ‘Alarm Inserted’ signal used as an input for GPIO 33.

This is the ESP32 YAML

 file
esphome:
  name: alarm-fracarro
  friendly_name: Allarme Fracarro

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:
#  baud_rate: 0

api:
  encryption:
    key: "TJEYGflebTRlPlvnklYiac+/66sVvLVPiN8z6mp4fMQ="
ota:
  password: "f8e4e900f5e202ca34915a3f7853d36b"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

captive_portal:   
web_server:
  port: 80
##### SEZIONE per LA PROGRAMMAZIONE dei PIN modificabile a piacere ######## 
binary_sensor:

######  gpio33 Stato Allarme -filo BLU ##########
 - platform: gpio
   pin:
     number: GPIO33
     mode: INPUT_PULLUP
     inverted: True
   name: "Stato Allarme"
   device_class: connectivity
   filters:
     - delayed_on_off: 100ms

switch:
  - platform: gpio
    pin: GPIO25
    id: relay
    name: "Attiva Allarme Porta Soffitto"
    icon: "mdi:door"
    on_turn_on:
    - delay: 35000ms
    - switch.turn_off: relay

Below is the automation that triggers the alarm if someone opens the door and, of course, if the alarm control panel is activated.

alias: Allarme Fracarro
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.alarm_fracarro_stato_allarme
    from: "off"
    to: "on"
condition:
  - condition: state
    entity_id: binary_sensor.porta_soffitto_apertura
    state: "on"
action:
  - service: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.alarm_fracarro_attiva_allarme_porta_soffitto
mode: single

As I said, the use of the transistor and the resistor helped me to drive the relay using the 5 volts voltage of the VIN pin of the ESP32.
I could have avoided all this if I had purchased a relay with a low driving voltage “5V Relay Module with Optocoupler Low Level Trigger”.

With this relay, the coupling between the ESP32 and the relay trigger would have been direct, without the need to use a transistor and a resistor, as below.

I hope this would help someone else.

1 Like

You were unlucky with your relay.
I have never had problems with random optocoupled relay boards triggered by Esp32.
But certain relay modules are difficult to understand. Those with separate JD-Vcc and Vcc have to be powered both +5V and IN is connected to Esp digital pin. These relays close when Esp pin is pulled low, so they have inverted logic.

You are right.
I was very disappointed when I tested them.