Raspberry Pi in Higher Education Alexander Elsas Goethe University Frankfurt, Germany The Raspberry Pi Big Birthday Weekend, Cambridge [email protected] Seite 1 Alexander Elsas Assistant Professor Economics, Management & Information Systems Database developer with APEX Information Systems for Business Students Management for Computer Science Students Raspberry Pi since February 2012 Seite 2 Seite 3 To Carry Coals to Newcastle Price tag ● Performance ● Flexibility ● GPIO ● Wolfram ● ... ● Seite 4 Experiences so far Introduced the Raspberry Pi in every introductory course for business students since winter semester 2012: ● ● ● Always an overwhelming positive reaction, lots of questions far beyond the syllabus, biggest motivation the multimedia center. Based on these positive reactions the “Two Simple Projects“ have been created. Seite 5 Two Simple Projects PiMMS: Pi-based Multimedia System FRAdir: Operating directions of Frankfurt Airport Objective: Get business students an intro into computer science (information systems) and provide them a feeling of success to boost their motivation. Seite 6 PiMMS Turn-key digital signage system: Power-on on premise No network connectivity needed No manual configuration necessary Boots into slideshow No coding, just configuration of existing programs Fast results, product can be used in a real-life scenario Possible extension: integrate network connectivity Seite 7 FRAdir FRAport publishes the actual direction of operation of Frankfurt Airport (FRA) on their website (07 East / 25 West) Objective: Gather data from the website, store it in a database for later analysis Programming exercise in Python in a nutshell Possible extension: 7-segment LED display Seite 8 Show-and-Tell Both projects can be seen tomorrow. Seite 9 Computer Science Students ● ● ● ● ● ● Course “Introduction into ERP“ Very SAP-oriented Students “hate“ SAP Open Source ERP with Raspberry Pi Installation and configuration of OpenERP (now Odoo: http://en.wikipedia.org/wiki/Odoo) Comparison of performance, GUI, etc Seite 10 Further projects in the pipeline ● ● ● SQL-Box: Raspberry Pi as database server, equipped with MySQL or SQLite as SQL learning tool Pi-Lab: Establish an infrastructure on campus to support more advanced projects Ideas from the audience ... Seite 11 Best Programming Language? ● Learning to programme is independent from a specific language. ● A problem must be analyzed, divided in sub-problems, etc … ● At the end of the day the remaining problems are on the level of individual statements of the chosen programming language. Programming is a process, not a language! Seite 12 Something completely different Raspberry Pi and its success, ecosystem, created jobs and businesses as object of economic analysis. Seite 13 Contact Alexander Elsas Goethe-Universität Frankfurt Theodor-W.-Adorno-Platz 3 D-60323 Frankfurt Telephone: +49 69-798 33636 Fax: +49 69-798 33639 Email: [email protected] Internet: databaselab.de Seite 14 PiMMS & FRAdir – Two Simple Projects Alexander Elsas Goethe University Frankfurt, Germany The Raspberry Pi Big Birthday Weekend, Cambridge [email protected] Seite 1 Two Simple Projects PiMMS: Pi-based Multimedia System FRAdir: Operating directions of Frankfurt Airport Objective: Get business students an intro into computer science (information systems) and provide them a feeling of success to boost their motivation. Seite 2 PiMMS Turn-key digital signage system: Power-on on premise No network connectivity needed No manual configuration necessary Boots into slideshow No coding, just configuration of existing programs Fast results, product can be used in a real-life scenario Possible extension: integrate network connectivity on premise Seite 3 Seite 4 Seite 5 Seite 6 Components Monitor feh as slideshow application starts automatically after booting into LXDE xscreensaver to disable screensaver of LXDE sudo apt-get install feh xscreensaver Seite 7 Technical Details feh -pzrFYD10 slideshows in slideshow, make slideshow executable (http://man.finalrewind.org/1/feh/ for options of feh) Autostart in LXDE: Add @/home/pi/slideshow to /etc/xdg/lxsession/LXDEpi/autostart Seite 8 Looking for ... Replacement for feh which can also show video (like Irfanview) Seite 9 FRAdir FRAport publishes the actual direction of operation of Frankfurt Airport (FRA) on their website (07 East / 25 West) Objective: Gather data from the website, store it in a database for later analysis Programming exercise in Python in a nutshell Possible extension: 7-segment LED display Seite 10 Data source: http://apps.fraport.de/betriebsrichtung/betriebsrichtung.html Seite 11 Source Code: betriebsrichtung.py #!/usr/bin/python import urllib, time, sqlite3, smtplib from email.message import Message #URl einlesen sock = urllib.urlopen("http://apps.fraport.de/betriebsrichtung/betriebsr ichtung.html") htmlSource = sock.read() sock.close() beg = htmlSource.find("Betriebsrichtung") betriebsrichtung = htmlSource[beg+60] if (betriebsrichtung == "0"): betriebsrichtung = "Ost 07" else: betriebsrichtung = "West 25" Seite 12 seit = htmlSource.find("seit") datum = htmlSource[seit+5:seit+15] zeit = htmlSource[seit+17:seit+25] sep = ";" ausgabe = betriebsrichtung+ sep+ datum+" "+ zeit+ sep+ time.strftime("%c") print ausgabe Seite 13 f = open('status.br', 'r') last = f.readline() f.close() #print last msg = Message() msg.set_payload(ausgabe) msg["Subject"] = "Betriebsrichtung: "+betriebsrichtung msg["From"] = "[email protected]" msg["To"] = "[email protected]" Seite 14 if (last[0] <> betriebsrichtung[0]): #print "Wechsel!!!" f = open('status.br', 'w') f.write(betriebsrichtung) f.close # csv fortschreiben f = open('br.csv', 'a') f.write(ausgabe+'\n') f.close # html datei updaten sep = "<br>" ausgabe = "<div style>"+betriebsrichtung+ sep+ "Seit: " +datum+" "+ zeit+ sep+"Update: "+ time.strftime("%c")+"</div>" f = open('/var/www/br.html', 'w') f.write(ausgabe) f.close Seite 15 # datenbank #if (True): db = sqlite3.connect('br.db') cursor = db.cursor() cursor.execute('''INSERT INTO br(id, richtung, zeit, bemerkung)VALUES(NULL,?,?,?)''', (betriebsrichtung, zeit+";"+datum, ' ')) db.commit() db.close() Seite 16 # email #if (True): smtpobj = smtplib.SMTP("smtp.gmail.com", 587) smtpobj.ehlo() smtpobj.starttls() smtpobj.ehlo() smtpobj.login('[email protected]', 'mysecretpassword') smtpobj.sendmail('[email protected]', '[email protected]', msg.as_string()) smtpobj.quit Seite 17 Email on midday: statusbr.py #!/usr/bin/python import smtplib from email.message import Message f = open('status.br', 'r') last = f.readline() f.close() msg = Message() msg.set_payload(last) msg["Subject"] = "Betriebsrichtung: "+last msg["From"] = "[email protected]" msg["To"] = "[email protected]" smtpobj = smtplib.SMTP("smtp.gmail.com", 587) smtpobj.ehlo() smtpobj.starttls() smtpobj.ehlo() smtpobj.login('[email protected]', 'mysecretpassword') smtpobj.sendmail('[email protected]', '[email protected]', msg.as_string()) smtpobj.quit Seite 18 Crontab betriebsrichtung.py is started hourly statusbr.py always on midday Seite 19 Seite 20 Contact Alexander Elsas Goethe-Universität Frankfurt Theodor-W.-Adorno-Platz 3 D-60323 Frankfurt Telephone: +49 69-798 33636 Fax: +49 69-798 33639 Email: [email protected] Internet: databaselab.de Seite 21