Camel Pi4j component

Camel Pi4j component can be used to manage GPIO and I2C bus features from Raspberry Pi. This component uses pi4j library

Maven dependency

Maven users should add the following dependency to their POM file:


Avaliable for rhiot.version >= 0.1.1

URI format for GPIO


gpioId must match [A-Z_0-9]+ pattern. By default, pi4j-gpio uses RaspiPin Class, change it via gpioClass property You can use static field name "GPIO_XX", pin name "GPIO [0-9]" or pin address "[0-9]"

Optional URI Parameters

Parameter Default value Description
state Digital Only: if input mode then state trigger event, if output then started value
mode DIGITAL_OUTPUT To configure GPIO pin mode, Check Pi4j library for more details
action Default : use Body if Action for output Pin (TOGGLE, BUZZ, HIGH, LOW for digital only) (HEADER digital and analog)
value 0 Analog or PWN Only
shutdownExport true To configure the pin shutdown export
shutdownResistance OFF To configure the pin resistance before exit program
shutdownState LOW To configure the pin state value before exit program
pullResistance PULL_UP To configure the input pull resistance, Avoid strange value for info
gpioClass class<> pin implementation
controller instance of <> GPIO controller instance, check gpioClass pin implementation to use the same





When using producer you can also set or override action using message header with a key of Pi4jConstants.CAMEL_RBPI_PIN_ACTION

.process(exchange -> exchange.getIn().setHeader(Pi4jConstants.CAMEL_RBPI_PIN_ACTION, "LOW"))
Simple button w/ LED mode

Plug an button on GPIO 1, and LED on GPIO 2 (with Resistor) and code a route like this


URI format for I2C


Optional URI Parameters

Parameter Default value Description
busId i2c bus
deviceId i2c device
address 0x00 address to read
size -1
offset -1
bufferSize -1
driver cf available i2c driver

I2C component is really simplistic, the consumer endpoint reads a single byte, or to a buffer of bytes directly from the device. The producer writes 1 or more bytes.

For smarter devices, you must implement a driver.

i2c driver

Driver Feature
bmp180 Temperature and Pressure sensor (
tsl2561 Light sensor (
lsm303-accel Accelerometer sensor (
lsm303-magne Magnetometer sensor (
mcp23017-lcd LCD 2x16 char (
hts221 Humidity and Temperature sensor used by the Official RaspberryPi Sense-Hat ST device doc
lps25h Pressure and Temperature sensor used by the Official RaspberryPi Sense-Hat ST device doc