Kaldek / rat-ratgdo

Open source schematics for ratgdo PCB
MIT License
306 stars 47 forks source link

Setup with ESP WROOM 32 #3

Closed rohinrohin closed 9 months ago

rohinrohin commented 9 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!

donavanbecker commented 9 months ago

@rohinrohin, I have the same board but with a usb-c. Can you share your setup once you have it complete?

rohinrohin commented 9 months ago

Absolutely! Will do :)

rlowens commented 9 months ago

ratgdo uses these pins for esp32 https://github.com/ratgdo/esphome-ratgdo/blob/main/static/v25board_esp32_d1_mini.yaml

uart_tx_pin: D1 uart_rx_pin: D2 input_obst_pin: D7

Which looking at the D1 Mini ESP32 pin mapping at https://templates.blakadder.com/wemos_D1_Mini_ESP32.html translates to:

uart_tx_pin: D1=GPIO22 uart_rx_pin: D2=GPIO21 input_obst_pin: D7=GPIO23

So, that's the mapping that it would default to expecting if you flash the stock ratgdo firmwares, but you can use pretty much any that you want if you edit the ESPHome .yaml after importing it.

rohinrohin commented 9 months ago

Understood! Appreciate the quick and detailed response @rlowens. Will try it and keep you posted.

Kaldek commented 9 months ago

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?

As this is using ESPHome, there are only two things I would do:

  1. Validate that the ratgdo ESPHome installer will work on the ESP32 like it does for generic ESPHome installer
  2. If item 1 is confirmed, install ESPHome-ratgdo and map your pins using the YAML file

It looks like you might be in luck: https://github.com/ratgdo/esphome-ratgdo/issues/78

Kaldek commented 9 months ago

This issue is held open until testing has been performed by @rohinrohin and we have closure on any follow-up work.

rohinrohin commented 9 months ago

thanks for the info @Kaldek!

Here are some interim updates from my end:

  1. The web installer (blue v2.5) throws up an error saying that the board is not supported. Do you know of an approach where I can compile and install the firmware to my board without using Paul’s web installer?
  2. I tried flashing the older version 2.0 ESP32 and that seems to have flashed properly. Would this work with our existing schema?
Kaldek commented 9 months ago
  1. I tried flashing the older version 2.0 ESP32 and that seems to have flashed properly. Would this work with our existing schema?

Yes v2.0 will work the only difference is that TX is on GPIO2 on v2.0. Well, I'm not exactly sure what that will map to on your ESP32 but it will be in the YAML files or C++ code somewhere.

rlowens commented 9 months ago

https://github.com/ratgdo/esphome-ratgdo/blob/main/static/v2board_esp32_d1_mini.yaml uses uart_tx_pin: D4

Which on D1 mini ESP32 is GPIO16

sanjay900 commented 9 months ago

I tried this myself, and i was able to control my garage door but not receive its state, any idea what might cause that?

vaidehi-joshi commented 9 months ago

Hey @sanjay900! Can you let me know which version you tried flashing onto the ESP WROOM 32? Was it v2 or v2.5? Also which pins did you use for tx,rx and input_obst_pin?

sanjay900 commented 9 months ago

I used v25board_esp32_d1_mini.yaml Seems to be fully working now! I suspect i wired my RX wrong the first time i did it hence why it wasn't reading. As for pins,

uart_tx_pin: D1=GPIO22
uart_rx_pin: D2=GPIO21
input_obst_pin: D7=GPIO23

But i didn't need to set them, the v25 board has these as the defaults so it just worked.

20231027_110245

My opener is a bit weird and has a seperate green serial line, alongside a dumb button input for the wall button. But that made my life a touch easier cause i didnt have to touch the button at all!

Probably worth adding a diagram for it though to make things less complicated for the next person

I programmed on v2 using the web programmer, but then changed it to v2.5 from ESPHOME as the web flasher didn't let me program v2.5

Kaldek commented 9 months ago

Beautiful work, folks!

Kaldek commented 9 months ago

I tried this myself, and i was able to control my garage door but not receive its state, any idea what might cause that?

I know you fixed your isuse, but I also had this issue yesterday and it was because I had used a 2n7000 MOSFET that had previously been almost cooked by some of my stupid wiring efforts. Overnight it eventually died and did the good old "MOSFET shorts to ground" failure. Whoops!

sanjay900 commented 9 months ago

I tried this myself, and i was able to control my garage door but not receive its state, any idea what might cause that?

I know you fixed your isuse, but I also had this issue yesterday and it was because I had used a 2n7000 MOSFET that had previously been almost cooked by some of my stupid wiring efforts. Overnight it eventually died and did the good old "MOSFET shorts to ground" failure. Whoops!

I did think this might have been the case and replaced it a few times haha

Kaldek commented 9 months ago

Hey folks once @rohinrohin has also confirmed theirs as working, someone just write a summary of what was needed for the ESP32 and I'll add that to the project in the FAQ or maybe a separate "supported ESP modules" document.

sanjay900 commented 9 months ago

Hey folks once @rohinrohin has also confirmed theirs as working, someone just write a summary of what was needed for the ESP32 and I'll add that to the project in the FAQ or maybe a separate "supported ESP modules" document.

Summary wise, i think all we need is a diagram that references the correct GPIO pins

uart_tx_pin: D1=GPIO22
uart_rx_pin: D2=GPIO21
input_obst_pin: D7=GPIO23

Hopefully the web flasher will be updated to just directly allow programming the v25board_esp32_d1_mini.yaml

Kaldek commented 9 months ago

Hey folks once @rohinrohin has also confirmed theirs as working, someone just write a summary of what was needed for the ESP32 and I'll add that to the project in the FAQ or maybe a separate "supported ESP modules" document.

Summary wise, i think all we need is a diagram that references the correct GPIO pins

uart_tx_pin: D1=GPIO22
uart_rx_pin: D2=GPIO21
input_obst_pin: D7=GPIO23

I have some images here of the ESP-WROOM-32 and I can't see pins labelled D7 or D1.

https://github.com/Kaldek/rat-ratgdo/blob/main/ESP-WROOM-32%20board.jpg

They just appear to be labelled D21, D22, D23.

Kaldek commented 9 months ago

@sanjay900 also can you explain this process in more detail including how you told it to use a specific YAML file?

I programmed on v2 using the web programmer, but then changed it to v2.5 from ESPHOME as the web flasher didn't let me program v2.5

Kaldek commented 9 months ago

I have created a "Supported Boards" page with lots of details. Just waiting on that information about updating to v2.5 from within ESPHome @sanjay900

sanjay900 commented 9 months ago

I have created a "Supported Boards" page with lots of details. Just waiting on that information about updating to v2.5 from within ESPHome @sanjay900

If you edit the yml from ESPHome, you can just change the packages line to the following

packages:
  ratgdo.esphome: github://ratgdo/esphome-ratgdo/v25board_esp32_d1_mini.yaml@main
sanjay900 commented 9 months ago

Hey folks once @rohinrohin has also confirmed theirs as working, someone just write a summary of what was needed for the ESP32 and I'll add that to the project in the FAQ or maybe a separate "supported ESP modules" document.

Summary wise, i think all we need is a diagram that references the correct GPIO pins

uart_tx_pin: D1=GPIO22
uart_rx_pin: D2=GPIO21
input_obst_pin: D7=GPIO23

I have some images here of the ESP-WROOM-32 and I can't see pins labelled D7 or D1.

https://github.com/Kaldek/rat-ratgdo/blob/main/ESP-WROOM-32%20board.jpg

They just appear to be labelled D21, D22, D23.

Sorry yeah, those were just the labels in the yml, since its using the d1 mini pinouts, which end up mapping to those specific GPIO pins

Kaldek commented 9 months ago

I have created a "Supported Boards" page with lots of details. Just waiting on that information about updating to v2.5 from within ESPHome @sanjay900

If you edit the yml from ESPHome, you can just change the packages line to the following

packages:
  ratgdo.esphome: github://ratgdo/esphome-ratgdo/v25board_esp32_d1_mini.yaml@main

Sorry mate, I was specifically referring to the complete process. That is, how to force it to use the specific YAML. I'm really vague on this, sorry. I know it's to do with the ESP web installer and the manifest files that it uses, but not much more than that.

sanjay900 commented 9 months ago

I have created a "Supported Boards" page with lots of details. Just waiting on that information about updating to v2.5 from within ESPHome @sanjay900

If you edit the yml from ESPHome, you can just change the packages line to the following

packages:
  ratgdo.esphome: github://ratgdo/esphome-ratgdo/v25board_esp32_d1_mini.yaml@main

Sorry mate, I was specifically referring to the complete process. That is, how to force it to use the specific YAML. I'm really vague on this, sorry. I know it's to do with the ESP web installer and the manifest files that it uses, but not much more than that.

Yeah sorry I have no idea how to change the web installer, I just modified the yaml of it manually after programming V2.

Kaldek commented 9 months ago

Yeah sorry I have no idea how to change the web installer, I just modified the yaml of it manually after programming V2.

Yes, but ummm, how? From within Home Assistant? From the ratgdo web interface?

Kaldek commented 9 months ago

I just realised I don't have the ESPHome Add-On installed in Home Assistant.

sanjay900 commented 9 months ago

Right yeah, so adopt it into ESPHome, then hit the edit button. image

Kaldek commented 9 months ago

Right yeah, so adopt it into ESPHome, then hit the edit button. image

And then click the install button, right?

sanjay900 commented 9 months ago

Yeah, click install

Kaldek commented 9 months ago

Yeah, click install

OK. But cludgy I suppose but I can see the process now. I had not installed ESPHome Add-On into HA, as HA has the discovery part of it already included. All the management stuff is in the ESPHome Add-On.

sanjay900 commented 9 months ago

Yeah, click install

OK. But cludgy I suppose but I can see the process now. I had not installed ESPHome Add-On into HA, as HA has the discovery part of it already included. All the management stuff is in the ESPHome Add-On.

Hopefully someone will send the project an image and then they can add esp32 v2.5 support to the installer.

Kaldek commented 9 months ago

Yeah, click install

OK. But cludgy I suppose but I can see the process now. I had not installed ESPHome Add-On into HA, as HA has the discovery part of it already included. All the management stuff is in the ESPHome Add-On.

Hopefully someone will send the project an image and then they can add esp32 v2.5 support to the installer.

For the ESP-32 I can just tell people to use v2.0 and that pinout. There's no specific we have to use v2.5 - at least not with what I'm trying to achieve. Your thoughts?

rlowens commented 9 months ago

I have some images here of the ESP-WROOM-32 and I can't see pins labelled D7 or D1.

https://github.com/Kaldek/rat-ratgdo/blob/main/ESP-WROOM-32%20board.jpg

They just appear to be labelled D21, D22, D23.

The https://github.com/ratgdo/esphome-ratgdo/blob/main/static/v2board_esp32_d1_mini.yaml and https://github.com/ratgdo/esphome-ratgdo/blob/main/static/v25board_esp32_d1_mini.yaml use the "wemos_d1_mini32" board, which looks like this and is an expanded version of the ESP8266-based D1 mini board, made to be able to fit into boards that take a ESP8266 D1 mini board, but still offer the extra pins of the ESP32. So for the original D1 mini pins it allows use of the original pin names. All other ESP32-based boards I've seen just label the pins with the actual GPIO pin numbers.

For the ESP-32 I can just tell people to use v2.0 and that pinout. There's no specific we have to use v2.5 - at least not with what I'm trying to achieve. Your thoughts?

I agree. And highlight that the ESPHome-firmware is the same between v2.0 hardward and v2.5 hardware, only the one pin is used differently.

Kaldek commented 9 months ago

I agree. And highlight that the ESPHome-firmware is the same between v2.0 hardward and v2.5 hardware, only the one pin is used differently.

What's the mapping of D4 in their YAML to an ESP-32 pin? I've, uh, had a couple of beers already as it's Friday arvo here.

Kaldek commented 9 months ago

Is it GPIO16?

sanjay900 commented 9 months ago

Is it GPIO16?

Should be, I'll give it a go in a bit

Kaldek commented 9 months ago

OK looks like it is indeed GPIO16 image

sanjay900 commented 9 months ago

Does seem like gpio16 works, annoyingly i took my breadboard apart to put it into a PCB, which then didnt work and after putting back on a breadboard im back to RX not working lol

It has just occurred to me that the logs even tell us the pins

[20:03:01][C][ratgdo:082]:   Output GDO Pin: GPIO16
[20:03:01][C][ratgdo:083]:   Input GDO Pin: GPIO21
[20:03:01][C][ratgdo:087]:   Input Obstruction Pin: GPIO23
sanjay900 commented 9 months ago

Oh, the ESP32 Schematic you uploaded is wrong, youve flipped the source and drain of the 2n7000.

It works perfectly with V2.0, and D16, D21 and D23

CrazyCoder commented 9 months ago

@sanjay900 all the schematics that are currently uploaded (including the breadboard working version photo) say "source to ground and drain to RX". Are you sure it should be flipped? If so, why only ESP32 schematic is wrong and not all of them (since they all are the same)?

sanjay900 commented 9 months ago

@sanjay900 all the schematics that are currently uploaded (including the breadboard working version photo) say "source to ground and drain to RX". Are you sure it should be flipped? If so, why only ESP32 schematic is wrong and not all of them (since they all are the same)?

oh your absolutly right, im just blind. Must have been tired when i was looking at the schematic yesterday.

vaidehi-joshi commented 9 months ago

quick update on @rohinrohin 's project: we have followed the circuit diagram mentioned here but the setup with our ESP8266 is still not working. We tried replacing transistors, tested the resistors, and even the continuity in the connections. So I am guessing we made an error in the circuit. It's a little hard to follow through the connections between the 2 transistors and the control wires. Can someone please tell me where the Gate, Drain, and Source for each transistor are going? Appreciate any help!

vaidehi-joshi commented 9 months ago

Please correct me if I am wrong: IRLB8721: Gate- D1 Source- Ground Drain- Red control wire

2n 7000 n-channel: Gate- Red control wire Source- Ground Drain- D2

Kaldek commented 9 months ago

Please correct me if I am wrong: IRLB8721: Gate- D1 Source- Ground Drain- Red control wire

2n 7000 n-channel: Gate- Red control wire Source- Ground Drain- D2

Updated schematic with labels for Source/Gate/Drain: https://github.com/Kaldek/rat-ratgdo/blob/main/schematics/ratgdo%20open%20source%20D1%20Mini_schem_v4.png

Kaldek commented 9 months ago

@vaidehi-joshi I have updated the FAQ with extra info in case you are connecting to the wrong terminals on your GDO. Some GDOs do not use the Red/White/Black colour scheme for their wires.

https://github.com/Kaldek/rat-ratgdo/blob/main/FAQ.md

sanjay900 commented 9 months ago

@vaidehi-joshi I have updated the FAQ with extra info in case you are connecting to the wrong terminals on your GDO. Some GDOs do not use the Red/White/Black colour scheme for their wires.

https://github.com/Kaldek/rat-ratgdo/blob/main/FAQ.md

Thanks for that, my unit is one of these ones

vaidehi-joshi commented 9 months ago

Latest update on the issue:

We have tried to test our connection with the circuit diagram multiple times. Thank you for the SGD labels @Kaldek . Even followed this and we are pretty certain of our connections. We have done everything in our power to test the rest of it as well(checked continuity, replaced transistors, tested resistors). Here's what we see this in the esphome UI:

image

But no movement of the door. We are using the blue board config from here to flash the ESP

Here's how are GDO setup looks like:

image

Listing the circuit board connections: IRLB8721: Gate- D1 Source- Ground Drain- Red control wire

2n 7000 n-channel: Gate- Red control wire Source- Ground Drain- D2

Can someone please help us with the verification of the setup and connections?

Kaldek commented 9 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).

vaidehi-joshi commented 9 months ago

@sanjay900 First off thank you, this is something we hadn't crossed off the list. Our model is Chamberlain Whisper Drive Plus (Model: 547445). It is Security+ not sure how to check if it's Security+ 1.0 or Security+ 2.0. We have referred to this which is the D1, D2, D7 pinout.

Can we still run it on our ESP8266?

rlowens commented 9 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).