Skip to content

Commit

Permalink
Cleanup files for gerber builds
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfelt committed Nov 14, 2023
1 parent dac18c6 commit 8daebe2
Show file tree
Hide file tree
Showing 49 changed files with 50 additions and 46,811 deletions.
28 changes: 26 additions & 2 deletions .github/workflows/pcb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@ on:
paths:
- '**.sch'
- '**.kicad_pcb'
- '.github/**.yml' # Trigger on changes to the workflow file
- '**.kibot.yml' # Trigger on changes to the KiBot config file used in the workflow

pull_request:
paths:
- '**.sch'
- '**.kicad_pcb'
- '.github/**.yml' # Trigger on changes to the workflow file
- '**.kibot.yml' # Trigger on changes to the KiBot config file used in the workflow

# To allow for manual triggering from the Action console, add workflow_dispatch
workflow_dispatch:
inputs:
name:
description: 'Workflow run name'
description: 'Reason for build'
required: false
default: 'Manual test run'
default: 'Generate new gerber files'

jobs:
d1_mini_esp32_wide:
Expand Down Expand Up @@ -75,3 +80,22 @@ jobs:
with:
name: D1 Mini - ESP8266
path: output

bare_esp8266:
name: Bare ESP8266
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: INTI-CMNB/KiBot@v2_k7
with:
# Required - kibot config file
config: kicad_files/jlcpcb_gerbers.kibot.yaml
# optional - prefix to output defined in config
dir: output
schema: kicad_files/Bare ESP8266/RatGDO-OpenSource-Bare-ESP8266.kicad_sch
board: kicad_files/Bare ESP8266/RatGDO-OpenSource-Bare-ESP8266.kicad_pcb
- name: upload results
uses: actions/upload-artifact@v3
with:
name: Bare ESP8266
path: output
8 changes: 4 additions & 4 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ Each Garage Door Opener has two wires which connect between the GDO and any wire
However, that same +12v wire is **also** the data line which carries data between the GDO and the control panel. This works because each serial data pulse is a brief "pull to ground" of that +12v line. These pulses can be read by the door control panel (and, indeed read by the GDO if the data transmission is coming from the control panel and being sent to control the door). This is how the ratgdo both receives and transmits data as well. In essence, it appears to be just one more control device on the "bus".

Chamberlain often refers to this combined +12v and data line as "E-Serial":
![ratgdo connection example](https://github.com/Kaldek/rat-ratgdo/blob/main/ratgdo%20connection%20example.png)
![ratgdo connection example](images/ratgdo%20connection%20example.png)

### If the +12V line is constantly pulsed low during data transmission, how come the door control panel doesn't turn off?
There's two answers to this and both are simple:
- The data transmission is actually quite rare
- The door control panel either has some beefy capacitors in it or a supercapacitor. Either way, the brief interruptions to power do not affect the control panel.

### How come the 12 volt serial line doesn't blow the ESP8266 GPIO lines?
It's fairly simple how this operates. The really short version is that the MOSFETs are used as level shifters.
It's fairly simple how this operates. The really short version is that the MOSFETs are used as level shifters.

The more complex description is that the TX line 3.3v output is used to trigger the Gate of a MOSFET which grounds out the serial line, pulling it LOW. The circuit being closed is between the +12V serial line and GND. The GPIO pin therefore never sees 12 volts.
The more complex description is that the TX line 3.3v output is used to trigger the Gate of a MOSFET which grounds out the serial line, pulling it LOW. The circuit being closed is between the +12V serial line and GND. The GPIO pin therefore never sees 12 volts.

For the RX line, the Gate of the MOSFET on this part of the circuit is connected to the +12V serial line. Whenever +12v is applied to the gate, it causes the +3.3v from the ESP8266 GPIO pin to be pulled to ground. In this example, the voltage "push" (if you want to call it that) is going **from** the ESP8266 to the MOSFET and it is then switched to GND. GPIO pins on microcontrollers are designed to handle this "pull to ground" as a means of signalling/logic control, so there's no risk of the ESP8266 cooking itself. An important note to add to the RX circuitry is that when the door controller is transmitting data on the serial line, it is pulling the +12V line to GND. When the +12V line is pulled to ground, this switches off the MOSFET used in the RX circuit and therefore the GPIO pin on the ESP8266 goes high.

Expand All @@ -27,7 +27,7 @@ So, regardless of what device is transmitting on the serial line (whether that i
For the RX line where the gate is driven by a 12v signal, the 2n7000 is appropriate. For the TX line where the gate is driven by a 3.3v signal, the 2n7000 is borderline as it needs 3v to fully switch and 3.3v is risky. For through-hole designs, the IRLB8721 is our recommended part as it only needs 2.5 volts to fully switch, and the 3.3 volt signal from the ESP8266 is therefore plenty. See below if you're looking to use SMD parts.

### How come the obstruction sensor circuit uses two resistors?
The obstruction sensor circuit uses two 10k resistors, one in series and one in parallel to ground. This causes the resistors to act as a voltage divider, bringing the voltage "seen" on pin D7 (GPIO13) down to ~3.3 volts.
The obstruction sensor circuit uses two 10k resistors, one in series and one in parallel to ground. This causes the resistors to act as a voltage divider, bringing the voltage "seen" on pin D7 (GPIO13) down to ~3.3 volts.

### What bitrate is the MyQ serial communication?
As per the code from the ratgdo project, it is 9600 bits per second.
Expand Down
34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ AGAINST
THE
RATGDO

[![Generate Gerber and PCB Files](https://github.com/Kaldek/rat-ratgdo/actions/workflows/pcb.yaml/badge.svg)](https://github.com/Kaldek/rat-ratgdo/actions/workflows/pcb.yaml)

Credit and inspiration for this work goes to [@rlowens](https://github.com/rlowens) to let me know that there are other technical folks out there who needed this other than myself.

## Overview
This is an open source schematic for the ratgdo, based on the v2.5 [ratgdo](https://github.com/PaulWieland/ratgdo) PCB and code but installed using the [ESPHome fork](https://github.com/Kaldek/rat-ratgdo/blob/main/ESPHome%20vs%20native%20ratgdo.md) of ratgdo. We feel there is cognitive dissonance between the refusal to provide (and deleting requests for) schematics for the ratgdo PCB against the ratgdo project's use of open source code, open source licensing, and libraries used by other open source projects, as well as the inception reasoning for the ratgdo project which was to ensure that nobody is at the mercy of a third party.
This is an open source schematic for the ratgdo, based on the v2.5 [ratgdo](https://github.com/PaulWieland/ratgdo) PCB and code but installed using the [ESPHome fork](ESPHome%20vs%20native%20ratgdo.md) of ratgdo. We feel there is cognitive dissonance between the refusal to provide (and deleting requests for) schematics for the ratgdo PCB against the ratgdo project's use of open source code, open source licensing, and libraries used by other open source projects, as well as the inception reasoning for the ratgdo project which was to ensure that nobody is at the mercy of a third party.

This project was created to allow people who need a ratgdo solution for their garage door opener but either cannot, or choose not to, source the solution from Paul Wieland and be locked into that 3rd party. It also ensures that the PCB can be recreated as and when the project maintainer gives up on the project (much like Chamberlain themselves might do with their MyQ Cloud Service).

Expand All @@ -19,43 +21,47 @@ The PCB schematic here does not describe any circuitry other than the serial lin

**If you want to buy a pre-made ratgdo setup, purchase it [from Paul Wieland](https://github.com/PaulWieland/ratgdo).**

![PCB Link](https://github.com/Kaldek/rat-ratgdo/blob/main/schematics/ratgdo%20open%20source_schem_v9.png)
![PCB Link](schematics/ratgdo%20open%20source_schem_v9.png)

See images of a [working breadboard prototype](https://github.com/Kaldek/rat-ratgdo/blob/main/images/Breadboard_working.png) and the [subsequent soldered prototype using a D1 shield](https://github.com/Kaldek/rat-ratgdo/blob/main/images/Simple%20prototype%20using%20D1%20shield.jpg). Both of these prototypes are using 2n7000 MOSFETs exclusively, but that is because they are prototypes and long term reliability of data transmission when using the 2n7000 has not been confirmed. See the section below on needed components for context.
See images of a [working breadboard prototype](images/Breadboard_working.png) and the [subsequent soldered prototype using a D1 shield](images/Simple%20prototype%20using%20D1%20shield.jpg). Both of these prototypes are using 2n7000 MOSFETs exclusively, but that is because they are prototypes and long term reliability of data transmission when using the 2n7000 has not been confirmed. See the section below on needed components for context.

## Components needed
This schematic assumes the use of through-hole components. If you wish to use SMD components, please refer to the [FAQ](https://github.com/Kaldek/rat-ratgdo/blob/main/FAQ.md#what-if-i-want-to-use-sot-23-smd-components).
This schematic assumes the use of through-hole components. If you wish to use SMD components, please refer to the [FAQ](FAQ.md#what-if-i-want-to-use-sot-23-smd-components).

Aside from the obvious requirement of a [supported ESP-32 or ESP8266 board](https://github.com/Kaldek/rat-ratgdo/blob/main/Supported%20Boards.md) flashed with the [ESPHome version](https://github.com/ratgdo/esphome-ratgdo), you will need 3x 10 kohm (kilo-ohm) resistors, and two 2n7000 N-channel MOSFET (TO-92 package is easiest). It is also recommended you aquire a suitable 3-post screw terminal and some red, white, and black wire for connecting to the door opener. These connections are very low current, so you can get away with fairly thin wire.
Aside from the obvious requirement of a [supported ESP-32 or ESP8266 board](Supported%20Boards.md) flashed with the [ESPHome version](https://github.com/ratgdo/esphome-ratgdo), you will need 3x 10 kohm (kilo-ohm) resistors, and two 2n7000 N-channel MOSFET (TO-92 package is easiest). It is also recommended you aquire a suitable 3-post screw terminal and some red, white, and black wire for connecting to the door opener. These connections are very low current, so you can get away with fairly thin wire.

**Note:** Our simple through-hole Bill Of Materials uses 2n7000 MOSFETs for both RX and TX, however depending on the manufacturere of your 2n7000 and its production batch, it might not be 100% reliable for the TX circuit. There are many examples working using the 2n7000 however, so there is a very high chance it will work.


## INSTALL REQUIREMENTS
Due the schematics we have provided and how they are laid out, you must use the ESPHome fork of ratgdo and - for ESP8266 based boards - select the blue v2.5 board on the ESPhome [web installer page](https://ratgdo.github.io/esphome-ratgdo/). For ESP-32 based boards the above does not currently apply and you must use the v2.0 installer and follow our ESP-32 schematic we provide in the Supported Boards page.

For the ESP8266 based boards, if installing using Paul Wieland's native ratgdo installer and you install for a v2.0 board, you must wire your TX to D4 (GPIO2) rather than D1 (GPIO5).
For the ESP8266 based boards, if installing using Paul Wieland's native ratgdo installer and you install for a v2.0 board, you must wire your TX to D4 (GPIO2) rather than D1 (GPIO5).

## Having a PCB printed
You may use the files from the [schematics folder](https://github.com/Kaldek/rat-ratgdo/tree/main/kicad_files) to have your own PCB printed. We provide an example of what these boards would look like when printed and populated, ready for a Wemos D1 Mini module.
You may use the files from the [schematics folder](kicad_files) to have your own PCB printed. We provide an example of what these boards would look like when printed and populated, ready for a Wemos D1 Mini module.

![3D render of printed PCB](https://github.com/Kaldek/rat-ratgdo/blob/main/images/3D%20render%20of%20schematic.png)
![3D render of printed PCB](images/3D%20render%20of%20schematic.png)
_An example of the D1 Mini ESP32 Wide Format_

### Schematic options
We provide a few options of schematic files suitable for sending to a PCB printing company. Currently provided are:
- [Wemos D1 Mini ESP8266](https://github.com/Kaldek/rat-ratgdo/tree/main/kicad_files/D1%20Mini%20-%20ESP8266)
- [Wemos D1 Mini ESP32](https://github.com/Kaldek/rat-ratgdo/tree/main/kicad_files/D1%20Mini%20-%20ESP32) (massive overkill for ratgdo but it's your choice!)
- [Bare ESP8266 module](https://github.com/Kaldek/rat-ratgdo/tree/main/kicad_files/Bare%20ESP8266)
- [Wemos D1 Mini ESP8266](kicad_files/D1%20Mini%20-%20ESP8266)
- [Wemos D1 Mini ESP32](kicad_files/D1%20Mini%20-%20ESP32) (massive overkill for ratgdo but it's your choice!)
- [Wemos D1 Mini ESP32 Wide Format](kicad_files/D1%20Mini%20Wide%20-%20ESP32)
- [Bare ESP8266 module](kicad_files/Bare%20ESP8266)

> If you just want to try ordering a board from somewhere like JLCPCB, then check out the most recent [build artifacts](https://github.com/Kaldek/rat-ratgdo/actions/workflows/pcb.yaml)
## How the ratgdo circuit works
The ratgdo circuitry which we cover in this project consists of two sections; Garage Door control and obstruction sensors.

### Garage Door Control
#### Description of the Chamberlain configuration
The Chamberlain garage door control circuit is a two-wire setup consisting of a Ground, and a combined +12v power and serial data line. The serial data line is held at 12v unless data transmission is occurring. Data transmission is performed by pulling the 12v line down to GND for each data bit. The benefit here is that a single wire can be used for providing power to door control panels and data transmssion on a single wire. The use of appropriately sized capacitors in door control panels means they do not switch off during data transmission.
The Chamberlain garage door control circuit is a two-wire setup consisting of a Ground, and a combined +12v power and serial data line. The serial data line is held at 12v unless data transmission is occurring. Data transmission is performed by pulling the 12v line down to GND for each data bit. The benefit here is that a single wire can be used for providing power to door control panels and data transmssion on a single wire. The use of appropriately sized capacitors in door control panels means they do not switch off during data transmission.

#### How ratgdo interfaces with the Chamberlain wiring
The ratgdo taps into the red control wire and uses this single wire for transmission of commands onto the serial bus, and for receiving data from the serial bus. As it is a single wire protocol and operates half-duplex, the ratgdo circuitry uses N-channel MOSFETs wired in a manner which allows the ESP8266 to never transmit when the serial line is already low.
The ratgdo taps into the red control wire and uses this single wire for transmission of commands onto the serial bus, and for receiving data from the serial bus. As it is a single wire protocol and operates half-duplex, the ratgdo circuitry uses N-channel MOSFETs wired in a manner which allows the ESP8266 to never transmit when the serial line is already low.

In operation, this means that the ratgdo is mostly listening to the serial bus to ensure it is keeping track of the state of the door. For example, if the door is manually opened (or opened by use of the MyQ app even), these events are broadcast onto the serial bus by the door controller. ratgdo is therefore able to know that the state of the door has changed. In turn, this means that when controlling ratgdo via Home Assistant, the status of the door in HA is always up to date.

Expand All @@ -64,5 +70,5 @@ In operation, this means that the ratgdo is mostly listening to the serial bus t


### Obstruction sensor
The ratgdo monitors the real-time state of the obstruction sensors directly. We assume this is because obstruction status is not broadcast in real time by the door controller, and safety is paramount. It allows you to set up real-time alerts in Home Assistant for any time the door is obstructed. The ratgdo taps into the obstruction sensor power wire which also acts as a communication bus, however the signalling is only an ongoing status of whether the obstruction sensors are working and whether there is an obstruction.
The ratgdo monitors the real-time state of the obstruction sensors directly. We assume this is because obstruction status is not broadcast in real time by the door controller, and safety is paramount. It allows you to set up real-time alerts in Home Assistant for any time the door is obstructed. The ratgdo taps into the obstruction sensor power wire which also acts as a communication bus, however the signalling is only an ongoing status of whether the obstruction sensors are working and whether there is an obstruction.

Loading

0 comments on commit 8daebe2

Please sign in to comment.