Getting Raspberry pi events from android/iOS app


6 posts
by smtabatabaie » Mon Mar 20, 2017 6:03 pm
Hi guys, my first post here. I just got started with Raspberry pi and I wanted to make a program on my Raspberry which gets input from an app on my Android/iOS device over bluetooth. I wanted to first check if something like this is possible and second if you have any clues on how to do something like this.
Thanks
Posts: 2
Joined: Mon Mar 20, 2017 5:38 pm
by IanS » Tue Mar 21, 2017 3:24 pm
This is possible, but if you are not already an experience app developer on Android or iOS, then developing the phone side of this has a serious initial learning curve.
You may find it easier, at least to start, to have the RPi running a light-weight web-server and to communicate through the phone browser with that instead. Obviously this is better for some control styles than others. e.g. real-time control of a RPi robot would be tricky, but 'slow' commands such as for home automation would be fine.
If the device side just needs to issue commands without the need for screen-based feedback then how about using a bluetooth device such as a game-controller or keyboard instead? Then you only need to worry about the RPi side development.
Posts: 107
Joined: Wed Jun 20, 2012 2:51 pm
Location: Southampton, England
by smtabatabaie » Tue Mar 21, 2017 4:12 pm
IanS wrote:This is possible, but if you are not already an experience app developer on Android or iOS, then developing the phone side of this has a serious initial learning curve.
You may find it easier, at least to start, to have the RPi running a light-weight web-server and to communicate through the phone browser with that instead. Obviously this is better for some control styles than others. e.g. real-time control of a RPi robot would be tricky, but 'slow' commands such as for home automation would be fine.
If the device side just needs to issue commands without the need for screen-based feedback then how about using a bluetooth device such as a game-controller or keyboard instead? Then you only need to worry about the RPi side development.


Thanks very much , I have experience in both Android and iOS development (more on android) , All I want for start is to have a click on my android/iOS and a python script in my RPi and to be able to print something on raspberry pi via clicking the button on my android app via bluetooth. I'll appreciate if you know and guide me somewhere to start.
Thanks
Posts: 2
Joined: Mon Mar 20, 2017 5:38 pm
by IanS » Wed Mar 22, 2017 12:02 pm
If you are confident on the phone side then I will assume that you can learn the RPi side, given a few pointers to get you going in the right direction. PyBluez is one of the main Bluetooth libraries for Python, but I have no doubt many others are available.
https://github.com/karulis/pybluez has the library and some examples of different ways of communicating with devices. Some may be better than others, depending on what you want to achieve.
Posts: 107
Joined: Wed Jun 20, 2012 2:51 pm
Location: Southampton, England
by Douglas6 » Wed Mar 22, 2017 2:34 pm
One way is to establish a serial communication connection between the phone and Pi. Then use serial programming on each end to communicate. To enable a Bluetooth serial comm port on the Pi, see this post: https://www.raspberrypi.org/forums/view ... 85#p947185
User avatar
Posts: 3698
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL
by ElEscalador » Wed Mar 22, 2017 3:18 pm
I really like an AP called hotbutton. You can use it to execute a script or other executable...basically an app of buttons that run a command line command.
A few of my projects below.

https://www.youtube.com/playlist?list=PLdlhFMXxFUNlMpeqHipdSIO20pb4piHfj
Posts: 473
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA