corey9797
Posts: 4
Joined: Sat Jan 14, 2017 5:03 pm

Specific question about Pi's, websites, and servers

Mon Jan 16, 2017 1:02 am

Hello all,
I am an undergraduate engineering student so I am not too familiar with websites, servers, and databases.
For my job at the university my team is trying to have several Raspberry Pi's acting as clients which all communicate back and forth with one Raspberry Pi that will act as the host for the setup.

My job is to create a website which will display all sorts of data that the host gathers from the clients. It is also important that the host will be able to read information off of the website (excel spreadsheets) and use that information to communicate with each client accordingly.

I have a few questions:

Would it be better to use the host Raspberry Pi as a server to host a website or to ask the University I work for to add the website to their current system and why?

What is the best way to make sure that all of the data collected by the clients is stored on both the website (temporarily) and in the drives that our research lab owns.

I have programming experience and will be able to write all of the java, php, html, css code needed to make everything work. I am just unsure how to setup the framework of everything.
Also what is the best way to include redundancy. It is vital that none of the data gets lost if anything goes down.

Thanks for the help

-Corey

User avatar
DougieLawson
Posts: 39304
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Specific question about Pi's, websites, and servers

Mon Jan 16, 2017 11:21 am

Get a LAMP stack running and see what you can do with it.
sudo apt-get apache2 phpmyadmin php5-cli mariadb-client mariadb-server
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

scotty101
Posts: 3958
Joined: Fri Jun 08, 2012 6:03 pm

Re: Specific question about Pi's, websites, and servers

Mon Jan 16, 2017 12:30 pm

I'm surprised Dougie hasn't mentioned MQTT for this application.

MQTT makes it simple to connect many different devices to each other and share data. Your main Pi just needs to subscribe to all the data and place this on a webpage.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

corey9797
Posts: 4
Joined: Sat Jan 14, 2017 5:03 pm

Re: Specific question about Pi's, websites, and servers

Tue Jan 17, 2017 2:01 am

@scotty101 or whoever,
If I used MQTT, what exactly would the clients be subscribed to? Where would I be posting updates that would then cause the clients the change how they are behaving? It wouldn't be a web server right? Doesn't MQTT eliminate the need for a constant web server?
Thanks
-Corey

peterlite
Posts: 720
Joined: Sun Apr 17, 2016 4:00 am

Re: Specific question about Pi's, websites, and servers

Tue Jan 17, 2017 4:44 am

MQTT would be good for communicating with intelligent sensors.

For the Web site, PHP 7 works a little bit faster than PHP 5 and uses less memory. A free open source CMS would reduce the coding. As an example, the Drupal CMS has modules to automatically present tables as CVS, PDF, Excel. etc. The user can choose the format they need.

The Pi can continually backup to a USB disk or two. You can use something as rsync to replicate the data from the Pi Ext4 partition to the USB disks or memory sticks. If you get a couple of the slim USB microSD adapters, often free with microSD cards, https://www.mwave.com.au/product/kingst ... bs-ab65274, you can have two complete Raspbian backups without needing a USB hub for power.

corey9797
Posts: 4
Joined: Sat Jan 14, 2017 5:03 pm

Re: Specific question about Pi's, websites, and servers

Wed Jan 18, 2017 3:18 am

peterlite wrote:MQTT would be good for communicating with intelligent sensors.

For the Web site, PHP 7 works a little bit faster than PHP 5 and uses less memory. A free open source CMS would reduce the coding. As an example, the Drupal CMS has modules to automatically present tables as CVS, PDF, Excel. etc. The user can choose the format they need.

The Pi can continually backup to a USB disk or two. You can use something as rsync to replicate the data from the Pi Ext4 partition to the USB disks or memory sticks. If you get a couple of the slim USB microSD adapters, often free with microSD cards, https://www.mwave.com.au/product/kingst ... bs-ab65274, you can have two complete Raspbian backups without needing a USB hub for power.
We are using photo interrupters and Infared Sensors. Would MQTT be good then?

corey9797
Posts: 4
Joined: Sat Jan 14, 2017 5:03 pm

Re: Specific question about Pi's, websites, and servers

Mon Jan 30, 2017 6:02 pm

So after reading your replies and doing some additional research, I have come up with a rough draft of my plan. Can someone please critique this for me.

We will have several raspberry pi's which will be plugged into all of our lab equipment (IR sensors, photo interrupters, etc.) and will be collecting data. They will be subscribed to a broker (another raspberry pi) which will be sending them information on how to behave (based on new data that will come in). These clients will also publish their gathered data to the broker.
The broker will be doing continuous backups to USB disks. The broker will also be publishing the data it has gathered from all of the clients to a website. It is also subscribed to that website though so that when other computers and mobile devices (which are also publishing to the website) update the data on the website, the broker can read that and update the data sent to the several Pi clients.

The website will use Drupal to handle all of the publishers and reduce code needed for easily setting up excel spreadsheets and how the Pi's read that data.

Please critique and give me feedback
-Corey

Return to “Networking and servers”