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.
  • D Offline
    D Offline
    Daanozz
    wrote on last edited by
    #6

    Get this error

    C:\Users\Daan\AppData\Local\Temp\Rar$DIa0.647\DistanceSensor\DistanceSensor.ino: In function 'void setup()':

    DistanceSensor:53: error: 'getConfig' was not declared in this scope

    metric = getConfig().isMetric;

    mfalkviddM 1 Reply Last reply
    0
    • D Daanozz

      Get this error

      C:\Users\Daan\AppData\Local\Temp\Rar$DIa0.647\DistanceSensor\DistanceSensor.ino: In function 'void setup()':

      DistanceSensor:53: error: 'getConfig' was not declared in this scope

      metric = getConfig().isMetric;

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #7

      @Daanozz see https://forum.mysensors.org/topic/5841/getconfig-was-not-declared-in-this-scope-v2-1-1-fixed

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

        hi folks, has anyone ever tried/considered to run this sensor on a battery powered node? Does it make sense, what would be a good setup? I want to monitor a remote watertank where it's hard to get power to... Thanks for your expert thoughts on this!

        Boots33B 1 Reply Last reply
        0
        • jjkJ jjk

          hi folks, has anyone ever tried/considered to run this sensor on a battery powered node? Does it make sense, what would be a good setup? I want to monitor a remote watertank where it's hard to get power to... Thanks for your expert thoughts on this!

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

          @jjk There should be no problem running it from a battery if you only want to check a few times a day and sleep the node in between, but depending on how often you want it to check the level you may need to also have a small solar panel perhaps.

          You might also like to search for some of the other threads on battery powered nodes for info on how to reduce power consumption.

          I have just installed an ultrasonic level on my tank last weekend but I have power there for the pump so the node runs all the time.

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

            thanks, sounds good, I will give it a trg

            1 Reply Last reply
            0
            • H Offline
              H Offline
              hashem25
              wrote on last edited by
              #11

              i ran it but i see garbage in com monitor?? what is wrong?

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

                I have a setup with a HC-SR04 connected to an Arduino Pro Mini via a cable of about 5m length As I'm getting inconsistent readings from the sensor, I was wondering if cable length could be an issue - and if so, what a possible workaround could look like. Any thoughts from the experts?

                mfalkviddM 1 Reply Last reply
                0
                • jjkJ jjk

                  I have a setup with a HC-SR04 connected to an Arduino Pro Mini via a cable of about 5m length As I'm getting inconsistent readings from the sensor, I was wondering if cable length could be an issue - and if so, what a possible workaround could look like. Any thoughts from the experts?

                  mfalkviddM Offline
                  mfalkviddM Offline
                  mfalkvidd
                  Mod
                  wrote on last edited by
                  #13

                  @jjk did it work better when you used a shorter cable?

                  1 Reply Last reply
                  0
                  • Boots33B Boots33

                    @jjk There should be no problem running it from a battery if you only want to check a few times a day and sleep the node in between, but depending on how often you want it to check the level you may need to also have a small solar panel perhaps.

                    You might also like to search for some of the other threads on battery powered nodes for info on how to reduce power consumption.

                    I have just installed an ultrasonic level on my tank last weekend but I have power there for the pump so the node runs all the time.

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

                    @Boots33 I had looked at the exact same scenario as jjk, and although the intended 3.3v rfm69 node is pre-designed for low consumption (Whisper), my problem lay in the ultrasonic (DYP-ME007Y mounted on a tube inserted through the concrete roof) for hourly reports as it is 5v, as is the SR04. They can be triggered by 3.3v but not run. The standby current of a 5v booster proved too much, so resorted to a 3v 33mA latching relay to fire it up. It has all been a design exercise to date, but if my calcs are correct the node should run for a year on 3 alkalines with the US running once every hour triggered by RTC.

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

                      @mfalkvidd that's a fair question... I tested the sketch and connectivity with dupont cables and my spontaneous answer would be, "yes". However, to be honest, I never really calibrated the distance readings nor did I do a long-term test in the lab setup, so I think the true answer is, " I don't know"...

                      @zboblamont sounds like you figured it out?! Would you mind providing details on the relay you have used?

                      zboblamontZ 1 Reply Last reply
                      0
                      • jjkJ jjk

                        @mfalkvidd that's a fair question... I tested the sketch and connectivity with dupont cables and my spontaneous answer would be, "yes". However, to be honest, I never really calibrated the distance readings nor did I do a long-term test in the lab setup, so I think the true answer is, " I don't know"...

                        @zboblamont sounds like you figured it out?! Would you mind providing details on the relay you have used?

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

                        @jjk Kemet EC2-3SNU from memory, but I know Omron et al make them also, check on Mouser etc. as it is not heavy current. The point is to ensure it is a latching type, the 33mA consumption from memory is ca 30ms, reverse pin polarity to reset relay, other may have dual coil.

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

                          thanks @ zboblamont, I will have a look

                          zboblamontZ 1 Reply Last reply
                          0
                          • jjkJ jjk

                            thanks @ zboblamont, I will have a look

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

                            @jjk As an afterthought - If large temperature fluctuations are not an issue (air expansion in a tube) and it is not dirty water, you might also consider using differential pressure sensors as these are reasonably easy and can operate directly at 3.3v, inc I2C.

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

                              @zboblamont thanks for putting more thoughts into this for me!
                              As I'm just an motivated hobbyist (far from being expert in electronics), I've tried to switch the pro mini to a nano, in a hope that keeps me from dealing with the relay (new to me). My thought was that the 5V it provides should mitigate the issue - looks like it doesn't. So if the readings aren't getting more consistent with the 5V Nano, what else could be the issue?

                              zboblamontZ 1 Reply Last reply
                              0
                              • jjkJ jjk

                                @zboblamont thanks for putting more thoughts into this for me!
                                As I'm just an motivated hobbyist (far from being expert in electronics), I've tried to switch the pro mini to a nano, in a hope that keeps me from dealing with the relay (new to me). My thought was that the 5V it provides should mitigate the issue - looks like it doesn't. So if the readings aren't getting more consistent with the 5V Nano, what else could be the issue?

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

                                @jjk Hey, no expertise here either, hobbyist also, I am just old school measure thrice cut once. To be clear, I am fixed on a low voltage node so the relay gives the US board a solid and separate 5v, as I read that some of these are power sensitive, and some folks had problems powering them from an Arduino. The US trigger is supposedly ok at 3v, I only need to voltage divide the signal to the Mini. But that is my scenario, low power reliability.

                                In your situation, I would restore everything to completely original in a test space, use separate supplies and run checks. If the board is faulty the inconsistencies should still be there. If not, introduce each variable methodically to identify the cause.

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

                                  @zboblamont thanks and yes, that's exactly what I doing... I have take. everything down and will look into a detailed test setup over the weekend. Will post any findings ;)

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

                                    o.k. here's an update for those who are interested...
                                    I have completely take down the components and resembled the setup in a test environment with a newly created prototype pcb. It works as expected - kind of. What I found is that the SR04 seems to be very sensitive to weak electrical connections. At first, I had a similar effect of inconsistent readings in the test and was about to conclude that there must be a piece of hardware at fault. Then I found a cable poorly soldered to the pcb and after fixing that, voila, the readings were consistent over 50 or so samples.
                                    Another source of headache is probably that I have used pin headers to easily connect/exchange the components and my observation is that there, too seems to be a certain sensitivity in "quality of craftsmanship". After about half day of running the test setup, I got unable to read errors from a DHT22 that is also attached to the node. I inspected everything and it looked good, but only after pushing firmly of the Nano (that looked like it was perfectly sitting in it's header), the readings came back o.k.
                                    Now trying to figure out how to bring that into the outside world where eventually I will have to deal with temperature changes that I suspect might further contribute to the issue...

                                    zboblamontZ 1 Reply Last reply
                                    0
                                    • jjkJ jjk

                                      o.k. here's an update for those who are interested...
                                      I have completely take down the components and resembled the setup in a test environment with a newly created prototype pcb. It works as expected - kind of. What I found is that the SR04 seems to be very sensitive to weak electrical connections. At first, I had a similar effect of inconsistent readings in the test and was about to conclude that there must be a piece of hardware at fault. Then I found a cable poorly soldered to the pcb and after fixing that, voila, the readings were consistent over 50 or so samples.
                                      Another source of headache is probably that I have used pin headers to easily connect/exchange the components and my observation is that there, too seems to be a certain sensitivity in "quality of craftsmanship". After about half day of running the test setup, I got unable to read errors from a DHT22 that is also attached to the node. I inspected everything and it looked good, but only after pushing firmly of the Nano (that looked like it was perfectly sitting in it's header), the readings came back o.k.
                                      Now trying to figure out how to bring that into the outside world where eventually I will have to deal with temperature changes that I suspect might further contribute to the issue...

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

                                      @jjk @jjk Well, at least the issue is resolved, annoying but at least you found it. I thought these boards had some temperature compensation incorporated, but unless the distance is critical it should not cause dramatic shifts anyway.
                                      Out of curiosity, I have seen these particular devices described as JSN-SR04T and DYP-ME007Y, and I note on another thread that a JSN-SR04T-2.0 version which was otherwise identical but would not respond as expected. What is the type you are using?

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

                                        @zboblamont the temperature issue I'm expecting is mainly wrt the electrical connections and the components sitting tightly (or not) in the pin headers. However, I guess only time will tell whether or not that becomes an issue ;) The SR04 is labeled "HC-SR04" and I got it from Amazon. The accuracy is "ok", I'd say. I did some reference measurements with a tape measure and below 1m the sensor returned consistently correct readings. Beginning at about 1.5-2m the readings occasionally would fluctuate by +/- 1cm, but on average it is o.k. As I intend to use it as a "general level indicator" in my grey water tank that's good enough for me - if I get it to work properly.

                                        zboblamontZ 1 Reply Last reply
                                        0
                                        • jjkJ jjk

                                          @zboblamont the temperature issue I'm expecting is mainly wrt the electrical connections and the components sitting tightly (or not) in the pin headers. However, I guess only time will tell whether or not that becomes an issue ;) The SR04 is labeled "HC-SR04" and I got it from Amazon. The accuracy is "ok", I'd say. I did some reference measurements with a tape measure and below 1m the sensor returned consistently correct readings. Beginning at about 1.5-2m the readings occasionally would fluctuate by +/- 1cm, but on average it is o.k. As I intend to use it as a "general level indicator" in my grey water tank that's good enough for me - if I get it to work properly.

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

                                          @jjk said in 💬 Distance Sensor:

                                          HC-SR04

                                          Ooops, my apologies, the thread began with the JSN, I didn't pick up on you were referring to the HC until now and I read back.
                                          I was looking to deploy ultrasonics in a sewage holding tank and a raw water storage tank and looked at these devices, but had misgivings over the high humidity and -20 winters here with the dual sensor and PCB. It is stated that the membranes of the transducer are waterproof, so if you can seal the PCB and connectors they should work fine.

                                          There are already two types turn up for the JSN type single transducer, one PCB mounted the other on a long cable, per link text . Now it seems there is a version 2.0 which is not work as per the original, so putting ordering on hold until this is resolved or the exact version is known to the supplier.

                                          Will be interesting to see if you get it to work reliably in your scenario.

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


                                          17

                                          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