University course trades textbook for Raspberry Pi

No readers like this yet.
Raspberry Pi used at SUNY Albany

Opensource.com

The Raspberry Pi has replaced the textbook at the State University of New York at Albany in the class, Information in the 21st Century.

Ethan Sprissler is the instructor for the 900 student class (split into two sections, 400 and 500 students respectively). He uses the Raspberry Pi instead of the traditional textbook in order to:

 

  • Demystify hardware.

(See: Clarke's three laws)

  • Develop familiarity. 

Make even low-level electronics and engineering a practical reality for the students, develop familiarity and promote the popularity of Linux/Unix.

  • Reduce risk.

Provide a low-cost, low risk platform that gives students the tools and foundation for innovation.

First, the students watch this presentation to understand how easy it is to use the Raspberry Pi. They learn how to:

Raspberry Pi and its camera

The initial setup of the camera was done smoothly by following the instructions here and recounted here. All of the examples are focused on demystifying technology and showing the students that some very cool things can be done with the tools that they have within their reach. The source code of the Python examples are available on Github.

You are free to use and pass along this presentation (created using Reveal.js and available here); it can be forked or cloned on GitHub.

User profile image.
Luis Ibáñez works as Senior Software Engineer at Google Inc in Chicago.

16 Comments

<em>Run a web server using a single line of Python.</em>

Uh... it looks like they're <em>starting</em> a web server with a single line of <code>bash</code> (or whatever shell they're using), but the server itself is more than a single line of Python.

Or am I just being pedantic?

Pat,

Yes, your clarification is correct.

This is indeed on line of "bash", that is calling a full module written in Python, that in turns runs a Web server.

On the big scheme of things, it still seems to be fair to give the credit to Python for offering that feature, rather than to give the credit to Bash just for doing the invocation of that cool Python feature.

The full Python equivalent is in this slide:
http://www.opensourcesoftwarepractice.org/Raspberry-Pi-Web-Server-With-Python/#/13

That is about 4 lines of Python readable code,

import SimpleHTTPServer, SocketServer
handler = SimpleHTTPServer.SimpleHTTPRequestHandler
server = SocketServer.TCPServer(("",8000),handler)
server.serve_forever()

and could be squeezed into two lines of "less-readable" code:

import SimpleHTTPServer, SocketServer
SocketServer.TCPServer(("",8000),SimpleHTTPServer.SimpleHTTPRequestHandler).serve_forever()

We would rather have students get used to write readable code...

This is marginally better in size than the equivalent in Node.js:
http://www.kitware.com/blog/home/post/433

Overall, for the purpose of the class, the point of this exercise was to show students that it is "really easy" to do things that they can interact with.

The goal of the Raspberry Pi is to demystify computing and to create an environment where students can experiment quickly and have fun on the process.

Yes. You are.

No, you're not and: yes, I concur. But even if there was a whole webserver embedded in Python, I would have trouble to call it a "single line webserver".

Hans,

Yes.... but.... :-)

I still think that it deserves to be called a "single line server":
http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python

You are right that in practice, this module is sitting on top of hundreds of lines of Python, that in turn sit on top of thousands of lines of C, that make all the magic possible.

But from the point of view of the user logged into that Raspberry Pi, (or any Linux system running Python), the fact remains that: by typing one-single-line command, she/he manages to spawn a web server.

This is possible thanks to Python offering the SimpleHTTPServer module,
http://docs.python.org/2/library/simplehttpserver.html,
and offering the "-m" option to launch a module directly.

No one said it's a one line Web Server.

If I were a student, I would be much more interested in the white box nweb server (http://www.ibm.com/developerworks/systems/library/es-nweb/index.html) than a black box Python module. Why? because the former is a simple, but comprehensible webserver. If I understood that one, I would be able to expand it in any direction I liked instead of being bound by whatever Python offers me. It CLARIFIES things instead of MYSTIFYING things. Instead of just just applying techniques, I would be creating them. That's real education - making architects instead of consumers.

Hans,

Thanks for pointing us to nweb.
It is a really nice and compact system.

The accompanying web page tutorial for nweb is nicely crafted as well.

I'm looking forward to use it in the training sessions at the student-driven hackSpace that we just started at SUNY Albany.

I think both holds true: for students that just get into "programming" or "hacking on stuff", the "one line" python/bash-server is better suited, as it allows them to easily get something going, that will / may foster their appetite to learn more.
Once they are at that point, the nweb server is probably the better choice. But if they just start, throwing 200 lines C code at them will overwhelm them and most of them will just quit because it is too much.

Hi Luis!

Glad I could help you! That's where commentators are for ;-)
Note nweb features a RasPi version as well (binary), so you're ready to go.

Luis,

Is there a specific image that you use to rollout the RPi's for the students?

Is this image somewhere available?

Greatings
Arjen
Netherlands.

Arjen,

This was done with the Raspbian Debian distribution.

The command:

cat /etc/debian_release

returns

wheezy/sid

The image can be downloaded here
http://www.element14.com/community/community/raspberry-pi#downloadcenter

The camera configuration was done following these instructions:
http://www.raspberrypi.org/camera

Best

Luis

I have to agree with Hans here.
I loved my very first programming teacher because she taught us how to think-code. It wasn't a question of "What library do I load to get a module that does X"

It was a question of how do I write a module that does X. (To be honest we didn't even learn the term module until later.)

I don't do a lot of programming these days, but I still like the notion of being in control of code and how it functions. If I use someone else's libraries and modules (which we all do.) There is something less personal about it, it doesn't really feel like it is "mine."

Being a C/C++ programmer, I certainly sympathize with the view that it is important to be exposed to the understanding of what happens at the lower levels.

However, both in education and in programming there is value in having the multiple layers of abstraction.

As long as we don't preclude developers from being able to dig deeper in the code as they get more curious, there is no harm in providing a higher conceptual abstraction.

We can move progressively:

from: A web server in a Python module

to: a Web server implemented by three python classes, calling about five functions, all from that previous module.

to: a C implementation, (in the case of nweb) calling three C functions { log(), web(), main() },

to: the examination that nweb functions in turn call eight other C functions { getenv(), chdir(), setpgrp(), signal(), open(), read(), write(), and close() }.

I fully agree that by using the lower level approach, the students will get closer to understanding how things work. Although, for full understanding, they should go further and study processes and inter-process communications (to make sense of signal(), and fork() ), and understanding the file system and pipes ( to make sense of chdir(), open(), close(), read(), write() )... and following this logic, we probably should dive also into the source code implementation of these functions, under the kernel code, to really see how they are working..., then we have to understand drivers,... and probably introduce some bits of assembly code, and have a footing on electronics...

Certainly, this is what the Raspberry Pi was designed for. The question is how to get there progressively, without generating push back.

The instructor challenge is: How to create the conditions for motivating the students to further and dig deeper in the topics ?

One good option is to stay away from lectures, and to trigger the learning of the lower levels through direct interactions of students with programming platforms.

This is one of the reasons that led us to create a HackSpace at SUNY Albany as well. Aiming to create the informal environment in which students could explore deeper, at their own pace, and driven by their own curiosity. This removes the artificial constraints of time, curricular topics and co-location that make so hard to allow students to explore topics progressively as they become ready for them.

There must be something in the water in Albany, New York. Siena College Physics professor, <a href="http://www.sos.siena.edu/physics/People/Faculty_Profiles/McColgan,_Michele/">Dr. Michele McColgan</a> has been teaching with Raspberry Pi (as well as several other creative, hands-on tools) not only in her classes to undergrads, but as part of a larger summer camp and "Urban Scholars" program.

Dr. McColgan is an inspiring and energetic educator, exactly what STEM, open source, the maker movement, women in technology needs. How about an article on her and her efforts?

Patrick,

Many Thanks for sharing this.

It is very interesting to see what Dr. McColgan is doing.

It is an excellent idea to have an article about her and her work.
I just reached out to her (thanks for the contact information).

I'm looking forward to learn more from her experience, and to share it here as an article or an interview.

Thanks

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.