I was thinking what my options are for controlling a remote farm remotely.

I needed to do basic stuff like run the motor to push the feed to the animals, open a valve to let mains water fill their drinking buckets, check feed and water levels, check temperature. Even count the number of eggs.

The farm has no electricity is off-grid and has no alternative power installed, so it must rely on solar energy. I want to minimise the use of batteries. There is no WIFI, but it is covered by the national 4,5G telephone network.

A smartphone has all the communication modules available and ready: sms, voice, data, bluetooth, even rfid. It also has a good power supply and provided is not loaded with apps, it can last for 24 hours at least for the next sunshine for the solar charger to work. And it allows high-level programming.

Unfortunately a smartphone lacks any connectivity to the world by means of IO ports. And so I am looking for an IO board to the smartphone via its USB or perhaps the bluetooth. The cheaper the better really and simpler too.

I found IOIO-OTG which interfaces android-based smartphone or PC via usb to a lot of IO ports which can read sensors or run motors and actuators.

I really like an IO board+Smartphone solution because I can sms to it commands like "feed animals" or "count eggs". And it can reply back via sms. I can also command it via internet ("data") and perhaps get the odd picture back. There is solar charging available and cheap. And with just a single app running perhaps it can manage 24hrs recharge cycles. From all of the above I love the control-by-sms idea.

My first point of call was the raspberry but i would prefer that there was a plugin module to the pi to do that rather than buying cells+batteries and doing calculations. E.g. https://community.element14.com/products/raspberry-pi/f/forum/53345/power-raspberry-pi-using-solar-panel

I would also like to communicate with the device. The most reliable way I see is via SMS. And the most practical is via 5G internet (data). The PI offers sending SMS but again, it's hands-on and a lot can go wrong.

So, I am looking for recommendations on other IO boards for smartphones (android is just fine), and/or similar solutions for the PI just to be fair to the PI, if people feel that's a better environment.

I have asked hacker news about this here

thanks, bw, bliako

edit:the IOIO-OTG board needs own power supply when plugged into smartphone. Not when plugged into PC

Edit 27/06/2024: I have read that when connecting the board to smartphone (not PC) it must provide its own power supply. It can not be powered from Android. Android then asks you if you want to charge the phone with what it found on its USB port or transfer photos etc. This fits well with the design that the board has its own solar power+battery which then charges the phone as well, and also drives any external motors (TODO: noise from motors into the board). If external power runs out (no sun for days) then, firstly, the board stops and then the phone runs out of its own battery (sending an sms to me when in the critical zone) after a while. When solar power recharges on sun appearing, the board will be able to charge the phone too. Problem I see, how to turn the phone on when power comes back and how to tell it that what is on the USB port (our IO board) should be run on the specified mode (transfer files, charge, whatever) WITHOUT user intervention. Just by its own.

  • Comment on [OT] Smartphone IO interface: how to control motors and read sensors

Replies are listed 'Best First'.
Re: [OT] Smartphone IO interface: how to control motors and read sensors
by NERDVANA (Priest) on Jun 30, 2024 at 09:09 UTC
    Wow, interesting project. Not sure how I missed this post.

    I don't know the answer to your situation specifically, but would love to hear how it goes! I do have some info to offer about the broader topic though.

    Using sleep states, the Atmel AVR chips can go extremely low-power. My brother put together a board that collected GPS coordinates for a trip to Africa, and ran for 3 weeks off 4x AA batteries collecting a coordinate every few minutes and writing it to a SD card. I use those same Atmel chips in my DeLorean dashboard project, using the boards from https://www.pjrc.com/teensy/. Power savings have never been my focus, but that board is basically just the main chip plus a crystal and various caps and resistors, so I would assume it can get the same savings in a sleep state.

    (Hrm, looks like PJRC doesn't sell the AVR boards anymore, only 32-bit ARM, but still Arduino compatible... wonder how the power savings works on those larger chips? 3.3V probably helps)

    Anyway, those boards are entirely powered by the USB of a normal PC, and I would assume can also be powered by a phone. But, what you probably want is a powered USB hub anyway, to charge both phone and board. On a PC I program them to show up as a USB Serial device, and Linux (and Windows) have this driver built-in, but I don't know if it would be on Android by default.

    If that works, you just need any language on Android that can write a serial device. I've never tried Perl on Android, but assume it would work fine for the serial device. The harder question is whether Perl could touch any of the APIs for exchanging SMS.

Re: [OT] Smartphone IO interface: how to control motors and read sensors
by harangzsolt33 (Deacon) on Aug 02, 2024 at 22:08 UTC
    Are you sure you don't want to do this project using a Raspberry PI instead? When I plug in my Raspberry PI, it automatically powers on. And it's basically a tiny computer with some sort of Debian Linux on it. I could configure it to run a Perl script when it powers on. Since the Raspberry PI has pins, they can be connected to switches which turn on power to some devices. For example, I could turn on a lamp, or I have taken a water valve out of a washing machine, so I could turn on a water hose. I could open or close a door and so on.

    The problem is that even a simple chicken farm has a lot of complexities that require daily monitoring and personal presence. For example, I currently have about 60 chickens. They are free range, and when sunset comes, most of them like to sit outside in groups, which means that I have to move them into the chicken coop every night. Once I moved them in, then I have to count them, securely lock the doors of the coop. And then I even close the chicken cage which leads to the coop. In the morning around 7 o'clock, I go outside and let them out. This is easy, because all I have to do is open the doors. This part could be automatized. However, the temperature in Florida can rise quickly. And if the door-opener mechanism fails even once, all my chickens could die in the coop from the extreme heat. I cannot risk that. So, this is something that requires my personal attention. I wouldn't want to rely on a machine to do this work. This is the easiest but most critical part of the work. Then I have to feed them and water them. I usually clean their water bowl, so they drink out of a clean bowl everyday. That water would get extremely dirty if I didn't clean it. I am not sure how a machine could do this. But like I said, this is not the most important part. I think, my chickens could survive without grain or water for several weeks. There is plenty of food in the yard. I have a big yard. But opening their door in the morning is absolutely critical. If I forget it, then they all die. Another responsibility is collecting the eggs. If I don't, then the heat causes the eggs to go bad, so it's a constant work. Very hard to imagine how it could be automatized. And I don't even own a large farm. There are much bigger and more complex chicken farms...

    This farm automatization reminded me of a funny old Charlie Chaplin video on YouTube. LOL
    https://www.youtube.com/watch?v=n_1apYo6-Ow

      A Pi uses 2 - 10 times the power a typical smartphone uses. A better solution may be something like an ESP32 which is designed for IOT applications and can easily average a handful of milliwatts of power. The trick with any of these devices is to be able to put them to sleep most of the time and only wake to get some work done. ESP32 type devices make that easy. Phone network connection isn't baked into ESP32 devices, but it's easy to add a suitable modem.

      Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

      thanks for all the information on how you do your chicken chores. Just to reassure you, it's a backup plan for when I am travelling. 10, 15 days. For these days they have to stay in. I am working on watering system which cleans itself every day, indeed it gets dirty. I thought about the Pi. I got the impression than if power runs out, it shuts down and the problem is how to restart it again on (solar) power returning? This is what stopped me. Plus that I was not satisfied that connecting a GSM modem (sim card etc.) to it would be troublefree.