How to do synchronous communication between Raspberry Pi and an Android-powered smartphone?
Asked Answered
R

1

6

I've made an Android app that makes the smartphone run in USB host mode. I did so using the Android official documentation given here:

https://developer.android.com/guide/topics/connectivity/usb/host

To test the app, I connected a pen drive via an OTG cable. The app is able to detect the pen drive and read its contents. Now basically, I want to replace the pen drive with a Raspberry Pi.

Please help me with this: How can I establish synchronous communication (basically a stream) between Raspberry Pi and an Android-powered smartphone.

I have tried UART communication but cannot use it as I am transmitting video from Raspberry Pi.

Note:I cant use WIFI due to restrictions.

Remus answered 29/11, 2019 at 10:34 Comment(5)
use the otg mode in raspberry pi and use it? Not sure what you are trying to achieve. You can use raspberry pi zero in OTG without any rewiring.Brocade
I have 3b+ it does not support that.Remus
There is only one USB peripheral on the BCM283x SoC. On the CM, A, and Zero that is exposed directly to the outside world, so these tricks can be played. On any B, B+, 2B, or 3B there is an SMSC951x chip connected to it to act as a USB hub and network interface. You therefore can't switch the function of the port. from [raspberrypi.org/forums/viewtopic.php?t=143203]Brocade
Using Android as USB-host and Raspi as client very likely does not work as mentioned in the comment above. Have you considered using accessory mode instead of host mode (developer.android.com/guide/topics/connectivity/usb)?Nuris
The tab i am using doesnot have accessory mode.Remus
E
2

I agree with @fadedreamz. there is not simple way.

But there is complex way of doing so.

  1. you have OTG working.

  2. You need to communicate to RPI 3B+ which oesn't have OTG.

Answer is USB to Serial communication.

this article talk about how to do int.

In a nutshell

i. use USB adapter connect it to USB to serial connector.

ii. use PhysicaloidLibrary.

Thats it.

you have synchronous communication between pi and rpi.

There are other ways. i.e.

  1. using WiFi Adapter as a WiFi HotSpot mode.

  2. Use HC 06 bluetooth module.

and more.

Emmie answered 3/12, 2019 at 6:2 Comment(4)
i cant go with serial communication as i have to transmit video feed from raspberry pi.Remus
then I am afraid we have any other choice with RPI's USB and Android Phone's OTG. We can always use WiFi dongle and stream video.Emmie
I cant use wifi due to restrictionsRemus
can you please re-frame your question with all the restrictions ?Emmie

© 2022 - 2024 — McMap. All rights reserved.