Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. DC Motor rotation detection with mySensors

DC Motor rotation detection with mySensors

Scheduled Pinned Locked Moved Hardware
16 Posts 6 Posters 2.3k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jeremushkaJ jeremushka

    Yes true. I just want to know the position of the gate without any actions on the motor speed, directions etc...

    I nee dto check out if i can connect an encoder to the DC Motor. Or maybe it exists some board to connect directly the motor on it ?

    dbemowskD Offline
    dbemowskD Offline
    dbemowsk
    wrote on last edited by
    #7

    @jeremushka My mistake, I thought you were also looking to reverse direction. For the position, I would put either a rotary encoder to count pulses or a potentiometer as the gate swings it's arc and then figure out the number of pulses needed for a full swing of the gate or pot position. Then from there you can do the math to figure out either percentage of open or closed, or the degree of arc for position.

    Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
    Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

    1 Reply Last reply
    0
    • jeremushkaJ Offline
      jeremushkaJ Offline
      jeremushka
      wrote on last edited by
      #8

      No problem :). For rotary encoder, you mean somthing like this to connect the wires to the DC motor? [https://m.ebay.com/itm/Rotary-Encoder-Module-Brick-Sensor-Development-Board-For-Arduino/310702417391?epid=11007575121&hash=item48574ea5ef:g:LXwAAOSwuzRXdgFL]

      YveauxY 1 Reply Last reply
      0
      • jeremushkaJ jeremushka

        No problem :). For rotary encoder, you mean somthing like this to connect the wires to the DC motor? [https://m.ebay.com/itm/Rotary-Encoder-Module-Brick-Sensor-Development-Board-For-Arduino/310702417391?epid=11007575121&hash=item48574ea5ef:g:LXwAAOSwuzRXdgFL]

        YveauxY Offline
        YveauxY Offline
        Yveaux
        Mod
        wrote on last edited by
        #9

        @jeremushka you have to connect the encoder shaft to the motor shaft in some way. The electronics go to an Arduino.

        http://yveaux.blogspot.nl

        1 Reply Last reply
        0
        • jeremushkaJ Offline
          jeremushkaJ Offline
          jeremushka
          wrote on last edited by
          #10

          I have just checked the DC motor. I have 2 wires for power supply and 2 wires probably to control it and connected to the controller board. I cannot connect the rotary encoder.

          YveauxY 1 Reply Last reply
          0
          • jeremushkaJ jeremushka

            I have just checked the DC motor. I have 2 wires for power supply and 2 wires probably to control it and connected to the controller board. I cannot connect the rotary encoder.

            YveauxY Offline
            YveauxY Offline
            Yveaux
            Mod
            wrote on last edited by
            #11

            @jeremushka not sure what all the wires are for. Pictures could help...
            You need a motor with integrated encoder, or need to couple the motor drive shaft to the encoder, using gears or something.

            http://yveaux.blogspot.nl

            1 Reply Last reply
            0
            • E Offline
              E Offline
              executivul
              wrote on last edited by
              #12

              Get the motor voltage down to measurable 0-5V by a resistor network and see rhe direction.
              Get the motor current by a hall/direct current sensor.
              Measure the time to open/close and you can guesstimate pretty accyrately the position and/or direction.

              1 Reply Last reply
              0
              • H Offline
                H Offline
                heller44
                wrote on last edited by
                #13

                Utrasonic distance measurement. Mysensors unit is nice and reliable as well.

                dbemowskD 1 Reply Last reply
                0
                • H heller44

                  Utrasonic distance measurement. Mysensors unit is nice and reliable as well.

                  dbemowskD Offline
                  dbemowskD Offline
                  dbemowsk
                  wrote on last edited by
                  #14

                  @heller44 Wouldn't the ultrasonic method have problems with a gate moving in an arc?

                  Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
                  Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

                  H 1 Reply Last reply
                  0
                  • jeremushkaJ jeremushka

                    I have created a node to control a sliding yard gate. I have added a second node to detect if the gate is closed or opened and to show the status in domoticz. So, far it has been working pretty well for the past 2 months.

                    However, i cannot the exact position of the gate when it is partially opened or closed. Indeed, the same push button from remote control or from domoticz is used to open and closed this gate.
                    Example: if i press the push button on the remote control to open the gate, the gate will start to open. I press again, the gate will stop. I will receive the status as the gate is opened. Then, if i press to the function on domoticz , the gate will start to close, etc...etc... Howeer, the status will keep "OPEN" until the gate will completely be closed. That's the point!

                    I have no way to know the exact position of the gate and the last status from mysensors node.

                    I am thinking to detect the rotation sense of the motor to know if the gate is in "opening mode" or "closing mode".

                    Does someone knows a component or a system to detect the rotation way of a DC Motor (+24V) ?

                    zboblamontZ Offline
                    zboblamontZ Offline
                    zboblamont
                    wrote on last edited by
                    #15

                    @jeremushka Perhaps instead of looking at the electronics for indication, look at what physically drives the sliding gate closed?
                    If it is a cog/rail type, it should be possible to detect rotation of the cog with a magnet and reed or similar and count off rotations?

                    1 Reply Last reply
                    0
                    • dbemowskD dbemowsk

                      @heller44 Wouldn't the ultrasonic method have problems with a gate moving in an arc?

                      H Offline
                      H Offline
                      heller44
                      wrote on last edited by
                      #16

                      @dbemowsk original query was for a sliding gate.

                      Anything else I would say just use 2 pairs of microswitches and if there is any ambiguity, drive direction until a change is noted. Keep it simple.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      18

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.1k

                      Posts


                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular