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. Announcements
  3. 💬 Distance Sensor

💬 Distance Sensor

Scheduled Pinned Locked Moved Announcements
92 Posts 18 Posters 27.7k Views 18 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.
  • Boots33B Boots33

    @jjk said in 💬 Distance Sensor:

    I have ordered some DYP and will give it another try.

    That's the spirit. My tank sensor using the DYP has been running for a few months now and is performing very well so far. During our summer we had daytime temperatures well over 40 deg c and the readings remained stable. So I think the DYP is up to the task.

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

    @Boots33 So it seems on balance from the above experiences that the DYP sensor is proven reliable in use once given good voltage but questions remain on the JSN. The DYP type is not so readily available at reasonable cost over here so will order up a JSN and trial it. If it fails at least it is only $10 wasted, if not, it will answer this puzzle.

    Boots33B 1 Reply Last reply
    0
    • zboblamontZ zboblamont

      @Boots33 So it seems on balance from the above experiences that the DYP sensor is proven reliable in use once given good voltage but questions remain on the JSN. The DYP type is not so readily available at reasonable cost over here so will order up a JSN and trial it. If it fails at least it is only $10 wasted, if not, it will answer this puzzle.

      Boots33B Offline
      Boots33B Offline
      Boots33
      Hero Member
      wrote on last edited by
      #42

      @zboblamont It will be good to see the final results of both yours and @jjk

      zboblamontZ 2 Replies Last reply
      1
      • Boots33B Boots33

        @zboblamont It will be good to see the final results of both yours and @jjk

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

        @Boots33 Still waiting on the gateway to arrive, as well as the DYP sensor, so had a go at assembling the electronics. Having red elsewhere about potential interference between a booster and ultrasonic, have mounted the booster with the ground plane facing the board and direct mounted onto the SR04T (I see this is 2.0 version which reportedly gave problems before). Although it works electrically with 3v firing the bistable relay feeding the booster feeding the SR04T, and switches off fine, any opinions on the proximity issues?
        0_1498892631584_WP_20170701_09_44_38_Pro[1].jpg
        0_1498892749650_WP_20170701_09_44_24_Pro[1].jpg

        Boots33B 1 Reply Last reply
        0
        • jjkJ jjk

          @zboblamont, excellent idea, but unfortunately my previous tries with the JSN-SR04T were in a "previous life" of arduino experimenting quite a while ago and at the time, I dumped pretty much most of it (I hate to say, the JSN failures were one if the reasons...). That said, I have ordered some DYP and will give it another try. The tips you and @Boots33 have provided should get me much farer than last time ;) The key information I guess I was missing at the time was the sensitivity to voltage.

          On another note... has anyone played around with alternative ways to measure water level, like a pressure tube or so? I'd be interested to see if that's an easier way, maybe?!

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

          @jjk Well I think I am done trying to get this JSN-SR04T-2.0 to work, tried different versions of ping and newping, as well as other sketches from suppliers of this device, but got no joy at all. Even separated the 5v booster in case of potential interference, no joy whatsoever.
          Recent complaints on supplier sites seem to confirm problems persist for this version 2.0, and on one site there was a note "Note: Version 2.0 requires echo pin to be pulled up to VCC. A 4.7K to 10K resistor can be used as pull-up resistor."
          Fat lot of use that is to me with a 3.3v unit, and if it needs a dedicate sketch to work, good luck with those sales..
          I guess I can only wait on the DYP to arrive now....

          1 Reply Last reply
          0
          • zboblamontZ zboblamont

            @Boots33 Still waiting on the gateway to arrive, as well as the DYP sensor, so had a go at assembling the electronics. Having red elsewhere about potential interference between a booster and ultrasonic, have mounted the booster with the ground plane facing the board and direct mounted onto the SR04T (I see this is 2.0 version which reportedly gave problems before). Although it works electrically with 3v firing the bistable relay feeding the booster feeding the SR04T, and switches off fine, any opinions on the proximity issues?
            0_1498892631584_WP_20170701_09_44_38_Pro[1].jpg
            0_1498892749650_WP_20170701_09_44_24_Pro[1].jpg

            Boots33B Offline
            Boots33B Offline
            Boots33
            Hero Member
            wrote on last edited by
            #45

            @zboblamont Still no luck with the JSN unit I see. Hope the DYP unit will bring better results.

            zboblamontZ 2 Replies Last reply
            0
            • Boots33B Boots33

              @zboblamont Still no luck with the JSN unit I see. Hope the DYP unit will bring better results.

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

              @Boots33 It seems that the newer version (2.0) is the one giving problems, the previous version did not. Presumably the sensor head is unchanged and common across all of them, so perhaps not a total waste of $10.
              It will be interesting to see if mounting the 5v booster so close on the DYP causes any issues, as it makes for a compact arrangement in a corner of a box.
              As an aside, with one of these heads needed in a sewage tank I needed a robust holder. The sensor head is a snug fit in the big end of a 3/4" to 1/2" GS tube reducer, giving both protection and rigidity.

              1 Reply Last reply
              0
              • ArthurA Offline
                ArthurA Offline
                Arthur
                wrote on last edited by
                #47

                I have tried to compile this sketch, but it fails, see error below. Any idea what's the reason and how it can be fixed ?
                I use the latest Arduino 1.8.3 (windows) version, mysensors 2.x and the above NewPing library.

                C:\Users\arthur\AppData\Local\Temp\ccAlQHJ9.ltrans2.ltrans.o: In function `setup':

                Y:_Domotica\NRF24L01\DistanceSensor/DistanceSensor.ino:53: undefined reference to `getControllerConfig()'

                collect2.exe: error: ld returned 1 exit status

                exit status 1
                Fout bij het compileren van board Arduino/Genuino Uno

                1 Reply Last reply
                0
                • ArthurA Offline
                  ArthurA Offline
                  Arthur
                  wrote on last edited by
                  #48

                  Fixed the problem by changing some code:
                  void setup()
                  {
                  Serial.begin(115200);
                  // metric = getControllerConfig().isMetric;
                  }

                  1 Reply Last reply
                  0
                  • Boots33B Boots33

                    @zboblamont Still no luck with the JSN unit I see. Hope the DYP unit will bring better results.

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

                    @Boots33 Now I am flummoxed.... Got the DYP unit and yet, no difference in responses.... I can only conclude this has to be a hardware or device issue, as I checked all wiring (unless I missed something really stupid), tried the same 6 sketches even on a spare 3v3 device with the same result. Now ordered up a couple of Pro-Mini 5v to check out whether this is a 5v related issue since I cannot create a timed response otherwise, nothing makes sense with respect to the ultrasonic units now otherwise unless my earlier information that 3v3 was sufficient to trigger the device was wrong... Time for a slow drink, a long smoke, and shout abuse at passing dogs.... Nice weather, 26c, Friday, what's not to smile about.... Ah, Port..

                    1 Reply Last reply
                    0
                    • Boots33B Boots33

                      @zboblamont It will be good to see the final results of both yours and @jjk

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

                      @Boots33 Well, finally I got some positive results, but not quite as expected...
                      The JSN-SR04T-2.0 nor the DYP-ME007Y I could get to work on all six variations of sketches tried. Still not sure why neither would work using this 3v3 board even with 5v to the ultrasonic board and dropper resistors on the echo. Allegedly the ping from 3.3v should work.

                      So, bought and finished today trialling a 5v/16MHz Pro-Mini ;
                      The JSN version 2.0 nor the DYP would not respond to NewPing, simply churning out zeroes.
                      Other sketches would turn out fixed numbers and zeroes which did not alter irrespective of the transducer/object distance.
                      The JSN finally got working with a simple PulseIn calculation loop with a 500 delay. First reading was always Zero, all the rest consistent and rock solid.
                      The DYP unexpectedly responded only to the SoftwareSerial method originally found to work from a Russian site. The readings are spot on from the start.

                      Now that they work, I need to figure out if there is a workaround for the 3.3v transceiver node....
                      Phew....

                      Boots33B 1 Reply Last reply
                      2
                      • zboblamontZ zboblamont

                        @Boots33 Well, finally I got some positive results, but not quite as expected...
                        The JSN-SR04T-2.0 nor the DYP-ME007Y I could get to work on all six variations of sketches tried. Still not sure why neither would work using this 3v3 board even with 5v to the ultrasonic board and dropper resistors on the echo. Allegedly the ping from 3.3v should work.

                        So, bought and finished today trialling a 5v/16MHz Pro-Mini ;
                        The JSN version 2.0 nor the DYP would not respond to NewPing, simply churning out zeroes.
                        Other sketches would turn out fixed numbers and zeroes which did not alter irrespective of the transducer/object distance.
                        The JSN finally got working with a simple PulseIn calculation loop with a 500 delay. First reading was always Zero, all the rest consistent and rock solid.
                        The DYP unexpectedly responded only to the SoftwareSerial method originally found to work from a Russian site. The readings are spot on from the start.

                        Now that they work, I need to figure out if there is a workaround for the 3.3v transceiver node....
                        Phew....

                        Boots33B Offline
                        Boots33B Offline
                        Boots33
                        Hero Member
                        wrote on last edited by
                        #51

                        @zboblamont it certainly has been a bumpy road for you. good to see you making some headway.

                        1 Reply Last reply
                        1
                        • ben999B Offline
                          ben999B Offline
                          ben999
                          wrote on last edited by ben999
                          #52

                          I've been fighting with DYP-ME007Y myself for the last few days...
                          Originally i wanted to monitor the level of a water tank with an SR04 ; as it is not waterproof i assumed that it would die fairly quickly.
                          So i ordered a DYP-ME007... but the last letter ("Y") means that it uses serial communication, so the ping Library doesn't apply.
                          Bouncing from site to site i found the following code that @zboblamont refers to :

                          #include <SoftwareSerial.h>
                          
                          SoftwareSerial mySerial =  SoftwareSerial(10,11); 
                          
                          #define echoPin 10
                          #define trigPin 11
                          
                          unsigned int reading;
                          byte readByte;
                          byte read_buffer[4]; 
                          byte crcCalc;
                          word distance;
                          String outText;
                          
                          void setup() {
                            mySerial.begin (9600);
                          
                            Serial.begin (9600);
                            Serial.println("start");
                            for (byte loopstep = 0; loopstep <= 3; loopstep++) {
                              read_buffer[loopstep] = 0;
                            }
                          }
                          
                          void loop() {
                            if (mySerial.available() < 1) {
                              return;  
                            }
                            readByte = mySerial.read();
                            
                            for (byte loopstep = 0; loopstep <= 2; loopstep++) {
                              read_buffer[loopstep] = read_buffer[loopstep + 01];
                            }
                            read_buffer[03] = readByte;   
                            if (read_buffer[00] != 0xff) {
                              return;
                            };
                            crcCalc = read_buffer[00] + read_buffer[01] + read_buffer[02];
                            if (read_buffer[03] != crcCalc) {
                              return;
                            };
                            distance = (read_buffer[01] * 0xff) + read_buffer[02];
                            outText = "bytes: ";
                            outText = String(outText + read_buffer[00]);
                            outText = String(outText + "+");
                            outText = String(outText + read_buffer[01]);
                            outText = String(outText + "+");
                            outText = String(outText + read_buffer[02]);
                            outText = String(outText + "+");
                            outText = String(outText + read_buffer[03]);
                            outText = String(outText + " = ");
                            outText = String(outText + distance);
                            outText = String(outText + " mm");
                            
                            Serial.println(outText);
                          
                            delay(1000);
                          
                            while (mySerial.available() > 0) {
                               readByte = mySerial.read();
                            }
                          }
                          

                          Worked first shot

                          zboblamontZ 1 Reply Last reply
                          1
                          • ben999B ben999

                            I've been fighting with DYP-ME007Y myself for the last few days...
                            Originally i wanted to monitor the level of a water tank with an SR04 ; as it is not waterproof i assumed that it would die fairly quickly.
                            So i ordered a DYP-ME007... but the last letter ("Y") means that it uses serial communication, so the ping Library doesn't apply.
                            Bouncing from site to site i found the following code that @zboblamont refers to :

                            #include <SoftwareSerial.h>
                            
                            SoftwareSerial mySerial =  SoftwareSerial(10,11); 
                            
                            #define echoPin 10
                            #define trigPin 11
                            
                            unsigned int reading;
                            byte readByte;
                            byte read_buffer[4]; 
                            byte crcCalc;
                            word distance;
                            String outText;
                            
                            void setup() {
                              mySerial.begin (9600);
                            
                              Serial.begin (9600);
                              Serial.println("start");
                              for (byte loopstep = 0; loopstep <= 3; loopstep++) {
                                read_buffer[loopstep] = 0;
                              }
                            }
                            
                            void loop() {
                              if (mySerial.available() < 1) {
                                return;  
                              }
                              readByte = mySerial.read();
                              
                              for (byte loopstep = 0; loopstep <= 2; loopstep++) {
                                read_buffer[loopstep] = read_buffer[loopstep + 01];
                              }
                              read_buffer[03] = readByte;   
                              if (read_buffer[00] != 0xff) {
                                return;
                              };
                              crcCalc = read_buffer[00] + read_buffer[01] + read_buffer[02];
                              if (read_buffer[03] != crcCalc) {
                                return;
                              };
                              distance = (read_buffer[01] * 0xff) + read_buffer[02];
                              outText = "bytes: ";
                              outText = String(outText + read_buffer[00]);
                              outText = String(outText + "+");
                              outText = String(outText + read_buffer[01]);
                              outText = String(outText + "+");
                              outText = String(outText + read_buffer[02]);
                              outText = String(outText + "+");
                              outText = String(outText + read_buffer[03]);
                              outText = String(outText + " = ");
                              outText = String(outText + distance);
                              outText = String(outText + " mm");
                              
                              Serial.println(outText);
                            
                              delay(1000);
                            
                              while (mySerial.available() > 0) {
                                 readByte = mySerial.read();
                              }
                            }
                            

                            Worked first shot

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

                            @ben999 So glad it worked, I tormented myself as a newbie in Arduinoworld. I didn't realise that the 'Y' was significant though, I recall others saying it fitted NewPing like a glove...
                            I don't think it helps when there are so many conflicting model numbers for completely (physically) different devices...
                            Hey ho....

                            1 Reply Last reply
                            0
                            • jjkJ Offline
                              jjkJ Offline
                              jjk
                              wrote on last edited by
                              #54

                              hi folks, received my DYP-ME007Y finally, tried it and got the same inconsistent readings with the old sketch that @zboblamont and others reported. I was excited to see the code that @ben999 found and tested successfully - but I don't even get past the "start" print out in the serial monitor. the LED on the DYP board is flashing eagerly, but it doesn't look like it gets any readings... Have you guys changed anything else to get it t work?

                              1 Reply Last reply
                              0
                              • jjkJ Offline
                                jjkJ Offline
                                jjk
                                wrote on last edited by
                                #55

                                update: we're getting there... after a bit a tweaking and trying different angles, I'm now getting readings. The good news: in one position, when readings come in, they are consistent. The bad news: as soon as I move the sensor head, it's a gamble, in some cases the readings are o.k., in other cases it drops to 0mm... Anybody has seen a similar effect?

                                ben999B zboblamontZ 2 Replies Last reply
                                0
                                • jjkJ jjk

                                  update: we're getting there... after a bit a tweaking and trying different angles, I'm now getting readings. The good news: in one position, when readings come in, they are consistent. The bad news: as soon as I move the sensor head, it's a gamble, in some cases the readings are o.k., in other cases it drops to 0mm... Anybody has seen a similar effect?

                                  ben999B Offline
                                  ben999B Offline
                                  ben999
                                  wrote on last edited by
                                  #56

                                  @jjk sensor head need to be perpendicular to surface being measured?

                                  1 Reply Last reply
                                  0
                                  • jjkJ jjk

                                    update: we're getting there... after a bit a tweaking and trying different angles, I'm now getting readings. The good news: in one position, when readings come in, they are consistent. The bad news: as soon as I move the sensor head, it's a gamble, in some cases the readings are o.k., in other cases it drops to 0mm... Anybody has seen a similar effect?

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

                                    @jjk If the readings you ARE getting are accurate when moved to new positions, it could as @ben999 said be inaccurate alignment to the reflective surface, or as was commented somewhere else, the plug/socket on the board being loose.
                                    With a 3/4 to 1/2 reducer on a 1/2 pipe ready here for final installation, I sat transducer the socket to take out movement or alignment issues, it drifts off quite readily if angle is wrong. The code Ben refers to for this DYP gave me a slightly lower but not silly first reading then consistent results thereafter, no zeroes.

                                    Please note that I had tried all 6 sketch variants on the 3.3v device with a 5v DYP supply and got nonsense. Using the 3.3v Trig with drop resistors on the Echo neither the JSN nor the DYP worked properly despite the 5v power from the separate booster supply to them.
                                    I only found consistency using a 5v pro-mini, with the DYP power supplied from logic pins, which leads me to think Trig and/or Echo are also 5v sensitive, contradicting previous advice and complicating my layout.

                                    Have not yet got round to trialling a logic converter from the 3.3v pro-mini for Trig and Echo with the original 5v supply, which is the next step, will report back once I get some time to test.

                                    1 Reply Last reply
                                    1
                                    • jjkJ Offline
                                      jjkJ Offline
                                      jjk
                                      wrote on last edited by
                                      #58

                                      @ben999 and @zboblamont thanks for the swift feedback and advice. I think you are right, the DYP seems to be VERY sensitive to alignment. The tests I did were "handheld" and readings jumped arbitrarily btw zeroes, accurate, and off values. I've done a few tests now with the sensor head fixed and more aligned to the target surface and that seems to work out much better now. I also found that readings get less accurate above 1m, though?!

                                      1 Reply Last reply
                                      0
                                      • jjkJ Offline
                                        jjkJ Offline
                                        jjk
                                        wrote on last edited by
                                        #59

                                        btw. I'm using a pro mini 5V to power and trigger the DYP at the moment. Have played with an external 5V supply, but that didn't seem to make a noticeable difference.

                                        zboblamontZ 1 Reply Last reply
                                        0
                                        • jjkJ jjk

                                          btw. I'm using a pro mini 5V to power and trigger the DYP at the moment. Have played with an external 5V supply, but that didn't seem to make a noticeable difference.

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

                                          @jjk Sounds like you're getting there, it should be no problem with the 5v pro-mini, the only variables should be alignment and sketches.

                                          To clarify, I only got a 5v pro-mini to figure out whether the DYP and JSN devices would work, which they did after trying different sketches. Those same sketches had retrieved garbage on the 3.3v pro-mini, despite a separate 5v supply to the DYP, running contrary to experience of others. That supply was unnecessary with the 5v pro-mini.

                                          As the 3.3v is the intended battery powered radio node, I need the DYP to work with it, hence the logic level converter being the next attempt to get the DYP to work with the node.

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


                                          9

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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