15 comments on “Justin’s Adventures with the Gate Controller

  1. Pingback: Gatetrilogy Saga: The Front Gate Part III, The Final Gate Opener | Justin A. Parr - Technologist

  2. Pingback: Rant: SMA vs. RP-SMA | Justin A. Parr - Technologist

  3. Pingback: Gate Opener Replacement | Justin A. Parr - Technologist

  4. Pingback: C – Access Other Data Types As Byte Array | Justin A. Parr - Technologist

  5. Hi Justin, I am trying to do something similar to this but having some issues writing the code. I was hoping you would share scripts / code / config. Thank-you and best regards

  6. I already have a pi serial, it’s just been too cold to sit out at the gate with a multi-meter and laptop. Besides just curiosity, the serial is my last resort. My uController is a Sparkfun XBee Thing. Processing the serial output would be more complicated there, I think.

    Some other control board connections I’ve thought of using are the gate lock or warning light, either should have current while the gate is in motion. I don’t have a warning light connected and the lock is useless when the gate is mounted on a wooden post. The lock and latch pin is perpetually out of alignment due to the weather affecting the post. I don’t believe these help with which direction it’s moving.

  7. I have a sort of similar setup. my Raspberry Pi is currently in my garage and remotely operates the gate via the cycle pins. I have a wi-fi web cam on my gate opener page that shows me if the gate is open or closed.

    Have you found anything on the mighty mule gate opener motherboard to let you sense if the gate is open or closed? That’s my next step. I want to be able to send it a command like open and not have it close if it is currently opened. I don’t want to rely on the web cam image.

    I just got a pi zero wh and am going to try and mount that in my control box and see if I can get wi-fi to my house and then try and figure out the best way to programmatically figure out if the gate is open or closed.

    – jack – Southlake Texas – https://mylinuxguy.net

    • Hi, Jack:

      I had the same thought about sensing the gate position (or state). I haven’t found anything yet. There is nothing obvious on the mobo nor the documentation for the mobo that says “hey connect here to sense the status”, but I suspect that there must be a way to do it. I also thought about a simple NC switch on the gate arm that is depressed (open) when the gate is closed and closes when the gate is opened.

      Please let me know if you want my (messy) PHP source code – happy to share. If I find any way to sense the gate position, I’m happy to share, and would appreciate same.


      • Also interested in gate direction. Surely the solution lies in the color-coded swing-arm wires. It should be possible to detect a change in polarity, or voltage present on a given wire, rather than resorting to external sensor devices. Any progress here?

        • Hi, Don:

          In short, not yet!

          No progress about detecting the state of the gate internally (yet). I agree that some time with a multimeter might yield something useful, and then because of the voltage difference, I would need an ADC module or a similar circuit that senses the “drive” signal and reduces it to +/-5 volts that I can detect on one of the Pi pins. Although this would tell me if the gate is opening or closing it wouldn’t tell me the absolute state – for example, if the gate started to close, but hit something and stopped. What I was hoping for is a way to tap the board’s state, since it knows whether the gate is open or closed (or somewhere in between), but there are no pins for this.

          Reading your comment, I hadn’t considered that perhaps the actuator itself might have a position sensor, so I’ll have to check that out. If so, then you could theoretically read the position in real-time, assuming you know how to decode the sensor pin. I had always just assumed that it uses PWM to calculate the gate’s position, which I assumed is why it’s so sloppy. X pulses = 1 spin. Y spins = 1 cm. z centimeters of travel = x * y * z pulses. What further makes me think this, is that if you kill power to the gate half-way through its cycle, it ALWAYS opens – the circuit is probably looking for a current spike which indicates that the gate is fully-opened. Then, the controller just blindly sends pulses.

          The other approaches I’ve been considering are:
          – Magnetic switches – the gate is too imprecise
          – Potentiometer / Optical encoder connected to the gate hinge – would get banged around and knocked out of alignment over time
          – Linear potentiometer / Linear encoder connected to the actuator (TBD)
          – Some kind of mechanical deflection sensor (TBD)
          – Optical sensor (trip beam) – would be running (and draining power) continuously. If I run it from the battery, it will drain power from the battery. If I run it off of a separate circuit, then it won’t work during a power outage.

          No progress yet, though.

          • It has a magnetic sensor and a wheel in the swing-arm assembly, and a PCB that counts the revolutions. The other thing I’ve considered is tapping the “debug” serial port to see if it offers any useful state information. I’ll be running zigbee motes off the battery with a solar charger, but I’d like to avoid drawing more power than necessary as well.

            I’m mainly a professional software guy, my circuitry reverse-engineering foo is weak.

          • Good to know how that works. I wonder if I could add my own reed switch to the encoder you describe – that would at least tell me the gate is moving, although not necessarily in which direction. I guess I could add two reed switches, and use the A->B vs B->A logic…

            Also, I didn’t realize there was a serial port… very cool! Assuming they use 4 pins, one should be +5 or +3.3 and one should be -5 or -3.3. The other two are TX and RX, which you should be able to plug in to either a USB serial adapter, or use the Pi’s serial interface.

        • So, I finally had the occasion to figure out the signals on the master cable – See updates in the main post. There might be some useful options, and please let me know if you’ve come up with anything in the interim. Hope this helps…

  8. Pingback: HOME | Justin A. Parr - Technologist

Leave a Reply