0

I am new to using the RPi and just got the A+ model which I have been using to generate different types of data from external sensors. I was wondering if it is possible to send this data it is gathering to an android device in real-time, and if so the best method? I want to be able to notify the user (through a an app made with the Ionic framework) when the data enters a particular range etc.

And also is it possible to do this whilst the user is walking around with both the devices in hand?

nickmcblain
  • 155
  • 1
  • 2
  • 12
  • What do you mean with "data from sensors"? I own a B+ model and haven't noticed any sensors in it. In terms of communication with Android devices there are a couple of solutions - bluetooth - wifi - USB - nfc (guess this does not help) – madlymad Dec 26 '14 at 22:02
  • @madlymad Hi, they are external sensors, the main one being https://www.modmypi.com/raspberry-pi-hacking/hc-sr04-ultrasonic-range-sensor I want to notify the user when the range reduces to something below a certain value which I specify. – nickmcblain Dec 26 '14 at 22:10
  • I been thinking of 2 possible solutions: 1. send the data via Bluetooth (needs a Bluetooth adapter) to android. 2. setup an android webserver and connect the raspberry to send them to it (needs a wifi adapter) both solutions need programming in both sides RPi and android. The second one seems more easily developed but I am not sure about its efficiency in battery consumption of the android device. – madlymad Dec 27 '14 at 14:20

3 Answers3

0

The short answer to the question is: Yes, you can ;-)

The longer answer is much longer, since there are many ways to do this. The one I personally would choose as the simplest is classic Bluetooth (not LE) using the SPP profile, which basically makes the BT link a serial connection between the RPi and the phone.

On this serial link you invent you own streaming protocol suitable for the data you want to transfer.

On the RPi side you install a module such as this: https://www.sparkfun.com/products/12577 (There are many alternatives, but the RN42 module is very foolproof...)

Don't know the level of your hardware skills, you might need something more plug and play if you feel uncomfortable hooking up the 4 wires needed for 3.3V power and serial communications between the Pi and the BT Module...

On the phone side you install https://github.com/don/BluetoothSerial, which gives you an API reachable from Ionic where you can receive the BT data stream.

With that and a bit of coding on both sides you are good to go.

Jesper We
  • 5,977
  • 2
  • 26
  • 40
  • Hi thanks for your answer, I don't have any idea when it comes to bluetooth, is it necessary to have that module or am I able to do the same thing using a usb bluetooth dongle? And is there any preparation I need to do on the RPi in terms of code to make this work? – nickmcblain Jan 01 '15 at 18:48
  • Sorry if this gets complicated for you, but it is not trivial. A USB dongle will require lots more software on the RPi, to implement the SPP, which S/W stack in USB BT dongles. The BT modul has all that build in, it will just look like a serial port to the RPi, so it's much easier from the RPi software point of view. – Jesper We Jan 01 '15 at 19:21
0

I've used a Raspberry Pi in combination with an Android smartphone & Lego NXT.

Communication was achieved using Bluetooth on Raspbian. I used a cheap $1 USB Bluetooth dongle. The Bluetooth stack had to be compiled for Raspi, which may not be necessary anymore. Steps can be found here: Bluetooth error: Native Library bluecove_arm not available

Bluetooth seems most logical to me.

I'm at work at the moment, hence the lightweight answer, if you'd like to discuss this further then please leave a comment and I'll be happy to provide more verbose response.

Community
  • 1
  • 1
krex
  • 345
  • 3
  • 8
  • 21
0

You can upload the data to any cloud services. You can use Xively/Box. Xively is specially made for real time data collection.

To connect RPi to Xively, refer this: https://xively.com/dev/tutorials/pi/

For Box, refer this: http://www.sbprojects.com/projects/raspberrypi/webdav.php

You can then use Xively API in your android app. You can see GitHub for this

Google app store already has some apps for you, if you want to use

It might look a little complex. But its really simple once you follow the above methods.