#copper #real-time

cu-rp-encoder

This is a driver for the Raspberry Pi to decode a directional encoder from GPIOs

13 releases (8 breaking)

0.11.0 Nov 26, 2025
0.9.1 Sep 12, 2025
0.8.0 May 26, 2025
0.7.0 Mar 13, 2025
0.4.1 Nov 15, 2024

#31 in #copper


Used in cu-rp-balancebot

Apache-2.0

1.5MB
384 lines

Raspberry Pi based encoder driver for Copper

This driver is for the Raspberry Pi based encoder driver for Copper.

Compatibility

Any encoder with a base clock + a direction trigger.

Usage

Add the driver like any other source in Copper:

    tasks: [
        (
            id: "src",
            type: "cu_rp_encoder::Encoder",
            params: {
                pin_clt: 17,
                pin_dat: 18,
            },
        ),
    ]

The pin_clt is the pin for the clock signal and the pin_dat is the pin for the direction signal.

When you connect this driver to the rest of the system you need to use the cu_rp_encoder::EncoderMsg message type.

    cnx: [
        (src: "src",  dst: "dst",   msg: "cu_rp_encoder::EncoderMsg"),
    ],

It has been tested with a Hall effect encoder like this one:

The encoder

Dependencies

~15–22MB
~362K SLoC