Thursday, January 2, 2014

Mathematica and the Wolfram Language on Raspberry Pi: a guest post from Wolfram Research

Have you been staring at the Mathematica and Wolfram Language icons on your Raspbian install, and wondering where to get started? We’ll be featuring several guest posts from Wolfram Research in the coming weeks, so you can start to get to work with them. This first, introductory post is from Arnoud Buzing. Arnoud and the Wolfram team would welcome your feedback in the comments below; so would we. Let us know what you’d like to do with Mathematica and the Wolfram Language – it’ll help shape future posts from Wolfram.

A few weeks ago, on November 21st, we released the Wolfram Language and Mathematica for the Raspberry Pi. Just this past week, it’s become even easier to get the software since The Raspberry Pi Foundation began bundling Mathematica and the Wolfram Language directly with their standard NOOBS package and Raspbian operating system.

The responses to this pilot release have been overwhelmingly positive. It has been great to read tweets from educators, scientists, hobbyists and students all around the world, who are excited about using the Wolfram Language to explore the computational universe on their devices.

Today, Wolfram Research is perhaps most widely known for its computational knowledge engine called Wolfram|Alpha: for many students a website which makes short order of complicated homework problems by providing step-by- step solutions. But to create this website a great many problems had to be solved in a very general and systematic way. It only made sense then to build Wolfram|Alpha in the Wolfram Language.

This language differs from other computer languages in that it is very high level with built-in support for solving a very wide variety of computational problems. For over 25 years this language has grown from being able to compute with simple symbolic expressions to the computational knowledge engine it is today. And this feature of making knowledge computable, as well as its powerful ability to create complex programs with very little code, makes it a great language to run on a Raspberry Pi. It also interfaces extremely well with the ‘outside world’ thanks to its large array of supported data collecting sensors and its GPIO. A few great user examples have already been shared on the Wolfram Community website and I would like to share them here with you.

A recent post from Diego shows how to cook your steak using your Raspberry Pi. In this post he writes a small mathlink wrapper to read thermocouple measurements, which he calibrated by using a LinearModelFit on three data points. All this is then hooked up to a controller which turns a crockpot on or off using DeviceWrite["GPIO",17->1] or DeviceWrite["GPIO",17->0].

Another post from Diego shows how you can connect a Wii Nunchuck via an Arduino Uno to Mathematica over a serial connection. First he opens a serial connection using serial=DeviceOpen["Serial", {"/dev/ttyACM0", "BaudRate"->57600}] and then he interfaces with the sketch running on his Arduino by sending a ping over that serial link and reading back the current Wii Nunchuck state using DeviceReadBuffer[serial].

Bob posted a cool example showing how you can write a simple stepper motor controller using the Wolfram Language. He defines a stepMotor function which takes three arguments: the number of steps, the direction and the step time delay.

There are several other simple examples that are worth checking out if you’re just getting started:

 

 

 

No comments:

Post a Comment