POPgirl: Raspberry Pi Setup Steps

A project log for SHE BON

! a platform for sensing and indicating human arousal !

maehemmaehem 10/21/2018 at 05:580 Comments

PopGirl Hardware and Software

Much of this is typed from memory and may be missing a step or some other detail here or there.  Please feel free to share any corrections or contact us to help you get through a step that is failing.

In a nutshell:

 -  Set up a RaspberryPi Zero W with a fresh Raspian. 

 - Enable SSH and VNC.

 - Disable the serial console.

 - Increase the GPU RAM allocation to 128MB.

 -  Remove the Oracle Java and install OpenJava and OpenJavaFX. 

 - Install Pi4J

 - Install WiringPi to version 1.2 or newer.

 - Test our JavaFX based app.

 - Automate the app startup at boot time.


The PopGirl uses a Raspberry Pi Zero W to drive a AdaFruit 5" LCD with touch panel.  The serial port pins (RX and TX) on the GPIO connector are level translated to 5V signal levels for communication with the heart shaped sensor processor board that is located in the heart-shaped backpack.

The sensor board collects and formats sensor data and then bursts them over the serial line once every half-second.  The Raspberry Pi listens for this packet and decodes the values into their respective display values.


Configure a microSD card to run "Raspian with Desktop" from:

If you are new to Raspberry Pi, there are a number of utilities to burn the Raspian image to the SD card.   On our Mac, we used: Apple Pi Baker

At first, you should hook your Raspberry Pi up to a regular monitor, keyboard and mouse.  Boot the system up.

You will want to ultimately enable SSH and VNC so that you can administer and test the app from the comfort of your PC or Mac.  Here is a link for how to enable SSH and VNC.  Any other services should be left alone at this point as we don't use them.

Disable Serial Console (because we need to use it for our hardware).

Read this to understand how to configure the serial:

See the section called "Disabling Linux's use of console UART"


The PopGirl app is written in JavaFX using OpenJava8 but also leverages Pi4J and WiringPi to allow serial port communication as well as GPIO functions.  There are a number of steps to get the stock Raspberry Pi ready for running the Java application.

The Oracle Java8 that is included with the Raspbian distribution will not work for JavaFX.  Oracle has decided to decouple JavaFX from the core Java going forward.   Future versions of Java will have a better mechanism for add JavaFX as an optional module, but for now we need to uninstall the Oracle Java and replace it with OpenJava.  Then we can add the OpenJFX library.

Remove Oracle Java:

sudo apt-get remove --purge oracle-java8-jdk

Add Open Java:

sudo apt-get install openjava openjfx

WiringPi (to access the GPIO/Serial pins from Java)

The version of wiring-pi should be 1.2 or above.  If it's 1.1 then you need to replace it:

curl -s | sudo bash

This Pi4J reference may also help:

GPU Memory Setting:

From the Desktop go to: [Menu] --> [Preferences] --> [Raspberry pi config..] --> [Performance]

Adjust the GPU memory to 128


At this point, JavaFX applications should run OK.

Hiding the mouse cursor

Since we are using a touch screen, we want the mouse cursor to disappear.  There's an app for that:

Let's assume that your Java app is called "PopGirl.jar" and you uploaded it into /home/pi/

Notice that we need to tell java to set the pi4j.linking=dynamic property so that it uses the newer version of WiringPi.

Running the app from the command line (you will need to set the X-display screen number):

export DISPLAY=:0

/usr/bin/java -Dpi4j.linking=dynamic -jar /home/pi/PopGirl.jar

If that's all working, then lets make the JAR start at boot.

Autostarting the app:

Edit:   ~/.config/lxsession/LXDE-pi/autostart

Add this line to the end of the file (notice it starts with @ symbol):

@/usr/bin/java -Dpi4j.linking=dynamic -jar /home/pi/PopGirl.jar

The app should start up ten or so seconds after the desktop comes up.

If you need to debug why the app might not be coming up on it's own then look in this log file for clues:

cat /home/pi/.cache/lxsession/LXDE-pi/run.log