Author Topic: Reading garage door signal with Raspberry Pi  (Read 1163 times)

0 Members and 1 Guest are viewing this topic.

Offline 99yodaleafTopic starter

  • Newbie
  • Posts: 7
  • Country: us
Reading garage door signal with Raspberry Pi
« on: July 18, 2024, 04:03:12 pm »
Hello,
I'd like to read the locked/unlocked state of my garage door opener with a raspberry pi, and am looking for strategy suggestions. In the "locked" state, the led on the switch panel blinks. This is achieved by holding S2-lock switch on the panel for a second or so. It remains in that state until the S2-lock button is pushed again. The Voltage is too high to directly attach to a raspberry pi input and there is very little current, so I can't add anything to the circuit that will use much. I'm hoping for a nudge related to the cheapest/most reliable way to continuously read the "state" of the circuit. Attached pictures show the front and back of the garage door control switch and a screenshot of the circuit in both states.

Thanks

 

Offline Phil1977

  • Frequent Contributor
  • **
  • Posts: 345
  • Country: de
Re: Reading garage door signal with Raspberry Pi
« Reply #1 on: July 18, 2024, 04:22:00 pm »
Switch the led of an optocoupler in series with the status-led?
Every time you think you designed something foolproof, the universe catches up and designs a greater fool.
 
The following users thanked this post: 99yodaleaf

Online darkspr1te

  • Frequent Contributor
  • **
  • Posts: 326
  • Country: zm
Re: Reading garage door signal with Raspberry Pi
« Reply #2 on: July 18, 2024, 04:44:33 pm »
Are you wanting the controller status or actual door status, if you want the door status then why not read what the controller reads.
In most cases its a set of switches depending on the door system type, i've done one with closed/opening/open-moving open-moving closed etc where you really have control to ones that just open a roller shutter up or down. reading the switches/"sensors" is easier than a led




*edit* i noticed its a two wire control which prob means it uses "power one way" to sense buttons and power in reverse to power led for status , for the buttons it senses the rise time of the powered cap depending on button.


darkspr1te

 
The following users thanked this post: 99yodaleaf

Offline 99yodaleafTopic starter

  • Newbie
  • Posts: 7
  • Country: us
Re: Reading garage door signal with Raspberry Pi
« Reply #3 on: July 19, 2024, 03:39:34 pm »
Thanks for the input. I have not used an optocoupler before, but that approach looks promising.
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7258
  • Country: ca
Re: Reading garage door signal with Raspberry Pi
« Reply #4 on: July 19, 2024, 10:04:24 pm »
To keep the low cost 2-wire system and avoid infringing on patents, they get clever with garage door openers. It's a mix of analog and digital signals on it.
The obstacle sensors are also on the same 2-wire bus which makes it a bit harder to snoop on the signal there. It will have high-freq pulses present to prove there is no obstacle that you see in your scope traces.
I drew a schematic of the board and you could just use an opto-coupler to read/monitor the green LED. Try something low current like 0.5mA using a 6N139 and 30k resistor, which does not load down the bus enough I think to upset it. It is a current-loop.

Do you see how this two-wire bus works.
Shorted is the door Command button being pressed.
Pulse to GND is Light button, C2 1uF charging up time.
Pulse to GND is Lock button, C1 22uF charging up time.
Normally pulsing signal of obstacle sensors is also seen on the bus. It's for functional safety - if an obstacle sensor stops pulsing, then it is either blocked or not working and the opener refuses to close.

You can also use another opto-coupler for the RPi to issue an open/close command remotely, if you trust your software that much. This can be good for people dropping something off, a package etc. when you aren't home you can remotely open the door for that. Note the Light and Lock button have charge/discharge currents so you need a relay for bidirectional currents.

Another approach to monitor door status is to just add a door sensor: a magnet on the door and a reed switch or Hall effect switch, like in alarm systems. I use this. Once it worked, a thief body-slammed my garage door and it moved off the Hall sensor (maybe 1-2") and tripped my own alarm system. The opener did not move enough. It was just slop in the mech. and chain, some thieves will try open a door as much as possible and coat hanger at the top to hook the release cord and pull it.

edit: updated schematic with cap values, and same board is used in a few other brand names.
Liftmaster 41A5273-1 Multi-Function Control Panel, LiftMaster 78LM, 81LM, 371LM, 971LNM,
Chamberlain 41A5273-2, 41A5273-14, 945CB -  2-Button Wall Control Panel
Craftsman 53687 schematic, Liftmaster 14SR438B, 14SR551B schematic.
« Last Edit: July 31, 2024, 10:50:39 pm by floobydust »
 
The following users thanked this post: 99yodaleaf

Offline 99yodaleafTopic starter

  • Newbie
  • Posts: 7
  • Country: us
Re: Reading garage door signal with Raspberry Pi
« Reply #5 on: July 20, 2024, 01:55:13 am »
Thanks @floobydust,
I have a three relay pi hat to mimic the buttons and a magnetic sensor for door open/closed.  Family likes the door in the "locked" state at night (wireless openers don't work), so reading that state is the last piece. At that point the info will be added to a home assistant dashboard. I will order some opto-couplers and give it a try.
 

Offline rich t

  • Contributor
  • Posts: 47
  • Country: us
    • rtestardi's github pages site
Re: Reading garage door signal with Raspberry Pi
« Reply #6 on: July 20, 2024, 02:41:10 am »
If you put anything (like an optocoupler) in series with your led, it will drop the intensity of the led, possibly to the point where you can't see it (and the led will do the same for the optocoupler, possibly to the point it won't trigger).

One other possibility is to have just an optical sensor (as opposed to an optocoupler which is a combination of optical emitter and sensor in the same package) to try and monitor the led optical output, but you'd need to aim that carefully and shield it from external light.

Or your best bet since your rpi is powered separately from the garage door system, if you can float the grounds the same as you did for your scope pictures, is to just use an rpi input to measure the signal on the led.  Your rpi input current (microamps) will be way less than the activation current for an optocoupler (milliamps).

You can simply use a series resistor to drop the voltage to the point that the protection/clamp diodes on the rpi inputs can handle the rest.

For example, if you are comfortable with 0.5 mA into the rpi protection/clamp diodes (see your board specs -- typically you can go quite a bit higher), and you want to measure an 18 volt signal with 3.3 volt logic, you'd need a series resistor of (18-3.3)/.0005 = 30k ohm.  Make sure you don't have internal pull-ups/pull-downs enabled on the rpi input (which might be on the order of 10k ohms) or else you will skew your voltages.

You might use an analog input to the rpi, but sometimes these require a lot more current (milliamps) than the digital input (microamps).
 
The following users thanked this post: 99yodaleaf

Offline Phil1977

  • Frequent Contributor
  • **
  • Posts: 345
  • Country: de
Re: Reading garage door signal with Raspberry Pi
« Reply #7 on: July 21, 2024, 05:42:02 am »
As far as I remember the voltage overhead in the shown circuit was quite high, so there should be enough power for the led+optocoupler.

The big advantage is the optocoupler blocks ground loops, noise and EMF spikes. Direct coupling of the microcontroller with other circuits components often has unforeseeable issues.
Every time you think you designed something foolproof, the universe catches up and designs a greater fool.
 
The following users thanked this post: 99yodaleaf

Offline 99yodaleafTopic starter

  • Newbie
  • Posts: 7
  • Country: us
Re: Reading garage door signal with Raspberry Pi
« Reply #8 on: July 28, 2024, 03:03:40 pm »
Hi folks,
Back to let others know that the optocoupler idea seems to work and to say thank you. Also a picture of my prototype abomination for the curious. I already had the rest of the board soldered, so the octocoupler is added behind a resistor. I'm guessing it will work even better in series with the existing panel led/resistor. I add that comment mostly so that other don't use the circuit in the picture as an example.

 
The following users thanked this post: rich t

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7258
  • Country: ca
Re: Reading garage door signal with Raspberry Pi
« Reply #9 on: July 28, 2024, 05:24:24 pm »
Can you give us the component values? opto, resistor, 22uF and some other cap used.
 

Offline 99yodaleafTopic starter

  • Newbie
  • Posts: 7
  • Country: us
Re: Reading garage door signal with Raspberry Pi
« Reply #10 on: July 28, 2024, 09:00:19 pm »
Upon further review, the octocoupler, when in series, seems to have enough of an effect on the circuit that it prevents the "communications" signal from working. The door opens/closes fine, but the "lock"  and "light functions don't work. To confirm, I tested it with only the octocoupler added to the circuit and tried using the panel buttons. I'm might try using a mosfet.
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7258
  • Country: ca
Re: Reading garage door signal with Raspberry Pi
« Reply #11 on: July 29, 2024, 12:36:03 am »
It might not be the opto addition, but hey we don't know the part values.
Is the capacitors' polarity right? each (-) is connected together to white but it looks backwards. ChongX can be a little dodgy.
 

Offline Phil1977

  • Frequent Contributor
  • **
  • Posts: 345
  • Country: de
Re: Reading garage door signal with Raspberry Pi
« Reply #12 on: July 29, 2024, 06:14:58 am »
Upon further review, the octocoupler, when in series, seems to have enough of an effect on the circuit that it prevents the "communications" signal from working. The door opens/closes fine, but the "lock"  and "light functions don't work. To confirm, I tested it with only the octocoupler added to the circuit and tried using the panel buttons. I'm might try using a mosfet.

Did you insert the optocoupler into the

a) control line that connects the control board to the main unit?
b) the LED part of the control board?

The control function seems to work by switching different capacitors parallel to the line - it seems a quite uncommon solution but I assume it requires low impedant connection between the caps and the line. That means the optocoupler should be inserted outside of this control circuit.
Every time you think you designed something foolproof, the universe catches up and designs a greater fool.
 

Offline 99yodaleafTopic starter

  • Newbie
  • Posts: 7
  • Country: us
Re: Reading garage door signal with Raspberry Pi
« Reply #13 on: August 01, 2024, 10:35:39 pm »
The parts values are the same as floobydust's schematic (thanks floobydust), minus the LED/resistor portion. Originally, I had it connected like this, and was able to reproduce all of the button functionality using the relay.



To isolate the octocoupler (PC817), I removed the pi circuit and added the octocoupler to the control line. The buttons for the lock and light (S2 and S3) no longer work. S1 (short) to open/close the door still works.

 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7258
  • Country: ca
Re: Reading garage door signal with Raspberry Pi
« Reply #14 on: August 02, 2024, 01:10:05 am »
The way you have it will not work, as it is doing.
We're suggesting connecting either of two ways, not sure which works best. I drew both on this schematic.
Option 1 opto is in series with the green LED circuit.
Option 2 opto stand alone with 10-30k resistor and wall panel left alone.

They might both work, it's just we don't know the voltage levels the opener is happy with and how much current it can put out before thinking there is a fault.
 
The following users thanked this post: 99yodaleaf, Phil1977

Offline 99yodaleafTopic starter

  • Newbie
  • Posts: 7
  • Country: us
Re: Reading garage door signal with Raspberry Pi
« Reply #15 on: August 02, 2024, 10:00:56 pm »
Thank you for the help. I will set it up as you suggested. I'm still curious about why it doesn't work though. I hooked the scope up with the octocoupler in series. Channel 1 is before the octocoupler. Channel 2 is after. As you can see, there's not much difference. Any idea why the capacitor circuit in the panel stops working properly?

 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 7258
  • Country: ca
Re: Reading garage door signal with Raspberry Pi
« Reply #16 on: August 02, 2024, 10:11:14 pm »
The capacitor current flows in both directions. Charging and discharging, but the opto-coupler (LED) in series with the wall panel only allows it in one direction. If I am following your circuit.

The control board briefly shuts off power to the two-wire bus and then measures what voltage is seen - if a capacitor (button) is pressed then there will be charge, a residual voltage present.
No cap (no button pressed) is falls to 0V like trace 1. Cap present it will fall to a few volts (guess). But the opto LED won't allow current flow in that direction so the caps are never seen. My guess as to how it's working. You;'d have to scope the signal with the buttons (caps) pressed to see how it's doing it.
 
The following users thanked this post: 99yodaleaf


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf