Wolfram Blog
Bernat Espigulé-Pons

Embrace the Maker Movement with the Raspberry Pi 2

June 18, 2015 — Bernat Espigulé-Pons, Consultant, Technical Communications and Strategy Group

“All of us are makers. We’re born makers. We have this ability to make things, to grasp things with our hands. We use words like ‘grasp’ metaphorically to also think about understanding things. We don’t just live, but we make. We create things.”
—Dale Dougherty

I joined the maker movement last year, first by making simple things like a home alarm system, then by becoming a mentor in local hackathons and founding a Wolfram Meetup group in Barcelona. There is likely an open community of makers that you can join close to where you live; if not, the virtual community is open to everyone. So what are you waiting for? With the Raspberry Pi 2 combined with the Wolfram Language, you really have an amazing tool set you can use to make, tinker, and explore.

Raspberry Pi 2 and Wolfram Technologies

If there was one general complaint about the Raspberry Pi, it was about its overall performance when running desktop applications like Mathematica. The Raspberry Pi Foundation addressed this performance issue early this year by releasing the Raspberry Pi 2 with a quad-core processor and 1 GB of RAM, which has greatly improved the experience of interacting with the device via the Wolfram Language user interface.

Here are 10 different ways to write a “Hello, World!” program for your Pi.

1) Enter a string:

Hello, World! string

2) Create a panel:

Hello, World! panel

3) Post “Hello, World!” in its own window:

Hello, World! in its own window

4) Create a button that prints “Hello, World!”:

Button that prints Hello, World!
Hello, World!

5) Make your Raspberry Pi speak “Hello, World!”:

Speak Hello, World!

6) Deploy “Hello, World!” to the Wolfram Cloud:

Deploy Hello, World! in the Wolfram Cloud

7) Send a “Hello, World!” tweet:

Send Hello, World Tweet

8) Display “Hello!” over the world map and submit it to Wolfram Tweet-a-Program:

Hello, World! Tweet-a-Program

9) Program your Pi to say “Hello, World” in Morse code by blinking an LED:

Hello, World! in Morse code

Notice that the GPIO interface requires root privilege to control the LED, so you must start Mathematica as root from the Raspberry Pi terminal by typing sudo mathematica in the command line.

Morse code video input for Hello, World

10) Apply sound to the “Hello, World” Morse code:

Applying sound to Hello World morse code
Wolfram Language morse player

This list could go on and on—it’s limited only by your imagination. If you want to send more “Hello, World” Morse code, you can make an optical telegraph. The Community post Raspberry Pi goes to school, by Adriana O’Brien, shows you how.

Adriana's Raspberry Pi setup
This image was created with Fritzing.

One of the most useful things about using the Wolfram Language on the Pi is that it works seamlessly with the new Wolfram Data Drop open service. This allows you to make an activity tracker in just a few minutes. For example, using Data Drop and a PIR (Passive InfraRed) motion sensor, I kept track of all human movements in my home hallway for several months.

Raspberry Pi connected to sensor
This image was created with Fritzing.

Every 20 minutes, the total number of counts was added to a databin, so I could monitor my hallway in real time from anywhere with Wolfram|Alpha. And if I wanted to, I could also analyze the data and create advanced visualizations like in this DateListPlot that distinguishes business days from weekends:

Using databin

The Wolfram Data Drop also accepts images from the Raspberry Pi camera module, so you can easily make a remote motion trigger with a PIR sensor.

Raspberry Pi with PIR sensor

Or you can take several snapshots and make a time lapse, like in this tutorial on turning my animated plant into a moving animal:

Plant animation

The Wolfram Language has all sorts of image processing algorithms built in. But for some applications, the image that comes out with DeviceRead["RaspiCam"] is just too small. To take the most out of your 5 MP camera module, use Import with the following specifications:

Using Import to enlarge a RaspiCam photo

Yes, this is the view from my office window. There is a lot of detail that can be processed in many different ways:

Processing details in different ways

The Wolfram Language on Raspberry Pi 2 is also great for rapid prototyping and 3D printing. It knows how to import and export hundreds of data formats and subformats. For example, here’s how to turn the skeletal polyhedron (specifically, a rhombicuboctahedron) drawn by Leonardo da Vinci into an object file that can be 3D printed:

Leonardo Da Vinci rhombicuboctahedron sketch into 3D printed

Finally, let me invite you to join Wolfram Community and show off your own Raspberry Pi projects, discover new ideas to use as starting points in your future creations, or take advantage of the many helpful tutorials that have been posted by fellow users.

Download this post as a Computable Document Format (CDF) file.

Posted in: Raspberry Pi
Leave a Comment

No Comments

Leave a comment


Or continue as a guest (your comment will be held for moderation):