UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Guidance for a water-meter application

    Scheduled Pinned Locked Moved App Development
    3 Posts 3 Posters 116 Views 2 Watching
    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.
      • O Offline
        oliv90454
        last edited by

        Hello everyone,

        I am working on a solution to read my analog water meter automatically. A reading is performed every minute and involves three steps:

        1. take a picture of the physical water meter
        2. analyze the picture to extract the value (e.g. 123.4567 m3)
        3. upload the value to Home Assistant

        For development purposes, I use an Android phone with OpenCamera to take pictures regularly, with the flash. Then I transfer them manually to my PC to process them. I have already implemented the steps 2 and 3 in Python and OpenCV for the image processing, this is not a problem anymore.

        Now the question is how to automate everything. Ideally, the 3 steps would run on the same device. Python on Android is not trivial, so I thought that Ubuntu Touch help. I saw it as "Linux" on a mobile phone, but after installation on a Pixel 3a, I realize that it is has also limitations due to its nature as phone or tablet OS. For instance, I cannot just install the apt packages I need in the root system. I looked quickly into the app development, it looks possible in Python, but I am not sure if I will hit other limitations, like having an app taking continuously pictures.

        Do you have general recommendations for me on the best general strategy?

        Thanks!

        arubislanderA 1 Reply Last reply Reply Quote 0
        • K Offline
          kugiigi
          last edited by

          I think the closest reference you can check is Tagger or the built-in barcode code scanner. Probably worth checking them out. Be warned though that media capture and such most likely isn't as robust as on Android so there will be limitations.

          1 Reply Last reply Reply Quote 0
          • arubislanderA Offline
            arubislander @oliv90454
            last edited by

            @oliv90454 seems you want to use your phone as a specialised appliance. This is possible with UT, it is Linux after all. But there are a few hurdles you would need to jump over. These are not short-conings of the OS, but design decisions based on target audience and function.

            • Read-only root file system with atomic updates. You've already encountered this one. The reason for its existence is robustness and stability. Circumventing this by making the filesystem read/write is not a suitable solution because most devices don't have a lot of space to spare on the root filesystem anyhow.
              One way forward for you would be to install Crackle, which gives you access to thousands of packages in the nix repository, install pip3-env and from there proceed as you would on any other Linux environment.
              Writing an app is also a possibility, though it might be overkill for what you are trying to achieve.
              Whichever path you choose, you would then run into the second hurdle.
            • Application lifetime cycle. As UT is primarily a mobile OS, so minimizing battery usage is very important. To help achieve this, by default, devices are in staged mode. In this mode only one user space app is active at a time. When an app ends up in the background, either because another app was activated, or the screen turned off, the app is suspended and it no longer executes any instructions. To work around this you could exempt the terminal app, or your own app, if you choose to write one, from suspension using the UTTT (Ubuntu Touch Tweak Tool)
            • The last hurdle I can think of is more a physical limitation of the device. Unless you don't mind your battery degrading, because the device would be constantly plugged in to the charger, you would have to device a routine for charging and discharging the device.

            So all in all what you want is totally doable on UT. But if you think it is too much trouble there's always a more traditional distro, like Droidian, available for your device.

            πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
            Happily running Ubuntu Touch
            JingPad (24.04-1.x daily)
            OnePlus Nord N10 5G (24.04-2.x daily)
            PinePhone OG (20.04)
            Meizu Pro 5 (16.04 DEV)

            1 Reply Last reply Reply Quote 1

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better πŸ’—

            Register Login
            • First post
              Last post