← Home

pi4j sensehat playground

Examples, resources and projects for the Raspberry Pi Sense HAT with Pi4J

Tilt-controlled pixel with the Sense HAT accelerometer

Tilt-controlled pixel with the Sense HAT accelerometer

Read raw accelerometer values from the Sense HAT and move a pixel on the LED matrix by tilting the Raspberry Pi.

Approximating ambient temperature on the Sense HAT

Approximating ambient temperature on the Sense HAT

Combine the humidity and pressure sensor temperature readings and apply a calibration offset to get a better ambient temperature estimate on the Sense HAT.

A pointing-north compass on the Sense HAT

A pointing-north compass on the Sense HAT

Use the Sense HAT magnetometer to draw an arrow on the LED matrix that always points toward magnetic north.

An emoji slideshow on the Sense HAT

An emoji slideshow on the Sense HAT

Cycle through a set of 8x8 pixel-art icons (smiley, heart, skull, space invader, arrow) on the Sense HAT LED matrix using Pi4J.

Particle Fireworks on the Sense HAT

Particle Fireworks on the Sense HAT

A physics-based fireworks simulation for the Raspberry Pi Sense HAT 8x8 LED matrix using Pi4J, with individual particles, gravity and color fade.

Classic Fireworks on the Sense HAT

Classic Fireworks on the Sense HAT

A small Java program that simulates fireworks on the Raspberry Pi Sense HAT 8x8 LED matrix using Pi4J and a simple geometric pattern.

Full Sense HAT demo with Pi4J

Full Sense HAT demo with Pi4J

A single script that exercises every major feature of the Sense HAT via Pi4J — LED matrix, sensors, IMU, joystick, colour sensor and more.

Hello from Pi4J on the Sense HAT

Hello from Pi4J on the Sense HAT

The simplest possible Pi4J + Sense HAT script — scrolls a "Hello from PI4J!" message on the 8x8 LED matrix.

Reading humidity on the Sense HAT

Reading humidity on the Sense HAT

Read the relative humidity from the Sense HAT HTS221 sensor and display it as a scrolling message on the LED matrix.

Moving a pixel with the Sense HAT joystick

Moving a pixel with the Sense HAT joystick

Read the Sense HAT joystick events with Pi4J and move a pixel on the LED matrix, with press-and-hold movement and a color toggle on the center button.

Reading barometric pressure on the Sense HAT

Reading barometric pressure on the Sense HAT

Read atmospheric pressure from the Sense HAT LPS25H sensor and scroll the value on the LED matrix.

Scrolling and rotating text on the Sense HAT

Scrolling and rotating text on the Sense HAT

Scroll a message on the Sense HAT LED matrix in both directions and cycle through the four rotations of the display.

Detecting rotation with the Sense HAT gyroscope

Detecting rotation with the Sense HAT gyroscope

Use the Sense HAT gyroscope to detect the direction of rotation and show L / R on the LED matrix.