eddyeddy
Posts: 49
Joined: Wed Oct 18, 2017 10:42 pm
Location: Europe

Collect data from sensors and show on the android app, is it possible?

Thu Jan 11, 2018 7:29 pm

Hello guys!

I have a raspberry PI 3 (model b) with all necessary accessories and different sensors such as (DHT11, BMP 180, MQ-2 etc.)

So far I have managed to install Raspbian OS and log-in to PI using Putty via Wi-Fi (as I don't have external screen)

1. Is it possible to connect many sensors let's say about 3 to 5 to a single breadboard connected with raspberry PI 3?
2. Once the sensors are added successfully is it possible to collect and send data to the android app? Let's say if I create a very simple looking android app and then I can see the temperature directly from the sensor on phone?

I know there are different IoT platforms that allow sharing data in the cloud, but I want to build everything from scratch.
tch.

I am a beginner on this, so I am still studying and reading but would appreciate if someone could give me some guidance where to start.

Regards

User avatar
neilgl
Posts: 184
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Collect data from sensors and show on the android app, is it possible?

Thu Jan 11, 2018 10:52 pm

Probably you could do it like this:
1. Yes connect sensors on breadboard and collect data using python (say) and gpio
2. Install a webserver on your pi (apache2 or flask or others) to serve web pages containing that data
3. look at that pi web page from your phone using chrome/firefox/other browser.

To see that pi on the internet you will probably need a domain or fixed ip address and do port forwarding on your router.

eddyeddy
Posts: 49
Joined: Wed Oct 18, 2017 10:42 pm
Location: Europe

Re: Collect data from sensors and show on the android app, is it possible?

Fri Jan 12, 2018 1:21 pm

1. I managed to setup sensors and have some readings on SSH.
2. I use to host a web server on my pc years ago, that should be simple too, only trying to figure out how to put that data on 'the webpage'.
3. The idea is good, but if I transfer data to the app, is that difficult? Never done any app in my life.


I have done in the past port-forwarding should be simple.

User avatar
neilgl
Posts: 184
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Collect data from sensors and show on the android app, is it possible?

Sat Jan 13, 2018 11:36 pm

1. good
2. install apache2 or nginx or flask on you pi. The data can then be a simple text file that you show as html or an image created using (say) rrdtool etc.
3. No need to "transfer data to the app" - the phone has a bowser - thats all you need.

Get that working on your local lan then let us know how it goes.

eddyeddy
Posts: 49
Joined: Wed Oct 18, 2017 10:42 pm
Location: Europe

Re: Collect data from sensors and show on the android app, is it possible?

Mon Jan 15, 2018 5:03 pm

Thanks! WIll try your suggestions.

I was wondering about the app as I want to practise (learn) how to code an android app, so I thought would be great to do so.

Do I still have to have to install Apache2, Nginx or Flask if I want to transfer that to the APP?

User avatar
neilgl
Posts: 184
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Collect data from sensors and show on the android app, is it possible?

Mon Jan 15, 2018 9:35 pm

Yes install one of apache2, nginx or flask on pi.
Get it all working using a browser on your phone/ iPad /pc

Then you can code your own app on the phone using e.g android studio.

eddyeddy
Posts: 49
Joined: Wed Oct 18, 2017 10:42 pm
Location: Europe

Re: Collect data from sensors and show on the android app, is it possible?

Thu Jan 18, 2018 8:51 pm

neilgl wrote:
Mon Jan 15, 2018 9:35 pm
Yes install one of apache2, nginx or flask on pi.
Get it all working using a browser on your phone/ iPad /pc

Then you can code your own app on the phone using e.g android studio.
Now trying to set up apache2. I had my own web server but it was more than 10 years ago it was much easier to setup apache, now on the PI it's a bit of nightmare, especially when one command messed up the whole mysql. I will try nginx or perhaps flask to see how it works.

Btw, have you ever tried Node-red? After checking I can see that it's very handy, but can I transfer everything from Node-red and view the data?

User avatar
neilgl
Posts: 184
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Collect data from sensors and show on the android app, is it possible?

Fri Jan 19, 2018 11:57 pm

apache2 on the pi works fine for me using mysql(mariadb) and/or postgresql
Hava a look at node.js if you get a minute.

eddyeddy
Posts: 49
Joined: Wed Oct 18, 2017 10:42 pm
Location: Europe

Re: Collect data from sensors and show on the android app, is it possible?

Sun Jan 21, 2018 11:35 pm

neilgl wrote:
Fri Jan 19, 2018 11:57 pm
apache2 on the pi works fine for me using mysql(mariadb) and/or postgresql
Hava a look at node.js if you get a minute.
Hi! Managed to setup phpmyadmin, php, and apache2.

What could you suggest where to look next? Connect sensor, store data in the database and show on the website, then from website to app?

I am trying now different tutorials how to collect data from sensors, store it and then transfer to web/app but not a lot of tutorials are available that actually works. Do you have any source available for good tutorials? (this is how I learn)

eddyeddy
Posts: 49
Joined: Wed Oct 18, 2017 10:42 pm
Location: Europe

Re: Collect data from sensors and show on the android app, is it possible?

Mon Jan 22, 2018 11:03 pm

I had a look on node.js it's very similar for apache etc. to show results on the web browser is that true?

I tried different tutorials where I have to attach sensors and store data then send data to the web but many of them didn't work, either the server setup was different, sensors and so on. I am not an expert and the best way how I learn is by using tutorials.

Where people nowadays look for tutorials that actually work?

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Collect data from sensors and show on the android app, is it possible?

Tue Jan 23, 2018 1:31 am

Node-Red is installed by default, it can do all that you want and more.

eddyeddy
Posts: 49
Joined: Wed Oct 18, 2017 10:42 pm
Location: Europe

Re: Collect data from sensors and show on the android app, is it possible?

Tue Jan 23, 2018 1:31 pm

asandford wrote: Node-Red is installed by default, it can do all that you want and more.
I was playing around with that tool in Raspbian OS. Basically, it's the software that allows me to set up the system without actually coding?

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Collect data from sensors and show on the android app, is it possible?

Wed Jan 24, 2018 1:55 am

eddyeddy wrote:
Tue Jan 23, 2018 1:31 pm
asandford wrote: Node-Red is installed by default, it can do all that you want and more.
I was playing around with that tool in Raspbian OS. Basically, it's the software that allows me to set up the system without actually coding?
More or less, you might have to do some code (depending on what youwant to do), but the language is up to you.

Have a look here for a quick intro video.

eddyeddy
Posts: 49
Joined: Wed Oct 18, 2017 10:42 pm
Location: Europe

Re: Collect data from sensors and show on the android app, is it possible?

Thu Jan 25, 2018 9:23 pm

Managed to set up automatic temperature logger that stores in MySQL and displays on the web using this instruction - https://www.instructables.com/id/Raspbe ... midity-lo/

so many problems with PHP, as most of the Instructables are made when the PHP older versions were used. But now I have learned a lot.

How to display collected data on the android app?

eddyeddy
Posts: 49
Joined: Wed Oct 18, 2017 10:42 pm
Location: Europe

Re: Collect data from sensors and show on the android app, is it possible?

Sun Feb 04, 2018 10:42 pm

Decided to work with Node-red, so many options now available.

asandford
Posts: 1999
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Collect data from sensors and show on the android app, is it possible?

Thu Feb 08, 2018 12:16 am

eddyeddy wrote:
Sun Feb 04, 2018 10:42 pm
Decided to work with Node-red, so many options now available.
Good choice IMHO

Return to “Beginners”

Who is online

Users browsing this forum: linoreale, lssndr and 51 guests