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.
  • jjkJ Offline
    jjkJ Offline
    jjk
    wrote on last edited by
    #34

    @Boots33 thanks for your detailed response! Is the DYP-ME007 the same as the JSN-SR04? As my experience with the latter is not too exciting... Anyways, I might as well give it another try! Also, thanks for the lead to your project and the median filtering in newping. I will definitely look into that and might just have to increase the number of readings the node takes and than filter for a transmission every 15 mins or so.

    Boots33B 1 Reply Last reply
    0
    • jjkJ jjk

      @Boots33 thanks for your detailed response! Is the DYP-ME007 the same as the JSN-SR04? As my experience with the latter is not too exciting... Anyways, I might as well give it another try! Also, thanks for the lead to your project and the median filtering in newping. I will definitely look into that and might just have to increase the number of readings the node takes and than filter for a transmission every 15 mins or so.

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

      @jjk said in 💬 Distance Sensor:

      Is the DYP-ME007 the same as the JSN-SR04

      They certainly look the same but not sure if they are identical. definitely check on the power, i went around in circles for a while and was nearly ready to give up on the DYP until i found they are very fussy on voltage. at 4.7v I could not get mine to be stable over 1.2m yet it was still rock solid under 1.2m.... nearly drove me crazy :)

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

        @Boots33 o.k. that's good advice! I just ordered some DYP and they have a bit of a lead time, that gives me time to think about getting an extra and stable 5V to the sensor.

        zboblamontZ 1 Reply Last reply
        0
        • jjkJ jjk

          @Boots33 o.k. that's good advice! I just ordered some DYP and they have a bit of a lead time, that gives me time to think about getting an extra and stable 5V to the sensor.

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

          @jjk The JSN-SR04 looks very similar to the DYP-ME007 sensor, but what I found even more confusing is that there is a direct board mounted single transducer type advertised under the same type number for both models numbers when you do a search. As Boots33 has said and not the first to say it, these seem very voltage 'fussy'. I was about to order a JSN-SR04T variety to test out when I spotted this exchange. If you still have the JSN version would it not be worth trialling with a beefier supply as a test? I am most curious if this a case of voltage/current rather than faulty device.
          I would suggest a 5v booster in your own scenario running off two AAs, they are cheap enough these days...

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

            @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 Boots33B 3 Replies 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
              #39

              @jjk Fair enough. It will be interesting nevertheless to see how you get on with the newer version now you are looking at voltage, it does seem sensitive to power, both in volts and current (however small the latter).
              I had a long look at pressure sensors before looking again at ultrasonics, and it is almost impossible to strike a balance between submerged IP68 and cheap. Closest I found were differential sensors (loads of them available from RS, Mouser, etc. to very low mBar ratings) but the problem was always the correspondence between measuring fluid pressure as air pressure. At a near constant temperature there should be no issues, but where you have the pressure vary as it must between -20 and + 45c environmental temperature throws out accuracy, ignoring gassing off.
              For sewage only non-contact works, for clean water, DP cells can work but only under consistent environmental circumstances. Submerged low pressure cells should work, if you find a cheap one post it up....

              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?!

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

                @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 1 Reply Last reply
                0
                • 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
                                          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