Mathematica comes preinstalled on raspbian and is free for personal use. Adding a vnc or rdp server to a raspberry pi running raspbian allows to display and control Mathematica with an iPad. If the raspberry pi is configured as wlan access point you get a free and rather mobile installation of Mathematica.

Required hardware: raspberry pi model B, 16 GB sd(hc) card (at least 4 GB), ew-7811un wireless usb adapter; device running a vnc or rdp  viewer (e.g. iPad with RD Client app).

  1. Installation of raspbian to sd card:
    download raspbian image http://downloads.raspberrypi.org/raspbian_latest
    unzip the file
    copy it to the sd card (linux: dd if=your_file of=/dev/sdX bs=1M; sdX is the device name of the sd card)
  2. Configuration of raspbian on raspberry pi:
    for the first run plug monitor, keyboard, lan and usb current source into raspberry pi;
    raspi-config gets started automatically on first boot
    resize raspbian partition to full size of sd card (using the menu of raspi-config)
    set hostname, keyboard, language, timezone, password; enable ssh server; boot into console
    login as user pi and become root with sudo su. Run apt-get update and then apt-get upgrade
  3. Add software to raspbian (as root user)
    apt-get install mc (I cannot live without)
    apt-get install xrdp
    apt-get install tightvnc-server
    apt-get install hostapd dnsmasq
  4.  The xrdp server works with the default configuration. Alternatively use tightvnc-server as described here:
    with  VNC_USER=”pi”, HOME=”/home/pi”,FOO_ID=1
    and set as user pi a password for vnc with vncpasswd;
    after reboot the vnc server will listen on port 5901
  5. Configure the wlan router function as described here, but make the following changes:
    the program /usr/bin/hostapd installed by raspian has to be replaced by  a self compiled version (mine is here – having used these instructions); (or you might use this file mentioned in this note)
    add dns server 8.8.8.8 to /etc/dnsmasq.conf: dhcp-option=6,8.8.8.8
    (ios clients seem to be picky about non standard network masks. So configure wlan0 with 255.0.0.0 and adapt dnsmasq.conf.
    dhcp-range=interface:wlan0,10.0.0.2,10.0.0.20,10.254.254.20,255.0.0.0,infinite)
    add modules to /etc/modules (one per line):
    nf-conntrack-ipv4 iptable-nat ipt-MASQUERADE (optional iptable-filter )
    do not create the file /etc/network/ifup.d/router.sh, but add the 2 lines of this file to /etc/rc.local
    ifup wlan0
    iptables –table nat -A POSTROUTING –out-interface eth0 -j MASQUERADE
    #optional: iptables -A FORWARD –in-interface wlan0 -j ACCEPT
    #optional: iptables -I INPUT -i wlan0 -p udp –dport 67:68 –sport 67:68 -j ACCEPT
    (and make sure that the newly added lines are above the line “exit 0”)
    Remark: long iptables options have — which tends to get displayed as unicode long hyphen; (has to be replaced manually when using copy and paste):
    To test hostapd and/or dnsmasq run it on the console: hostapd /etc/hostapd/hostapd.conf
    and/or dnsmasq -u dnsmasq –conf-file=/etc/dnsmasq.conf -d
  6. Plug the mini wlan adapter ew-7811un into the raspberry pi and reboot
    try to join wlan Himmbeerhacks and try to connect with rdp to 10.0.0.1 or open 10.0.0.1:5901 with a vnc viewer (like  RD Client or Remoter VNC on iPad).

Further trial and error shows that with a bluetooth keyboard rdp works better than vnc. Especially square brackets (alt+5, alt+6) do not work well with vnc – at least in my setup with locale swiss german. That is why I started to use xrdp and the free microsoft remote desktop client for iOS.

4 Comments

  1. Blog of spblinux » Blog Archive » Raspberry Pi as airplay client for iPhone says:

    […] To setup raspbmc as wifi accesspoint refer to this post […]

  2. Blog of spblinux » Blog Archive » Raspberry Pi as PirateBox using BerryBoot says:

    […] replace /usr/bin/hostapd by this version (reference) […]

  3. Blog of spblinux » Blog Archive » Raspberry Pi with Mallory says:

    […] Installation on a raspberry pi with raspbian and configured access point: […]

Leave a Reply