• header.categories
    • header.recent
    • header.tags
    • header.popular
    • register
    • login

    Converting Distance to Volume with MyController (water tank)

    scheduled pinned locked moved General Discussion
    8 posts 2 posters 1.9k views 1 watching
    loading-more-posts
    • oldest-to-newest
    • newest-to-oldest
    • most-votes
    reply
    • reply-as-topic
    guest-login-reply
    deleted-message
    • M offline
      MTBHuw
      global:last-edited-by,

      Hi, I have set up a distance sensor to measure water level in a tank which seems to be working fine. I have kept the sketch on the sensor very simple, it just sends me the distance to the water level from the top of the tank.

      Am I able to use My Controller to display/calculate the volume of water in the tank, using the tank dimensions and converting distance to water level, to depth of water?

      It's easy enough to do by hand, but is it possible to display a graph for example in My Controller, rather than the "raw" distance from the sensor?

      Thanks

      jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
      • jkandasaJ offline
        jkandasa @MTBHuw
        global:last-edited-by,

        @mtbhuw This is my old MySensors water level sketch, you may get percentage from Arduino itself.

        https://github.com/mycontroller-org/ArduinoSketches/blob/master/WaterLevelSensor/WaterLevelSensor.ino

        M one-reply-to-this-post last-reply-time reply quote 0
        • M offline
          MTBHuw
          global:last-edited-by,

          Thanks for the sketch. I was just wondering if it was possible to do the "conversions" in My Controller though, so that the sketch can be left as simple as possible.

          jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
          • M offline
            MTBHuw @jkandasa
            global:last-edited-by,

            @jkandasa Will I need to add the relevant code to make this work with a nrf2401l module and serial gateway etc? Sketch looks ideal, thanks.

            jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
            • jkandasaJ offline
              jkandasa @MTBHuw
              global:last-edited-by,

              @mtbhuw

              Thanks for the sketch. I was just wondering if it was possible to do the "conversions" in My Controller though, so that the sketch can be left as simple as possible.

              Yes, it is possible. you have to write a script and trigger when you get new data.

              M one-reply-to-this-post last-reply-time reply quote 0
              • jkandasaJ offline
                jkandasa @MTBHuw
                global:last-edited-by,

                @mtbhuw

                Will I need to add the relevant code to make this work with a nrf2401l module and serial gateway etc? Sketch looks ideal, thanks.

                Yes, you have to add relevant code to your sketch. No need to worry about NRF code. Mine is old MySensors sketch. Just take conversion code only NOT NRF code.

                one-reply-to-this-post last-reply-time reply quote 0
                • M offline
                  MTBHuw @jkandasa
                  global:last-edited-by,

                  @jkandasa ok, thanks. Do you have any examples of any scripts to show what sort of thing can be done? And also any pointers as to what to do in My Controller to get them running?

                  jkandasaJ one-reply-to-this-post last-reply-time reply quote 0
                  • jkandasaJ offline
                    jkandasa @MTBHuw
                    global:last-edited-by,

                    @mtbhuw https://forum.mycontroller.org/topic/146/how-to-set-sensor-value-with-javascript

                    one-reply-to-this-post last-reply-time reply quote 0
                    • first-post
                      last-post

                    0

                    online

                    644

                    users

                    532

                    topics

                    3.4k

                    posts
                    Copyright © 2015-2025 MyController.org | Contributors | Localization