Kaldek / rat-ratgdo

Open source schematics for ratgdo PCB
MIT License
330 stars 53 forks source link

Setup with ESP WROOM 32 #3

Closed rohinrohin closed 11 months ago

rohinrohin commented 11 months ago

Hey @Kaldek!

Great job on this repo and for constantly updating the instructions! I am in process of setting this up and would appreciate your help on this.

I have a ESP WROOM 32, pinout here. (sorry about the amazon links)

I was wondering if there were any nuances that would make my installation steps a bit different?

I noticed on the pinout of this board vs the D1 mini

I was curious if I was on the right track with the pinout mapping and how this changes things. Also side note, I was not able to find the IRL mosfet easily, have ordered it but I am using the 2n7000 for now.

Thanks and looking forward to your response!

rohinrohin commented 11 months ago

@vaidehi-joshi the "Collision Detected, waiting to send packet" means that the red signal wire has been pulled low when the TX line is wanting to transmit. As it is half duplex, you cannot transmit whilst the red wire has been pulled low.

You should never see the collision message. Since I've had the PCB working, I have never seen it.

Thanks for that, my unit is one of these ones

You didn't attach an image. What model GDO do you have? Please check Paul Wieland's Wiki article on supported models. Yours might be Security+ 1.0. https://github.com/PaulWieland/ratgdo/wiki

If yours is Security+ 1.0 you won't be able to use ESPHome and will have to run native ratgdo. image

For Security+ 1.0 you apparently must use the D1, D2, D7 pin layout (not D2, D4, D7).

Sorry for being MIA! Thanks a ton @Kaldek, @rlowens, @sanjay900 for your updates.

This is possible the issue, I have confirmed that we are indeed on Security+ 1.0, will loop back here once we verify with the native firmware.

Once done, @vaidehi-joshi and I will summarize all of our learnings till now (including compiling with ESPHome, Security.., and many other nuances that we came across).

sanjay900 commented 11 months ago

It is Security+ not sure how to check if it's Security+ 1.0 or Security+ 2.0.

If it doesn't say 2.0, it is 1.0. Also, this page says your purple Learn button indicates Security+ 1.0.

Can we still run it on our ESP8266?

Yes, just not the ESPHome version of the firmware (yet). Have to use the MQTT version of the firmware, since they haven't added the Security+ 1.0 and Dry Contact code to the ESPHome firmware (Paul mentioned they are still ironing out some bugs).

FYI my unit didnt mention anything about what security version it uses, and it was one of those ones with the green serial port and was in fact security+ 2.0

I have a CS110MYQ

ccutrer commented 11 months ago

I have an ESP32-DevKitC (pinout: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/_images/esp32-devkitC-v4-pinout.png). I built my rat-ratgdo yesterday with the recommended 2n7000 and IRLB8721 transistors, the flashed it. I had to adjust the pins from https://github.com/ratgdo/esphome-ratgdo/blob/main/static/v2board_esp32_lolin_s2_mini.yaml slightly to match the wiring diagram at https://github.com/Kaldek/rat-ratgdo/blob/main/schematics/ratgdo%20open%20source%20ESP-32_schem_v4.png. And I also had to just completely download the base.yml and modify it since I don't actually use home assistant, and I didn't feel like configuring the dry contact relay pins unnecessarily. I'm using USB power for now, with an 8500W jackshaft opener (should be Security+ 2.0). Hooking it up this morning and enabling debug logging, it fails to sync, and I can't send any commands to the opener (logs indicate the command was received from MQTT, and the rolling_code_counter increases, but nothing happens), but I get full feedback from actions triggered by other means - current door state, motion detected by control panel, button pressed at control panel, calibrated current position percentage, etc. So it seems that writing to the bus is failing for me. I suspect I didn't connect the IRLB8721 correctly. I'm pretty good at soldering and using resistors for a few things, but transistors elude me, and definitely am unsure how to read them in a circuit diagram. I was going by the datasheet showing (with the heat sync oriented towards the back) pin 1 as gate (connects to TX pin - GPIO16 for me, along with 10k pulldown resistor to ground), pin 2 as drain (to red wire from opener), and pin 3 as source (ground). Attaching photo of my completed board with behind-the-board connections drawn on , as well as my ESPhome config:

IMG_4829 IMG_4830

single_car_gdo.yaml:

substitutions:
  name: single-car-gdo
  friendly_name: Single Car Garage Door Opener
  id_prefix: gdo
  uart_tx_pin: GPIO16
  uart_rx_pin: GPIO21
  input_obst_pin: GPIO23
  status_door_pin: GPIO5
  status_obstruction_pin: GPIO12

packages:
  base: !include common/base.yaml
  ratgdo: !include common/ratgdo.yaml

ota:
  password: "ce275759362f3215b59d1fdb1365ffd9"

wifi:
  ap:
    ssid: Single Car GDO
    password: "..."

logger:
  level: DEBUG

common/base.yaml:

esphome:
  name: $name
  friendly_name: $friendly_name

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:
  level: INFO

mqtt:
  broker: mqtt.local
  username: esphome
  password: !secret mqtt_password
  discovery_unique_id_generator: mac
  topic_prefix: esphome/$name

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: $friendly_name Setup

time:
  - platform: sntp
    servers: ntp.local
    timezone: America/Denver

captive_portal:

sensor:
  - platform: wifi_signal
    name: "WiFi Signal Strength"
    update_interval: 60s
    disabled_by_default: true

switch:
  - platform: restart
    name: Restart
    disabled_by_default: true

common/ratgdo.yaml:

external_components:
  - source:
      type: git
      url: https://github.com/ratgdo/esphome-ratgdo
    refresh: 1s

preferences:
  flash_write_interval: 5s

ratgdo:
  id: ${id_prefix}
  input_gdo_pin: ${uart_rx_pin}
  output_gdo_pin: ${uart_tx_pin}
  input_obst_pin: ${input_obst_pin}

sensor:
  - platform: ratgdo
    id: ${id_prefix}_openings
    type: openings
    entity_category: diagnostic
    ratgdo_id: ${id_prefix}
    name: "Openings"
    unit_of_measurement: "openings"
    icon: mdi:open-in-app

switch:
  - platform: ratgdo
    id: ${id_prefix}_lock_remotes
    type: lock
    entity_category: config
    ratgdo_id: ${id_prefix}
    name: "Lock remotes"

binary_sensor:
  - platform: ratgdo
    type: motion
    id: ${id_prefix}_motion
    ratgdo_id: ${id_prefix}
    name: "Motion"
    device_class: motion
  - platform: ratgdo
    type: obstruction
    id: ${id_prefix}_obstruction
    ratgdo_id: ${id_prefix}
    name: "Obstruction"
    device_class: problem
  - platform: ratgdo
    type: button
    id: ${id_prefix}_button
    ratgdo_id: ${id_prefix}
    name: "Button"
    entity_category: diagnostic
  - platform: ratgdo
    type: motor
    id: ${id_prefix}_motor
    ratgdo_id: ${id_prefix}
    name: "Motor"
    device_class: running
    entity_category: diagnostic

number:
  - platform: ratgdo
    id: ${id_prefix}_rolling_code_counter
    type: rolling_code_counter
    entity_category: config
    ratgdo_id: ${id_prefix}
    name: "Rolling code counter"
    mode: box
    unit_of_measurement: "codes"

  - platform: ratgdo
    id: ${id_prefix}_opening_duration
    type: opening_duration
    entity_category: config
    ratgdo_id: ${id_prefix}
    name: "Opening duration"
    unit_of_measurement: "s"

  - platform: ratgdo
    id: ${id_prefix}_closing_duration
    type: closing_duration
    entity_category: config
    ratgdo_id: ${id_prefix}
    name: "Closing duration"
    unit_of_measurement: "s"

  - platform: ratgdo
    id: ${id_prefix}_client_id
    type: client_id
    entity_category: config
    ratgdo_id: ${id_prefix}
    name: "Client ID"
    mode: box

cover:
  - platform: ratgdo
    id: ${id_prefix}_garage_door
    device_class: garage
    name: "Door"
    ratgdo_id: ${id_prefix}

light:
  - platform: ratgdo
    id: ${id_prefix}_light
    name: "Light"
    ratgdo_id: ${id_prefix}

button:
  - platform: safe_mode
    name: "Safe mode boot"
    entity_category: diagnostic

  - platform: template
    id: ${id_prefix}_query_status
    entity_category: diagnostic
    name: "Query status"
    on_press:
      then:
        lambda: !lambda |-
          id($id_prefix).query_status();

  - platform: template
    id: ${id_prefix}_query_openings
    name: "Query openings"
    entity_category: diagnostic
    on_press:
      then:
        lambda: !lambda |-
          id($id_prefix).query_openings();

  - platform: template
    id: ${id_prefix}_sync
    name: "Sync"
    entity_category: diagnostic
    on_press:
      then:
        lambda: !lambda |-
          id($id_prefix).sync();

  - platform: template
    id: ${id_prefix}_toggle_door
    name: "Toggle door"
    on_press:
      then:
        lambda: !lambda |-
          id($id_prefix).toggle_door();

Any help would be appreciated.

rohinrohin commented 11 months ago

@Kaldek, I can confirm that we have a Security+ GDO. manual

We have flashed ratgdo native and things are still not working as expected.

Any idea what we maybe missing out on?

Another side note, I noticed from this wiki that since I have the purple learning button it only supports ratgdo v2.5 board, but you recommended that I flash firmware for the 2.0 board.

sanjay900 commented 11 months ago

@ccutrer The pinouts assume you are using the ESP32 d1 mini yml file, hence why the pins are totally different to the schematic when you pick the lolin s2 mini board as your base. If you are receiving data but not able to send, that sounds like something is wrong with just the TX portion of your circuit. Try replacing the IRLB8721 with a 2n7000. I saw some comments on one of the issues here about people having issues with the IRLB8721, and the 2n7000 worked for them.

sanjay900 commented 11 months ago

@rohinrohin Yeah so with the ESPHome firmware, there is no difference between 2.0 and 2.5 besides pinouts, hence why we just use the 2.0 pinouts as the web flasher doesn't support 2.5 with esp32s. The ESPHome firmware doesn't support security+ 1 at all.

Only the MQTT firmware supports security+ 1. 2.5 uses pin GPIO22, while 2.0 uses GPIO16. In saying that, i didn't think the mqtt firmware had official support for the ESP32, so did you build that yourself?

Kaldek commented 11 months ago

I have an ESP32-DevKitC (pinout: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/_images/esp32-devkitC-v4-pinout.png). I built my rat-ratgdo yesterday with the recommended 2n7000 and IRLB8721 transistors, the flashed it.

We're starting to suspect that - even though the specs are correct - the IRLB8721 is just not working for anyone! Please try with another 2n7000 and get back to us as soon as you can!

If you have an oscilloscope (two channel preferred) we would like to see if you can correlate a HIGH signal from the TX pin with a pull-down (low signal) on the red wire. If the red wire is not being pulled to ground this must mean that the IRLB8721 is unsuitable for as-yet unknown specification differences. We've checked the one we think are obvious but they all seem fine.

We also know that the RFP30N06LE works as another user who tested ten(!) IRLB8721s couldn't get them working and he tried this part which worked immediately.

Kaldek commented 11 months ago

CRAP. Confirmed it looks like the lack of current is what stops the IRLB8721 from switching: https://forums.adafruit.com/viewtopic.php?p=446184

vaidehi-joshi commented 11 months ago

@rohinrohin Yeah so with the ESPHome firmware, there is no difference between 2.0 and 2.5 besides pinouts, hence why we just use the 2.0 pinouts as the web flasher doesn't support 2.5 with esp32s. The ESPHome firmware doesn't support security+ 1 at all.

Only the MQTT firmware supports security+ 1. 2.5 uses pin GPIO22, while 2.0 uses GPIO16. In saying that, i didn't think the mqtt firmware had official support for the ESP32, so did you build that yourself?

Thanks @sanjay900!

@rohinrohin and I purchased a new D1Mini ESP8266MOD - this exact one and we are running all experiments on this for now.

@Kaldek

To summarize,

  1. We are using the D1Mini ESP8266MOD
  2. We have a security 1+ GDO (purple learn button)
  3. We are using 2x 2n7000n Transistors
  4. Obstruction sensor is working
  5. We used native ratgdo and flashed ratgdo v2.26, Security + 2.0 (secplus 1.0 alpha)
  6. Logs show Wall panel detected and when I try to open the door, it says Door is not moving

Any help greatly appreciated! 😞

sanjay900 commented 11 months ago

@rohinrohin Yeah so with the ESPHome firmware, there is no difference between 2.0 and 2.5 besides pinouts, hence why we just use the 2.0 pinouts as the web flasher doesn't support 2.5 with esp32s. The ESPHome firmware doesn't support security+ 1 at all. Only the MQTT firmware supports security+ 1. 2.5 uses pin GPIO22, while 2.0 uses GPIO16. In saying that, i didn't think the mqtt firmware had official support for the ESP32, so did you build that yourself?

Thanks @sanjay900!

@rohinrohin and I purchased a new D1Mini ESP8266MOD - this exact one and we are running all experiments on this for now.

@Kaldek

To summarize,

1. We are using the D1Mini ESP8266MOD

2. We have a security 1+ GDO (purple learn button)

3. We are using 2x 2n7000n Transistors

4. Obstruction sensor is working

5. We used native ratgdo and flashed `ratgdo v2.26, Security + 2.0 (secplus 1.0 alpha)`

6. Logs show `Wall panel detected` and when I try to open the door, it says `Door is not moving`

Any help greatly appreciated! 😞

Might be worth spinning up another issue for this, this one was more about the esp32 (hence my question about how you were using the native ratgdo)

Kaldek commented 11 months ago

Thanks, will close this so we can focus on the other issue.