• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

possibility to read tacho signals with lower rpm

Scheduled Pinned Locked Moved
Firmware wishlist
5
11
721
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.
  • undefined
    cosmowave
    last edited by 27 Aug 2022, 11:28

    As far as i know, RRF3.4 is able to read tacho signals down to 160 rpm.
    I'd like to read a tacho signal of 35 rpm...

    Is this possible?

    Mankati FSXT+, DeltaTowerV2, E3D MS/TC

    undefined undefined 2 Replies Last reply 27 Aug 2022, 20:54 Reply Quote 0
    • undefined
      OwenD @cosmowave
      last edited by 27 Aug 2022, 20:54

      @cosmowave
      It's obviously one for DC42, but I would think that it'd be pretty hard to get any sort of meaningful accuracy and resolution at those RPM's unless your fan gives multiple pulses per revolution.
      If it's a single pulse you have less than one per second.
      If you counted every 5 (60/12) seconds you'd get 2 Pulses @ 35rpm
      Multiply by 12 gives a reading of 24rpm.
      Likewise you'd get the same indicated reading at 60rpm and 70rpm.

      1 Reply Last reply Reply Quote 0
      • undefined
        o_lampe @cosmowave
        last edited by 28 Aug 2022, 08:14

        @cosmowave Such a slow RPM value can be seen as sign of live
        Just read the tacho.signal every 5 sec in daemon.g and if it's >0 you're safe.

        undefined 1 Reply Last reply 29 Aug 2022, 11:33 Reply Quote 1
        • undefined
          cosmowave @o_lampe
          last edited by 29 Aug 2022, 11:33

          @o_lampe you're right. For "a sign of life" this will be ok.

          Perhaps @dc42 can answer if it is possible to reduce the allowed minimum tacho pulses per minute further. But i know, this is a very low tacho rpm...

          Mankati FSXT+, DeltaTowerV2, E3D MS/TC

          undefined 1 Reply Last reply 12 Sept 2022, 12:36 Reply Quote 0
          • undefined
            cosmowave @cosmowave
            last edited by 12 Sept 2022, 12:36

            This post is only for information and for closing this point!

            The problem with my tacho signal is solved.
            I have developed a signal multiplier/divider with a raspberry pi pico. The system is able to multiply or divide an incoming (tacho) signal with a factor between 1 and 15.
            When i multiply my flowmeter tachosignal with factor 5, i'm allways in a range which RRF can read.

            If somebody has a similar problem, i'm happy to share my project.

            Mankati FSXT+, DeltaTowerV2, E3D MS/TC

            undefined undefined 2 Replies Last reply 12 Sept 2022, 12:46 Reply Quote 2
            • undefined
              jay_s_uk @cosmowave
              last edited by 12 Sept 2022, 12:46

              @cosmowave always good to make something like that available

              Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

              1 Reply Last reply Reply Quote 0
              • undefined
                dc42 administrators @cosmowave
                last edited by dc42 12 Sept 2022, 13:37

                @cosmowave I'm glad that you found a solution.

                RRF counts 16 tacho pulses, then divides the time in seconds over which those 16 pulses were counted by 30 * 16 to get the rpm. If 16 pulses are not received over 3 seconds then RRF assumes that the fan is not running.

                To read as low 35 RPM we would need to extend that time from 3 seconds to about 16 seconds; but that would cause a 16-second delay after turning the fan off before the displayed rpm changes from its previous value to zero. I deemed 3 seconds to be as much as could be tolerated.

                Duet WiFi hardware designer and firmware engineer
                Please do not ask me for Duet support via PM or email, use the forum
                http://www.escher3d.com, https://miscsolutions.wordpress.com

                1 Reply Last reply Reply Quote 2
                • undefined
                  cosmowave
                  last edited by cosmowave 9 Dec 2022, 22:08 12 Sept 2022, 22:06

                  @dc42 I understand completely that you can't go lower with the allowed rpm.

                  For everybody who likes to rebuild the system a short description.
                  This was my very first project with a raspberry pico and the programming language Python (MicroPython). So i'm sure, my code is horrible! But it works at least on my breadboard.

                  If someone can help me to change the sleep command in "def core_task():" (Line44) to a timer with interrupt, that would be great.

                  The pico was perfect because of the two cores. I use core0 to measure the incoming signal, core1 for generating the output signal. The Input is on GP20(pin26) with pullup. Output on GP21(pin27) with open collector.
                  Schema.png
                  When you switch GP1(pin2) to GND, the ouput signal will be divided (slower).
                  With switching GP2 - GP5 to GND you can "Bitwise" choose a multiply/divide factor betwee 1 to 15. (untested until now!)
                  If you switch nothing to GND, my default is set (multiply with factor 5).
                  Signal.png
                  The incoming signal doesn't need to be symetric, it switchs on the falling edge. The output is with 50% duty cycle.

                  And here my first MicroPython code, written with the Thonny IDE. Eventually it is a bit chaotic. It tooks me two evenings for debugging until it was running without warning! 😬

                  #----------------------------------#
                  # File name: TachoMod.py           #
                  # Author: cosmowave                #
                  # Date created: 6.9.2022           #
                  # Date last modified: 10.9.2022    #
                  # Version 1.4                      #
                  #----------------------------------#
                  
                  # imports
                  from machine import Pin
                  import time
                  import _thread
                  
                  # variable definition
                  global Multiply           # variable for multiply or divide
                  Multiply = True
                  global Factor             # factor for multiply/divide
                  Factor = 0
                  global TachoInPeriod      # time of the incoming tachosignal period in ms
                  global TachoOutPeriod     # time of the outgoing tachosignal period in ms
                  global FirstReading       # true when first reading of the falling edge is needed (timer start)
                  FirstReading = True
                  global OutputEnable       # enables the outgoing tachosignal
                  OutputEnable = False
                  global start              # start of timer
                  global RunCore1           # flag if core1 is already running
                  RunCore1 = False
                  
                  # ----core1 task (calculate and generate outgoing tachosignal when activated trough core0)----
                  # read OutputEnable, calculate TachoOutPeriod, generate tacho output
                  def core_task():
                      global TachoOutPeriod
                      global RunCore1
                      global Multiply
                      global TachoInPeriod
                      global Factor
                      
                      while OutputEnable == True:                             # output on?
                          if Multiply == True:                                # multiply (faster output signal)
                              TachoOutPeriod = int(TachoInPeriod / Factor)
                          else:                                               # divide (slower output signal)
                              TachoOutPeriod = int(TachoInPeiod * Factor)
                          OutTachoDuet.toggle()                               # toggle tacho output
                          time.sleep_ms(int(TachoOutPeriod / 2))              # wait a "half period" to toggle output again
                      RunCore1 = False
                      _thread.exit()                                          # shut off core1
                  
                  OutTachoDuet=Pin(21, Pin.OPEN_DRAIN, value=1)               # tachosignal output (open drain) for DUET
                  
                  # ----core0 task (input reading, measuring incoming tachosignal)----
                  # interrupt handler at falling edge of tacho input, measures tacho input, sets OutputEnable, starts/stops core1
                  def InTacho_readTask(pin):            # interrupt from tacho input
                      global start
                      global FirstReading
                      global OutputEnable
                      global RunCore1
                      global TachoInPeriod
                      
                      if FirstReading == True:       # first falling edge?
                          start = time.ticks_ms()    # get millisecond counter
                          FirstReading = False
                      else:
                          TachoInPeriod = time.ticks_diff(time.ticks_ms(), start)  # compute time difference between falling edges
                          start = time.ticks_ms()                                  # start a new timer
                          OutputEnable = True                                      # activate tacho output
                          if RunCore1 == False:                                    # core1 already running?
                              RunCore1 = True
                              _thread.start_new_thread((core_task),())             # start core1
                  
                  InTachoFlowmeter=Pin(20, Pin.IN, Pin.PULL_UP)                              # flowmeter tachosignal, with pullup(switch to GND)
                  InTachoFlowmeter.irq(trigger=Pin.IRQ_FALLING, handler=InTacho_readTask)    # interrupt on falling edge
                  
                  
                  #----main task----
                  # read multiply/divide input
                  global Multiply
                  global Factor
                  InMultiDiv=Pin(1, Pin.IN, Pin.PULL_DOWN)  # multiply/divide input, with pulldown(switch to VCC)
                  if InMultiDiv.value() == 0:
                      Multiply = True           # multiply
                  else:
                      Multiply = False          # divide
                   
                  # read factor inputs
                  InFactorBit0=Pin(2, Pin.IN, Pin.PULL_DOWN)     # factor bit0 input, with pulldown(switch to VCC)
                  InFactorBit1=Pin(3, Pin.IN, Pin.PULL_DOWN)     # factor bit1 input, with pulldown(switch to VCC)
                  InFactorBit2=Pin(4, Pin.IN, Pin.PULL_DOWN)     # factor bit2 input, with pulldown(switch to VCC)
                  InFactorBit3=Pin(5, Pin.IN, Pin.PULL_DOWN)     # factor bit3 input, with pulldown(switch to VCC)
                  if InFactorBit0.value() == 1:
                      Factor = 1
                  if InFactorBit1.value() == 1:
                      Factor = (Factor + 2)
                  if InFactorBit2.value() == 1:
                      Factor = (Factor + 4)
                  if InFactorBit3.value == 1:
                      Factor = (Factor + 8)
                  if Factor == 0:               # no factor bit setted -> set to default = 5
                      Factor = 5  
                      
                  #----Main loop----
                  # check if no tacho input since 3seconds to switch off output
                  
                  while True:
                      global start
                      global OutputEnable
                      global FirstReading
                      while OutputEnable == True:
                          if time.ticks_diff(time.ticks_ms(), start) > 3000:   # more than 3000ms without tacho input
                              OutputEnable = False                             # shut off output (core1)
                              FirstReading = True                              # allow next "first reading"
                  

                  Mankati FSXT+, DeltaTowerV2, E3D MS/TC

                  1 Reply Last reply Reply Quote 1
                  • undefined
                    cosmowave
                    last edited by 18 Oct 2022, 09:24

                    This post is just for info:

                    I have expanded this "TachoMod" project a bit.
                    Actual version is V4.0 with the following additional functions:

                    • Raspberry Pico has now a small OLED-Display (with 2 buttons) for displaying datas and enabling a menu
                    • Tacho-signal period and rpm of in-/output is displayed
                    • Menu for changing multiply/divide mode, factor, timeout, pulse per revolution
                    • stores all settings on onboard memory

                    If someone is interessed, i can share the source code and additional infos...

                    Mankati FSXT+, DeltaTowerV2, E3D MS/TC

                    undefined 1 Reply Last reply 18 Oct 2022, 09:28 Reply Quote 2
                    • undefined
                      jay_s_uk @cosmowave
                      last edited by 18 Oct 2022, 09:28

                      @cosmowave said in possibility to read tacho signals with lower rpm:

                      If someone is interessed, i can share the source code and additional infos...

                      Always!

                      Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

                      1 Reply Last reply Reply Quote 0
                      • undefined
                        cosmowave
                        last edited by 18 Oct 2022, 18:09

                        On the hardware side i've used following parts:

                        • a Raspberry Pi Pico
                        • Waveshare 1.3 inch OLED, https://www.waveshare.com/wiki/Pico-OLED-1.3
                        • two small diodes (1N4148)

                        Optional parts for the housing:

                        • housing, PicoGehäuse.STL
                        • TPU front cover, DeckelFolie4.STL
                        • TPU cable outlet, KabeldurchfPicoAssy.STL

                        TachoMod.jpg
                        Sorry, the photo is not very sharp! And i know, the "S" on the TPU front cover is "upside down"...

                        The wiring remains like in my post from 13.9.22 except that i have inserted the 2 diodes in the signal lines. Also there is no need to set the "input bits" because we have a menu for changing the settings.

                        The TachoMod starts automatically when an input signal is detected. After start, it shows the period duration and the rpm of the incoming(top) and outgoing signals(bottom). see photo above

                        With the "S" button you can enter the menu (only possible when no input signals are detected), the "+" button increments values in the menu.
                        The following settings are implemented:

                        • Multiply/Divide Mode: “/” or “x” ; Makes output faster or slower compared to input signal
                        • Factor (multiply or divide): 1-16
                        • Delay time: 1-9999ms ; after which time without inputsignal the output will be switched off
                        • Pulse per revolution: 1-16 (normally 2) ; for calculating the correct rpm values

                        All settings will be stored automatically to onboard flash memory after leaving the menu.

                        And here is the source code of TachoMod_V4.0, written in microPython with ThonnyIDE.
                        TachoMod_V4_0.py
                        The code will be far away from "perfect", but it works.
                        And it was a really nice project for my first steps with a Raspberry Pico and the programming language Python.

                        I hope this description is more or less understandable and sorry for my bad english...😰

                        Mankati FSXT+, DeltaTowerV2, E3D MS/TC

                        1 Reply Last reply Reply Quote 1
                        • undefined cosmowave referenced this topic 19 Jan 2024, 22:23
                        • First post
                          Last post
                        Unless otherwise noted, all forum content is licensed under CC-BY-SA