Raspberry Pi 5 as a remote control panel: drivers for buttons and an analog joystick?

2026-11-12
2026-11-26
  • antoine-cod - 2026-11-12

    Hello,

    I am building a small remote-control panel on a Raspberry Pi 5 (screen, push buttons, analog joystick). Setup: CODESYS Control for Raspberry Pi 64 SL 4.22.0.0, IDE V3.5 SP21 Patch 3 (3.5.21.30), Raspberry Pi OS 64-bit. The Pi controls a remote WAGO PFC200 over Modbus TCP (OpenVPN link, LoRa… still under test).

    Questions:

    1. The Pi has no analog inputs. Besides the MCP3008 (SPI) in the "Raspberry Pi Legacy" package, are there other CODESYS device descriptions or drivers for ADC or analog I/O boards on the Pi ? Which boards or ADC chips do you recommend for the Pi 5 that already have a CODESYS device description or driver ?
    2. Do the SPI, I2C and 1-Wire drivers of that package work on the Pi 5 ?

    Thank you for any pointer.

    Best regards, Antoine.

     
  • YIN

    YIN - 2026-11-26

    Hi Antoine,

    Short answer to your second question first: yes, the SPI, I2C and 1-Wire drivers from the Raspberry Pi package do work on the Pi 5, at least with the 64-bit runtime you're already running. I've had SPI and I2C running on a Pi 5 under 4.22 without any drama. Two things that caught me out the first time, though: the interfaces have to be switched on in Raspberry Pi OS first (raspi-config), or the runtime just doesn't see them, and you really want the 64-bit package β€” the Pi 5 moved its GPIO onto the RP1 chip, and that's where the old 32-bit setup starts acting up.

    On ADCs, the MCP3008 is honestly the path of least resistance for what you're building. Ten bits sounds modest, but for a joystick and a couple of pots it's more than enough, and the ready-made device description in the legacy package just drops into the device tree. If you want finer steps, the MCP3208 is the 12-bit sibling in the same family and speaks the same SPI protocol, but last time I looked there was no ready-made device description for it, so you'd have to drive it through the generic SPI driver yourself. The other one I keep coming back to is the ADS1115 on I2C β€” 16-bit, four channels, and breakout boards are everywhere. Same caveat, though: check the device repository first, and if there's no ready-made device for it, the generic I2C function blocks will get you there with a bit more work.

    For the joystick itself, wire each pot across 3V3 and GND with the wiper into the ADC input, then scale the raw value in your code with a small deadband around centre β€” otherwise the stick will keep nudging your setpoint when nobody is touching it. For the buttons, use the digital inputs from the Raspberry Pi GPIO driver with the internal pull-ups switched on, and debounce them with a short TON. Mechanical buttons bounce, and without the debounce you'll get double triggers.

    One last thing, since this panel talks to a PFC200 over Modbus: get the whole thing working on the bench first, and don't let the panel own any safety function. The joystick and buttons are fine for setpoints and manual moves, but stops and interlocks belong in the controller, not in a remote panel.

    Curious to hear which ADC you end up with β€” good luck with the build.

     

Log in to post a comment.