REXYGEN Community Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Login

    Solved Fan Speed Control with Counter

    Monarco HAT
    2
    11
    903
    Loading More Posts
    • 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.
    • M
      MikeyH
      last edited by MikeyH

      Hi All,

      I'm having some issues getting the Monarco to control fan speed correctly. I've had it working many times, only now the fan motor has the optocouplers onboard, now with a counter.

      I used to wire the speed input to 5v and the common back to Dout1, worked perfectly 0-100% = 400-2000rpm. Control now appears to be in reverse. lower duty cycle = faster.

      I also can't get the counter working. The couplers have a speed feedback (counter, 2 pulses per revolution) I'd like to use. I also can't seem to get this working.

      6b76a7f2-aebd-40c1-ae53-30e92555bf57-image.png
      e25a88fb-0391-4f41-b7f2-966568464791-image.png

      Just checking what I may of done wrong here. I think if I wire the fan the old way, it will work. But this would mean the speed output wouldn't.

      Cheers

      Mike

      M 1 Reply Last reply Reply Quote 0
      • M
        MikeyH @MikeyH
        last edited by

        Update:

        So I have the variable fan speed working now. I had to reverse the output (duty cycle) using a LIN or CNDR block (0rpm=100%, 2000rpm=0%) Not ideal but it works. How it's wired is shown below.
        0b572c4d-cb76-4800-983f-489912b35a06-image.png
        Current test program
        6622f74d-68e6-4a93-8b51-e8c4cdc3215a-image.png

        I still can't get the tachnometer working though. So any ideas or things people can see I've done wrong. I just don't even get a value to post process into RPM.
        29633863-91a9-4e91-84e5-48ef956abe3b-image.png

        Cheers

        Mike

        R 1 Reply Last reply Reply Quote 0
        • R
          reitinge @MikeyH
          last edited by

          @mikeyh
          Hi Mike,
          have you tried if the Monarco counter works if you connect some voltage directly to DIN1? What is the voltage at the tachometer output?
          Cheers,
          Jan

          M 1 Reply Last reply Reply Quote 0
          • M
            MikeyH @reitinge
            last edited by

            @reitinge Hi Jan,

            Can I use the 5v or 24v off the HAT for this? Or does it need to be off board?

            I’ve seen the counter count. But it seemed to go up in strange numbers. And stopped at 14. It was an accumulative count of sorts.

            4, 7, 14, then stopped. Altering speed did nothing to effect the numbers

            Cheers

            Mike

            R 1 Reply Last reply Reply Quote 0
            • R
              reitinge @MikeyH
              last edited by

              @mikeyh
              According to this article, anything between 3.5 and 30V should be taken as logic 1. So it should be possible to use 5 and 24 V directly from the Monarco HAT for testing.

              Increasing the number also happened to me during testing. I think it might have something to do with the pull up resistor, but I'd better ask an electrical expert tomorrow and let you know.

              Cheers,
              Jan

              M 1 Reply Last reply Reply Quote 0
              • M
                MikeyH @reitinge
                last edited by

                @reitinge Hi Jan,

                I've just tried putting 24v directly onto Din1 and it counts up. So I'm thinking maybe could be the resistor, as you said.

                Is the counter I'm using also the right thing for this? Measuring RPM from an optocoupler? As I'm after a speed not an accumulative count.

                Cheers
                Mike

                R 1 Reply Last reply Reply Quote 0
                • R
                  reitinge @MikeyH
                  last edited by

                  @mikeyh Hi Mike,
                  I don't know if this is the right way to measure speed. I'd rather say it's probably the only way to measure speed with just the Monarco HAT. You can use math blocks to calculate the number of ticks in a certain time (see image bellow). In the DELM block I set a delay of 1s and in the CNR block there is also a value of 1. So I get the number of ticks per second on the DIV output. Of course, you can choose another time period.

                  Alternatively, you can use the DIF_ block directly (see doc here).

                  If you only need this information for observing, it will be ok. If you would like to control the rotation speed accordingly, you will need to filter the values ​​and it will probably be a lot of work.

                  8b760a02-5ebf-4e7d-bf1b-e6d2a4e34a90-image.png

                  Cheers,
                  Jan

                  M 1 Reply Last reply Reply Quote 0
                  • M
                    MikeyH @reitinge
                    last edited by

                    @reitinge Hi Jan,

                    That seems to do something. I've added a MUL block to *60. Might need tuning or level tick changing. RPM seems to be 100-150 low compared to requested speed.

                    07db2d48-acad-4e59-958a-fcfecf27dded-image.png
                    887d8cf6-0d8a-452d-ab5e-698ce5928215-image.png
                    e105680f-4668-4105-9fe5-bceaf0244c89-image.png
                    733ac30d-f42c-4646-a77f-ccdce0371e59-image.png

                    Are the counter resets required or are they just incase you want to reset the count?

                    This is only for monitoring by the way. The fan reduces speed when torque demand is to high. So it's nice to just track requested speed against actual speed.

                    Cheers

                    Mike

                    R 1 Reply Last reply Reply Quote 0
                    • R
                      reitinge @MikeyH
                      last edited by

                      @mikeyh
                      Hi Mike,
                      it doesn't look bad. If you only want to monitor revolutions per minute, you can set a delay of 60 in the DELM block and delete the DIV and MUL blocks. I prepared a DIV block just for case you want a value in seconds.

                      Counter reset is only for timely reset so that the value does not overflow. But the counters are 16-bit. So the value doesn't overflow for a while.

                      Cheers,
                      Jan

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        MikeyH @reitinge
                        last edited by

                        @reitinge
                        Thanks Jan,

                        I kept the DIV block in the end as using a 1sec delay gives faster response than waiting the whole minute to count.

                        Thanks for your help as always.

                        Cheers

                        Mike

                        R 1 Reply Last reply Reply Quote 0
                        • R
                          reitinge @MikeyH
                          last edited by

                          @mikeyh You are welcome.
                          Cheers,
                          Jan

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          This is a community forum for REXYGEN users and fans. Detailed information can be found at REXYGEN homepage.

                          There is also an outdated REXYGEN community forum.

                          Powered by NodeBB.