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

    No results with an ultra sound sensor

    Scheduled Pinned Locked Moved
    Using Duet Controllers
    5
    13
    380
    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.
    • fmeleardundefined
      fmeleard
      last edited by

      Hello,
      I need to connect an ultrasonic sensor (picture below) but I can't read the returns from the probe

      ar-module-de-detection-us-hc-sr04-20912.jpg

      I have done :
      m950 j0 c "io8.out" q10000 ; (the sound needs an implusion of 10u)
      The result is "Pin io8.out, active: true"
      But when I do "m950 j0" the result is always null....

      I don't understand why.

      Could you help me ?

      PS: I know that the ultra sound sensors are not precise but in my project I don't need precision of height

      Thanks in advance

      fcwiltundefined Phaedruxundefined dc42undefined 3 Replies Last reply Reply Quote 0
      • fcwiltundefined
        fcwilt @fmeleard
        last edited by fcwilt

        @fmeleard

        How are you responding to the input pin?

        Frederick

        Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

        fmeleardundefined 1 Reply Last reply Reply Quote 0
        • fmeleardundefined
          fmeleard @fcwilt
          last edited by

          @fcwilt How can I check?

          fcwiltundefined 1 Reply Last reply Reply Quote 0
          • fcwiltundefined
            fcwilt @fmeleard
            last edited by fcwilt

            @fmeleard

            Well it seems you have used io8.out to trigger the sensor but where have you connected the output signal from the sensor to the Duet?

            And you have io8.out configured as an input - is that allowed?

            Frederick

            Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

            fmeleardundefined 2 Replies Last reply Reply Quote 0
            • fmeleardundefined
              fmeleard @fcwilt
              last edited by

              @fcwilt said in No results with an ultra sound sensor:

              Well you have used io8.out to trigger the sensor but where have you connected the output signal from the sensor to the Duet?

              Yes, I have connected the following items:

              • 5V
              • GND
              • Trigger in out
              • Echo in in
              1 Reply Last reply Reply Quote 0
              • fmeleardundefined
                fmeleard @fcwilt
                last edited by

                @fcwilt And normally I configure the Out with m950 j0 c "io8.out" q10000 and I read the result with "m950 j0"...
                I think so

                fcwiltundefined 1 Reply Last reply Reply Quote 0
                • fcwiltundefined
                  fcwilt @fmeleard
                  last edited by

                  @fmeleard said in No results with an ultra sound sensor:

                  @fcwilt And normally I configure the Out with m950 j0 c "io8.out" q10000 and I read the result with "m950 j0"...
                  I think so

                  According to the M950 docs J is used for input pins and P or S for servo output pins.

                  Is the output of the device a digital signal (on/off) or an analog signal (varying voltage)?

                  Perhaps you should look at M558 and try treating the device as a probe.

                  Frederick

                  Printers: a small Utilmaker style, a small CoreXY and a E3D MS/TC setup. Various hotends. Using Duet 3 hardware running 3.4.6

                  1 Reply Last reply Reply Quote 0
                  • Phaedruxundefined
                    Phaedrux Moderator @fmeleard
                    last edited by Phaedrux

                    @fmeleard said in No results with an ultra sound sensor:

                    PS: I know that the ultra sound sensors are not precise but in my project I don't need precision of height

                    What exactly are you using it for? Endstop? Probe? Trigger?

                    Z-Bot CoreXY Build | Thingiverse Profile

                    fmeleardundefined 1 Reply Last reply Reply Quote 0
                    • fmeleardundefined
                      fmeleard @Phaedrux
                      last edited by

                      @phaedrux Hello,
                      I need some kind of Z probe.

                      My machine needs to do actions on variable terrain (from dirt). So I use an sensor ultrasonic to identify the height of the ground to trigger a DC motor.

                      My machine needs to work outdoors, so I don't use IR or Laser because of light disturbances, and I don't need to be accurate to the millimeter, but overall to the centimeter on the Z axis, so the sensor ultrasonic is fine.

                      My Need is:

                      1. You position yourself in X and Y (precisely)
                      2. You analyze the height of the ground -> Z (max analysis about 90 cm)
                      3. Go down Z (analysis of the height - the dimension of your current tool which can be variable depending on the current tool)
                      4. Engage the tool once it is in place
                      5. When it's done, you move Z back to the zero point of 0 (since there is vibration, I have to make sure Z hasn't 'moved' too much)
                      6. After your zero point, you go back to the tool change tray
                      7. You start the same process again with a tool that probably has a different height

                      I think it's a Z probe set up in a special way, I think

                      1 Reply Last reply Reply Quote 0
                      • dc42undefined
                        dc42 administrators @fmeleard
                        last edited by

                        @fmeleard please provide a link to the data for the sensor.

                        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

                        deckingmanundefined 1 Reply Last reply Reply Quote 0
                        • deckingmanundefined
                          deckingman @dc42
                          last edited by

                          @dc42 Here are a couple of links to data sheets and info for that sensor.

                          https://www.electroschematics.com/wp-content/uploads/2013/07/HC-SR04-datasheet-version-2.pdf

                          https://www.sparkfun.com/products/15569

                          @fmeleard I don't think that sensor will be much good for you application. I use a couple of them in my home automation coupled to ESP 32 modules. One senses the salt level in my water softener and I have an automation set up to send a notification to my 'phone when it gets low. However I have to filter the readings and take an average because typical variations between subsequent readings are between 14 and 20 cm. The other application I tried was as a presence detector to sense when I was sitting in my office chair and turn lights on/off accordingly (in conjunction with PIR motion and lux level sensors). For this application, I don't really care what the actual distance is but even so, I'm unable to reliably discriminate between a couple of cms and 10 cms so I've given up trying to use it.

                          Ian
                          https://somei3deas.wordpress.com/
                          https://www.youtube.com/@deckingman

                          dc42undefined 1 Reply Last reply Reply Quote 0
                          • dc42undefined
                            dc42 administrators @deckingman
                            last edited by

                            @deckingman thanks for the link.

                            @fmeleard that sensor needs a 10us pulse to trigger it, and then the length of the output pulse needs to be measured. The 10us pulse could be generated by a PWM-capable output pin, however RRF is not set up to measure the length of the input pulse. So I think your best bet would be to use an Arduino Nano or similar to drive that sensor with the 120us pulses and measure the pulse width, and set an output pin high if the pulse returned by the sensor is shorter than a specified width.

                            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 0
                            • fmeleardundefined
                              fmeleard
                              last edited by

                              @dc42 @deckingman Thanks for your feedback
                              Concerning the analysis, with my Raspberry, I get a pretty accurate analysis (a few millimeters)...

                              In this case, if I understand correctly, the simplest thing would be to analyze the distance with the Raspberry, and to send the displacement via my python program in Gcode...

                              This is a possibility.

                              Otherwise, for my need of height analysis (outdoors for a max distance of about 90 cm) without need of accuracy higher than a millimeter, would you have a tip for a probe more adapted to the Duet3?

                              Francis

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post
                              Unless otherwise noted, all forum content is licensed under CC-BY-SA