Android to Raspberry Pi Communication

Let me know if this helped you and leave a comment if you have questions.

I had a project that entailed communicating with a Raspberry Pi from an Android device. The two things we wanted to do was keep the price down and not be relient on internet as it was not guaranteed. Now this was a huge pain. The big advantage we had was that the Android devices would be in usb cord length with the Raspberry Pi.

Great Awesome now we have some medium to connect the device to the pi over. What do we do now? Well a couple option come to mind use the USB protocol to create a connection and send information over. Maybe use PyUsb on the Raspberry Pi side and create an Android app to handle the connection on the device side. Well plans got ruined and deadlines soon appeared, so I turned to the ADB tool that Android has. This worked perfectly.

Link to ADB for Raspberry Pi. 

I would love to link to the original person who ported the ADB to Raspberry Pi, so if you know them please let know.

Ok perfect now we have a working version of the ADB working on the Raspberry Pi. Now what do we do? First move the file to your Raspberry Pi or if you are using a “regular” computer just download the ADB by downloading the regular development tools for Android. Make sure the ADB command is executable.

Now we finally have everything we need to get started. ADB-forwarding contains a simple script to start forwarding a connection made on the tcp port 5001 on the Raspberry Pi to a tcp port 8081 on the Android device. contains the server, which should be run on the Raspberry pi after the ADB-forwarding script is run, but before the Android app is started. The third file should be the application for your Android app, which should be run before and after ADB-forwarding. If you do not know what an application is in the context of an Android app check out this link. It’s really hard to find information on it, but they are really helpful.

One thought on “Android to Raspberry Pi Communication

  1. Hi,
    This looks very helpful but still have few issues to make it run. So, is it possible to get the entire Android project/gradle ?
    I had to use a more recent adb due to changes of Android 4+.
    Thank you in advance

Leave a Reply