Bukit Mertajam, Penang

Raspberry Pi + Processing + CT UNO (Part 1)

Credit to Stewart C. Russell for the tutorial PROCESSING 2.1 + ORACLE JAVA + RASPBERRY PI + SERIAL + ARDUINO = ☺.

About this tutorial:
– Re-writing the original tutorial from Stewart C. Russell with some modification.
Raspberry Pi + Processing 2.2.1 + Oracle Java 1.7.0 + jSSC 2.8.0 + CT UNO (Arduino Uno compatible).




1. Write the latest Raspbian image 2014-09-09 (link) into 8GB SD card using Win32DiskImager.
2. Slot into RPi (short form for Raspberry Pi), connect all the cables (HDMI, LAN, Mouse + Keyboard, CT UNO) and power it up.
3. It is recommended to Expand Filesystem. Press Enter to select.


Then reboot your RPi. Press escape and write the following command.

[code lang=”c” highlight=””]sudo reboot[/code]

4. Default keyboard layout is UK, so you need to change to US layout.


Then select the options below:
– Change Keyboard Layout
– Generic 105-key (Intl) PC – No changes
– Other
– English (US)
– English (US)
– The default for the keyboard layout
– No compose key
– No
Again, you need to reboot.

[code lang=”c” highlight=””]sudo reboot[/code]

5. Ok to proceed to your desktop, press escape, then write

[code lang=”c” highlight=””]startx[/code]

6. Open LXTerminal, you need to write all the command here. So, keep playing with this. 🙂


First, it is better to update and upgrade your RPi.

[code lang=”c” highlight=””]sudo apt-get update
sudo apt-get dist-upgrade[/code]


7. Install Java 7

[code lang=”c” highlight=””]sudo apt-get install oracle-java7-jdk[/code]

8. Then you need to check your RPi java version

[code lang=”c” highlight=””]java -version[/code]

My LXTerminal response as follow,

[code lang=”c” highlight=””]java version “1.8.0”
Java(TM) SE Runtime Environment (build 1.8.0-b132)</span>
Java HotSpot(TM) client VM (build 25.0.b70, mixed mode)[/code]

Opps, I want java version 7 as default.
9. Write following command to choose java version.

[code lang=”c” highlight=””]sudo update-alternatives –config java[/code]

Then select “…/jdk-7-oracle…” as default.
Check again java version

[code lang=”c” highlight=””]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)[/code]



10. You need to download the Processing IDE from web browser, and I like to use Chromium as web browser.

[code lang=”c” highlight=””]sudo apt-get install chromium[/code]

11. Open Chromium, go to processing website to download (https://www.processing.org/download/). Choose Linux 32-bit.
*It will takes some time since the size is ~100MB. However it is depend on your internet speed.
**By default the download file will be in the Downloads folder, I recommend to install processing at home directory, so the command will be much easier. To do that just simply cut file from /home/pi/Downloads and paste to /home/pi.


12. Extract processing download file

[code lang=”c” highlight=””]tar xvzf processing-2.2.1-linux32.tgz[/code]

13. Now you have to remove the included x86 Java runtime, and replace it with the RPi’s armhf.

[code lang=”c” highlight=””]rm -rf ~/processing-2.2.1/java
ln -s /usr/lib/jvm/jdk-7-oracle-armhf ~/processing-2.2.1/java[/code]

You should now have a Processing installation that will run, but there’s some more we need to get serial and Arduino support.


14. Download the latest Java Simple Serial Connector at https://github.com/scream3r/java-simple-serial-connector/releases. After download is finished, cut and paste to home directory, and extract it.

[code lang=”c” highlight=””]unzip jSSC-2.8.0-Release.zip[/code]

15. Overwrite the jssc.jar that ships with Processing with the one you just download.

[code lang=”c” highlight=””]mv jSSC-2.8.0-Release/jssc.jar ~/processing-2.2.1/modes/java/libraries/serial/library/[/code]

16. Now, time to test the serial for Processing. Before that make sure CT UNO is connected to RPi. Then, open Processing.

[code lang=”c” highlight=””]~/processing-2.2.1/processing[/code]


Write this code and run it

[code lang=”c” highlight=””]import processing.serial.*;

Serial myPort; // The serial port</span>

println(Serial.list()); // List all the available serial ports[/code]

It will takes some time (quite slow). As a result, you should get a single line of output.

[code lang=”c” highlight=””]/dev/ttyUSB0[/code]


Done! Your Processing work perfectly! Ok, close your Processing, get some rest, we will continue in Part 2. 🙂


Why not using the latest Java version 1.8.0?
I have try this version and got error during running the Processing. So currently Java 1.7.0 is compatible.


Related Posts

Leave a comment