# Connecting to Raspberry Pi's Wolfram Language kernel from a PC's Mathematica front end

Recently I bought a Raspberry Pi and I installed the Wolfram Language on it. Comparing WL 10.0's commands with Mathematica 9.0.1.0's commands, I found 328 additional commands and variables. I understand that WL is in a preliminary version so more commands may be added (or removed) in the near future but since this seems to be the future, I believe learning as quickly as possible the new possibilities would be a strong asset.

Since my PC's front end is much faster than the RPi's, I would like to call these through my Mathematica 9.0.1 front end and get the results in the same front end. This would save a lot of time lost in going forward-backward between them. So how can I call the WL kernel from my PC (I have attached both to an Ethernet LAN)?

-
When you say your PC is so much faster than the Pi is that for running mathematica/WL code? Because if you do succeed in making the connection you desire the code will still be running on the Pi and just as slow. The only gain you will make is convenience of not having to switch. – Ymareth Feb 25 '14 at 14:43
Asking users to comment on some 100-200 new functions is waay too broad and perhaps out of scope for this site. Besides, there is documentation for a lot of these (but not all) available online, so I don't see why you couldn't just look them up. Third, you can't run the functions available in the WL kernel on your Pi in Mathematica 9 on your PC... that's just not how it works. Besides, even if it were possible, it would probably be a violation of the license, so people might not answer that question here. – R. M. Feb 25 '14 at 14:43
Yes I know - I just want to call the new commands from 9.0 in my PC. I don't mind the delay. – tchronis Feb 25 '14 at 14:44
I'm looking forward to version 10 too. But you know, I still haven't mastered all the commands that were new in version 7 yet! – bill s Feb 25 '14 at 14:45
@rm -rf I hope there is no license problem. I am a licensed MMA 9.0 user and I would like to explore the new commands from a more robust environment. It is well known that Pi's xwindows are very heavy for it. So I cannot build notebooks larger than a few kb. To produce the help file took 30 minutes. – tchronis Feb 25 '14 at 14:48

You can download the Remote Development Kit here (scroll down a bit).

It's a CDF file that shows this when opened:

Click "INSTALL" to finish the installation.

Now go to Palettes -> Remote Development Control Panel.

Click Configure Pi Connection and enter the IP address of your Pi, as well as the default username.

Click New Pi Notebook, enter an expression to evaluate and press Shift-Enter. A dialog will come up to enter the password for the Pi.

Now you're ready to work with the Pi kernel and a desktop front end!

This works both for front end version 9 and 10.

This sets up a remote kernel with almost the same configuration bobthechemist describes in his answer, however he runs the kernel as root on the Pi, which allows access to hardware (e.g. GPIO).

If this method doesn't work, verify that it is possible to connect to the Pi using ssh from a terminal.

-
+1 for putting all the information in a convenient spot. Seems like folks who gather in WC have problems getting this option to work. Another case of YMMV. – bobthechemist Jul 11 '14 at 16:21
@bobthechemist Do I see it correctly that the only difference between this and your configuration is that you ran the Pi kernel as root? – Szabolcs Jul 11 '14 at 16:44
Yes - the benefit of running the kernel as root is to get access to commands such as DeviceWrite["GPIO", {24->1}]. – bobthechemist Jul 11 '14 at 16:49
I tried to connect to my pi from a remote network. I usually connect to the Pi with ssh -p 22000 pi@ip_address because I changed the default SSH port to avoid brute force attacks. I changed the launch command to java -jar "mathssh" -p 22000 pi@ip_address /usr/bin/wolfram -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName "linkname" -LinkHost ipaddress but I can't connect to it. Am I doing it wrong? – shrx Aug 20 '14 at 13:02
I found this: quiterandomnotes.blogspot.com/2013/04/… Looks like it's a problem that I'm behind a router and I'll have to set up a VPN. Not that I know how to do it... – shrx Aug 20 '14 at 13:56

It is possible to connect to the RPi through a PC running v9 using the remote kernel options

1. From "Kernel Configuration Options..." Add a new kernel
2. Choose the Advanced options and ensure that Arguments to MLOpen has the following

"java" -jar "mathssh" pi@192.168.1.110 sudo wolfram -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName "linkname" -LinkHost ipaddres
Obviously, replace your ipaddress as appropriate. The sudo in the kernel launch will allow you to use DeviceWrite functions that access the GPIO; in my opinion one of the main reasons to run Mathematica on a RPi.
Thanks @bobthechemist. I could get everything up to just before the request for the password dialogue box - the MLECONNECT error just kept appearing -, I could successfully SSH into the pi but the dialogue box requesting password just would not show. I replaced the auto-generated options with the following (plus my details) and everything started working. "java" -jar "mathssh" pi@192.168.1.110 sudo wolfram -mathlink -LinkMode Connect -LinkProtocol TCPIP -LinkName "linkname" -LinkHost ipaddres – MrSchmidtRCC Dec 12 '14 at 23:24