Page 1 of 1

Sending "realtime" data over Wifi to tablets

Posted: Sat Aug 08, 2015 9:33 pm
by tsaG
Hi!

I have a project where im using the Pi to gather data from several Sensors over I2C (one IMU, Eeprom and an Arduino). These information files will be displayed at the Pi on a 3.5" Screen.

The next step is to send this data over a Wifi network, which is hosted by the Pi, to two tablets (android at the moment).

My question is, how do I realize the wifi part?

I had the following ideas:
- create a "website" where this information can be read from.
- "stream" the information over UDP to the broadcast adress (255.255.255xxx) (How?)
- create a MySQL Server where the tablets can connect to and read those values

Which way would be the easiest, prettiest, fastest, resource conserving?

I also have some other devices on my network, I think the broadcast is not the best idea (isnt it?).

thanks!

-Pat

Re: Sending "realtime" data over Wifi to tablets

Posted: Sun Aug 23, 2015 8:49 pm
by BillStephenson
Setting up a web server on the Pi is a good way to do this and there are a bunch on options on how you can do that.

I'll suggest you look into "Web Sockets" to do this. It's pretty close to real time. Here's a video I made that shows a Pi using web sockets to send data over a wifi LAN to another Pi:

https://www.youtube.com/watch?v=2YW6HWJg4f4

And here's the link to the code I used:

http://www.raspberryperl.com/compass/

There are some notes there too that might help you out.

Re: Sending "realtime" data over Wifi to tablets

Posted: Sun Aug 23, 2015 8:58 pm
by DougieLawson
Have a look at MQTT (the IoT protocol) with Mosquitto or RabbitMQ as the broker.

It's designed for one-to-one, one-to-many, many-to-one and many-to-many messaging. Unlike HTTP which is client pull from a server. Mosquitto 1.4 also supports websockets.

Re: Sending "realtime" data over Wifi to tablets

Posted: Wed Sep 02, 2015 9:29 pm
by razor
tsaG wrote:Hi!

I have a project where im using the Pi to gather data from several Sensors over I2C (one IMU, Eeprom and an Arduino). These information files will be displayed at the Pi on a 3.5" Screen.

The next step is to send this data over a Wifi network, which is hosted by the Pi, to two tablets (android at the moment).

My question is, how do I realize the wifi part?

I had the following ideas:
- create a "website" where this information can be read from.
- "stream" the information over UDP to the broadcast adress (255.255.255xxx) (How?)
- create a MySQL Server where the tablets can connect to and read those values


Which way would be the easiest, prettiest, fastest, resource conserving?

I also have some other devices on my network, I think the broadcast is not the best idea (isnt it?).
1. you can use web server and send data thru WebSockets (it's like TCP sockets, but for browsers - so JavaScript can do that on client side)
2. you can 'stream' data using UDP or use TCP connection for streaming, there is no big difference in implementation
3. worst thing :)

which is the best - it depends on your knowledge, programming skills etc., other things/features you want to put in your projects etc.
if you want to use Web Server anyway (for other things), then WebSockets it's good thing (you can use only one component - a web server)
Broadcast is very easy - but it works only in a LAN and it's possible that datagrams will come in different order or even will be lost.