USB Verbindung Mower <-> Smartphone

paddy

Active member
Hallo zusammen,

ich spinne gerade etwas rum und möchte mal eure Meinung dazu haben.
Mein zweiter Mower wächst, diesmal soll auch ein Web Server auf dem Mower mitfahren. Letztlich möchte ich den Mower über WLAN steuern und die mitfahrende Kamera auswerten.

Erfolgreich probiert habe ich es mit einem OrangePI Zero (ähnlich Raspberry). Die Kommunikation zwischen PI und Mower erfolgt seriell über den USB Port. Kamera hängt natürlich direkt am PI. Gesteuert wird es über node.js Server mit Node-Red. Das klappt erstaunlich einfach (noch ein Prototyp bei mir, aber proof-of-concept steht)

Problematisch ist hierbei immer noch, wie der PI mit Strom versorgt wird. Wird er direkt über das PCB versorgt, wird der PI ausgeschaltet ohne herunterzufahren (Not-Aus, Unterspannungsschutzschaltung). Klemme ich den direkt an die Batterie, kann der PI den Akku Tiefentladen.

1. Nun könnte ich über eine separate Schaltung mit einem Nano auswerten, ob das PCB noch versorgt wird. Wenn nicht, über GPIO dem PI mitteilen, dass er ausschalten soll, warten und anschließend alles trennen.
2. den PI könnte man ggf. über eine PowerBank versorgen. Wenn der Mower in der Ladestation steht, lädt er auch die Powerbank. Während des Betriebs wird der PI nur von der Power Bank betrieben. Fragölich ist nur, welche Kapazität man vorsehen müsste. Auch die PowerBank ist irgendwann leer.
3. ein altes Smartphone hat eigentlich alles an Bord. Kamera, Akku, Betriebssytem das node.js und node-red unterstützt, Ladeelektronik, alles da. Schaltet sich auch kontrolliert ab, wenn der Akku zuneige geht

Der Punkt 3 bringt mich ins grübeln. Warum nicht statt dem PI ein altes Smartphone nutzen? Liegt ja eh rum. Meine Idee ist, über den MicroUSB Anschluss die Verbindung zum Mower herzustellen.
Dabei sehe ich folgende Probleme:
- muss das Smartphone USB OTG unterstützen oder reicht der USB Slave Modus für die serielle Kommunikation?
- wenn OTG erforderlich ist, kann das Phone geladen werden während die Kommunikation steht?
- wie kann sichergestellt werden, dass die beiden sich nicht mit Energie versorgen? Einfach die Kabel auftrennen?

In diesen Punkten kenne ich mich überhaupt nicht aus und kann nicht beurteilen, ob das was wird. Ich hoffe jemand kann mir hier weiterhelfen.

Viele Grüße
Patrick
 
Interesting thought!

The possibility to use an Android phone as a slave device for a serial communication seems to be tightly bound to the capabilities of the debug bridge (adb) - see https://stackoverflow.com/questions...-with-a-usb-device-which-acts-as-host#3434331 - so unless you're willing to tunnel all your communication through the adb (which implies to teach the Arduino the protocol) it seems to be unpractical.

I don't think it's too hard to communicate with the Arduino as a master device. But at least for providing a webserver you'll probably need full root permissions to open a listening socket. And I don't know if a webserver for Android is readily available. There might be more work and far less documentation than for the Raspberry-approach.

Side note: If you ever decide to cut the powerline: always keep the ground intact for a voltage reference. It's never good to have floating voltage levels; even if (in case of USB) differential transmission is used.

On a second thought ... I'm not sure if cutting the +Power-line for USB might result in some kind of a latch-up. The power-contacts are longer to mechanically establish a power connection before the data lines are connected. Someone should double-check this.
 
Bernard, I added my thoughts to power PI to your post, so we can keep it together. Also I will share my results to node-red in our other topic :)

There is a node.js server for andriod out there. I've never testet it so I can't tell you if it works. Root permissions will not be a problem when using old, cheap smartphones. Just root them. I agree with you that it will be difficult to communicate with arduino. It seems to be easy if your phone provides USB-OTG capabilities. But the phone I have laying around doesn't. As I have read, some people get it working (it is a Samsung XCover 2) by flashing with a different operating system. My phone doesn't support USB-OTG just because software/driver doesn't. Hardware is able to handle it.
But I agree with you it will waste a lot of time to get it up and running. So I'll stick to PI's in any fashion (use cheap orange PI).

Patrick
 
Hi Pady
But I agree with you it will waste a lot of time to get it up and running. So I'll stick to PI's in any fashion (use cheap orange PI).

Yes PI and arduino can work together without problem and can help more people than one kind of old mobile phone.
Anyway we need to be able to communicate at high speed,and not sure android and server can do this.

Thanks.
 
Oben