Searching the Internet it says it is possible to get Processing working on the Raspberry Pi. There are several similar but different accounts of how to do this.
I found that the ones I tried did result in a working version of Processing on the Raspberry Pi, however none would run the BrainGrapher sketch.
More searching revealed that the problem lay with the serial comms – the Processing distribution is not supplied with a library function that works on an ARM on which the Raspberry Pi is built.
There are a couple of techniques on the Internet that describe how to replace the serial comms file, again some of these didn’t fully work.
The version below works, it uses the latest version of Processing, at the time of writing that is 2.1.1 and Oracle Java version 1.7. I make no claims that any of the work in the steps below are mine and the original can be found here, I replicate these step here for convenience and due acknowledgement and credit given to the original author.
http://scruss.com/blog/2014/01/07/processing-2-1-oracle-java-raspberry-pi-serial-arduino-%E2%98%BA/
With Sun Oracle hardfloat Java now available, Processing now runs at a decent clip on the Raspberry Pi. My old instructions are now very obsolete. Here are current, tested instructions for installing it under Raspbian.
Update the system, always a good plan if you’re doing major upgrades:
sudo apt-get update
sudo apt-get dist-upgrade
Install Sun Oracle Java
sudo apt-get install oracle-java7-jdk
Check if the right version is installed as default:
java -version
This should give
java version “1.7.0_40″
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) Client VM (build 24.0-b56, mixed mode)
If you get anything else, you need to make Sun Oracle’s version the default:
sudo update-alternatives –config java
Download & Install Processing
Go to Download \ Processing.org and get the Linux 32-bit version. It’s big; about 100 MB. I’m going to install it in my home directory, so the base path will be ~/processing-2.1. Extract it:
tar xvzf processing-2.1-linux32.tgz
Now you have to remove the included x86 Java runtime, and replace it with the Raspberry Pi’s armhf one:
rm -rf ~/processing-2.1/java
ln -s /usr/lib/jvm/jdk-7-oracle-armhf ~/processing-2.1/java
You should now have a Processing installation that will run, but there’s some more we need to get serial and Arduino support.
Install the java Simple Serial connector
Download jSSC-2.6.0-Release.zip and extract it:
unzip jSSC-2.6.0-Release.zip
Now overwrite the jssc.jar that ships with Processing with the one you just downloaded:
mv jSSC-2.6.0-Release/jssc.jar ~/processing-2.1/modes/java/libraries/serial/library/
You can remove the jSSC folder now:
rm -r jSSC-2.6.0-Release
Fire up Processing:
~/processing-2.1/processing
Open the sketch BrainGrapher and connect Arduino running Brain Master to USB turn on Mindflex headset.
This works however the window opened by this sketch is much bigger than the size available on my small screen, it is not auto-scaled. So a little more work required.
It was fairly easy to adjust screen size, at the beginning of the sketch in the setup method the window size is defined, the size values were altered to suit my screen.
The next thing I did was to add an icon to the desktop. This is not a easy to do as it is in Windows, a file has to be created and I gather the procedure differs between operating systems, I have Debian-Wheezy installed on my Rpi.
Before creating the file, you need to locate where the icon is for Processing, it is stored in the /processing-2.1.1/lib/icons folder, you will also need to know the location of the executable, this is in the /processing-2.1.1/ folder and is called processing. So create a new text file called processing-2.1.1.desktop in the /home/pi/Desktop/ directory.
It should contain the following:
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Processing-2.1.1
Comment=Processing software
Icon=/home/pi/processing-2.1.1/lib/icons/pde-128.png
Exec=/home/pi/processing-2.1.1/processing
Terminal=false
Categories=None;
As soon as the file is saved and closed, the icon should appear on the desktop and clicking it should launch the processing application.
Posted in: Brain Control Interface