Andymator
Posts: 27
Joined: Sat Jun 30, 2018 9:38 am

Huge Pi-project in Swedish high school

Sat Jun 30, 2018 10:14 am

Hello
I am a science teacher that will launch a high school project next semester for 96 students in Sweden.
The idea is that every student will get a Pi (3B+) and some sensors to build a "smart unit" to satisfy a need on the school. It could be to check what queue to the cafeteria that is the shortest one, what bathrooms are used the most, if the copying room is currently used or whatever else the students can come up with. The data that their units collect are to be displayed in real time on a web page or in an app. I have taught programming before (C#) and I am now getting into Python (seems simple to me). I think we will go for Raspbian on all the pies.

I have a lot of questions about what choices I should make when planning this project. I have never done anything like this before and my Linux- and IoT-experience was up until recently, non existent.

Questions and thoughts:
1. My main issue right now is how to get the units sensor data to the internet in the easiest possible way. The units will be on the schools wifi. The students will only have a very limited knowledge of programming and it is not the #1 goal of this project to teach them programming. The presented data does not have to be very user friendly. The important thing is just to get the collected data out there in real time. The best thing might be if I could create something that all the students, with very little effort, could use to display their data. Does anyone have any good ideas?

2. An idea that I have to make things easier for the students in the beginning of the project is to install and update everything their pies might need on an SD-card, make an image of that card and copy it to all 96 cards before handing them their pies. That should work right?

3. Their units need to be attached to the walls/ceilings somehow. Any ideas on how to solve that in a smart way?

4. If a pi takes pictures that I want to upload every hour to be displayed on the internet, how would I go about that in the easiest possible way?

I really appreciate everything anyone can say. You can not be too detailed and it is better that you assume that I almost dont know anything :)

/David

epoch1970
Posts: 5563
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: Huge Pi-project in Swedish high school

Sat Jun 30, 2018 11:09 am

Andymator wrote:
Sat Jun 30, 2018 10:14 am
1. ... The important thing is just to get the collected data out there in real time. The best thing might be if I could create something that all the students, with very little effort, could use to display their data. Does anyone have any good ideas?
I'm not exactly sure why, but this makes me think of Node-RED
2. ... make an image of that card and copy it to all 96 cards before handing them their pies. That should work right?
Yes, and it will be more sturdy than trying to go SD-less and netboot via ethernet. You could use a "cloud" OS to automatically handle remote installs but right now it is complicated and/or vendor-locked. Instead you could organize for remote access via VPN for a maintainer if needed, OpenVPN comes to mind for that.
IMHO your solution is the right one, but you can let student groups burn their own SD from a downloaded archive. Burning 96 SDs is boring ;)
3. Their units need to be attached to the walls/ceilings somehow. Any ideas on how to solve that in a smart way?
SDs can fail, so the machine should be within reach. SDs can be stolen/tampered with, so the machine should not be within reach...
Consider power and network availability, too. A locked electrical box with just a power cable (and network cable?) coming into it would be a nice solution. Usually the problem with these is that the enclosure costs more than the Pi itself...
4. If a pi takes pictures that I want to upload every hour to be displayed on the internet, how would I go about that in the easiest possible way?
You need to make a hole in that electrical box ;)
I'm not into this type of application, but I'll mention in passing Syncthing if you need to upload/download stuff from your swarm of Pis. Brilliant software from Jakob Borg, one of your fellow countrymen. He uses Syncthing on a Pi himself, AFAIK.

HTH, have fun
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

User avatar
bertlea
Posts: 309
Joined: Wed Dec 07, 2016 6:33 am
Location: Hong Kong

Re: Huge Pi-project in Swedish high school

Sat Jun 30, 2018 11:10 am

1. You need a web server connected to the Internet (may be your school already got one). Make the server accept HTTP PUT data from the Internet (maybe with some simple keyword as password) Your students just need to send a PUT request to your server (with a password). They can even try it manually using a browser and it can also be done using simple Linux command such as curl to do that without too much programming. *notice, if security is a concern than you need to think a more complex method.
2. That should work, but suggest you ask the students to change the password for their login as the first thing when they received it.
3. Double sided tap? I think the issue is to make sure they all got a proper PSU to power the Pi.
4. Similar to answer (1). The PUT message can be a binary file. But the server need to able to process that quickly as many Pi can send data to the server at the same time.

Andymator
Posts: 27
Joined: Sat Jun 30, 2018 9:38 am

Re: Huge Pi-project in Swedish high school

Sat Jun 30, 2018 12:39 pm

Thank you for your thoughts and I will definately check out Node-RED and Syncthing.

tpyo kingg
Posts: 835
Joined: Mon Apr 09, 2018 5:26 pm
Location: N. Finland

Re: Huge Pi-project in Swedish high school

Sat Jun 30, 2018 1:09 pm

Andymator wrote:
Sat Jun 30, 2018 10:14 am
2. An idea that I have to make things easier for the students in the beginning of the project is to install and update everything their pies might need on an SD-card, make an image of that card and copy it to all 96 cards before handing them their pies. That should work right?
That would probably be a good way to do it. I'd try to find a way to randomize the password so that the students have to set it with sudo when they first start up -- without allowing 'password' or '123456' or similar to be used. It's hard to impress on people that attacks are automated since a few decades ago and that the attackers aren't singling them out personally but only their machine's network connectivity, which is of high value.
Andymator wrote:
Sat Jun 30, 2018 10:14 am
4. If a pi takes pictures that I want to upload every hour to be displayed on the internet, how would I go about that in the easiest possible way?
As mentioned you'll need an external machine. The easy part would be to rent a VPS from Scaleway, Vultr, or any of the many others for a few dozen SEK per month. The hard part would be jumping through the administrative hoops to get a school domain name for said rented VPS.

For the technical part of the uploading, rather than spending time building up a web interface to deal with the uploads, my approach would be to give SSH keys or SSH certificates to any device allowed to do an upload via SFTP and trigger a shell/python/perl script on the VPS with that. (Keys and certs can be locked down to work with just a single program or script and disallow anything else, including shell access, especially if chrooted SFTP is used with those accounts.) With that in place, a cron job or an incron job can be used to trigger the client to do the upload.

jbudd
Posts: 1466
Joined: Mon Dec 16, 2013 10:23 am

Re: Huge Pi-project in Swedish high school

Sat Jun 30, 2018 4:25 pm

It might be worth considering USB drives rather than SD cards, more robust, probably cheaper, possibly faster. Also more desirable to steal if Swedish students are liable to do that!
For example
£9.95 for a 32GB micro SD https://www.amazon.co.uk/SanDisk-microS ... B073JWXGNT
£7.83 for a 32 GB USB 3 https://www.amazon.co.uk/gp/product/B077VXV323
An idea that I have to make things easier for the students in the beginning of the project is to install and update everything their pies might need on an SD-card, make an image of that card and copy it to all 96 cards before handing them their pies. That should work right?
How will each student access his/her Pi? SSH? Each one will presumably have to be given a static IP address on your school's internal WiFi. Can the school infrastructure provide that? Certainly you can include ssh and wifi credentials in your customised Raspbian image.
Make certain that they change their password when they first connect to the Pi!
Assuming that you assign static IPs on the school's DHCP server, it's useful to realise that the IP is tied to the Pi hardware not to the SD or USB storage. A student could start afresh with a clean version of Raspbian and still get the same IP address.

The students will only have a very limited knowledge of programming and it is not the #1 goal of this project to teach them programming.
Node-Red on the Pi seems very suitable for this because it's a web based, drag and drop user interface.
It can request data from all sorts of sensors either by dedicated nodes or by running Python scripts.
Data can be sent to a central server by MQTT, or perhaps to a cloud based service such as IBM Watson IOT.
A node-red flow could be as simple as an input which repeats every minute, a node to get data from a DGT22 temperature sensor, an output to send the data.
Or it could combine data from multiple sensors, use a database, do some processing, display the results on a website hosted on the Pi (probably only visible on the school network), all within Node-Red.

Andymator
Posts: 27
Joined: Sat Jun 30, 2018 9:38 am

Re: Huge Pi-project in Swedish high school

Sat Jun 30, 2018 5:20 pm

jbudd wrote:
Sat Jun 30, 2018 4:25 pm
It might be worth considering USB drives rather than SD cards, more robust, probably cheaper, possibly faster. Also more desirable to steal if Swedish students are liable to do that!
For example
£9.95 for a 32GB micro SD https://www.amazon.co.uk/SanDisk-microS ... B073JWXGNT
£7.83 for a 32 GB USB 3 https://www.amazon.co.uk/gp/product/B077VXV323

That is a good idea. I will consider it.
An idea that I have to make things easier for the students in the beginning of the project is to install and update everything their pies might need on an SD-card, make an image of that card and copy it to all 96 cards before handing them their pies. That should work right?
How will each student access his/her Pi? SSH? Each one will presumably have to be given a static IP address on your school's internal WiFi. Can the school infrastructure provide that? Certainly you can include ssh and wifi credentials in your customised Raspbian image.
Make certain that they change their password when they first connect to the Pi!
Assuming that you assign static IPs on the school's DHCP server, it's useful to realise that the IP is tied to the Pi hardware not to the SD or USB storage. A student could start afresh with a clean version of Raspbian and still get the same IP address.

SSH is the idea now. The IT-guys said that they will need the mac-addresses for all the pies to let them have their own subnet on the schools wifi. I assume they will be able to have static IP. I will look into it :)
The students will only have a very limited knowledge of programming and it is not the #1 goal of this project to teach them programming.
Node-Red on the Pi seems very suitable for this because it's a web based, drag and drop user interface.
It can request data from all sorts of sensors either by dedicated nodes or by running Python scripts.
Data can be sent to a central server by MQTT, or perhaps to a cloud based service such as IBM Watson IOT.
A node-red flow could be as simple as an input which repeats every minute, a node to get data from a DGT22 temperature sensor, an output to send the data.
Or it could combine data from multiple sensors, use a database, do some processing, display the results on a website hosted on the Pi (probably only visible on the school network), all within Node-Red.
Node-Red sounds awesome! I do not know what MQTT or IBM Watson IOT is, but I will check it out.

Thanks!

Return to “Beginners”