r/raspberry_pi 11h ago

News Popping in to say we've just launched the biggest Raspberry Pi Touch Display yet.

Post image
54 Upvotes

A 10" screen with more room for your dashboards, data, and applications.

Read more here


r/raspberry_pi 21h ago

Show-and-Tell PSPi 6: A Decade of Obsession

Thumbnail
youtube.com
11 Upvotes

This is a custom all-in-one board that lets you put a Raspberry Pi Zero or Compute Module 4 (and CM5 if you're adventurous) into a PSP shell. It allows you to turn your broken PSP into an emulation system or a fully functioning portable Linux system, all without making any modifications to the PSP shell.


r/raspberry_pi 21h ago

Show-and-Tell pFAT Controller - a Lego Power functions control system using Raspberry Pi

3 Upvotes

Hi, if anyone is interested , this is my project to control Lego City Power Functions IR trains with a Raspberry Pi and some additional electronics.

All details on the Github here: https://github.com/tjh1976/pFAT-Controller/ including a video (which I'm not sure i'm allowed to post directly here).

Feel free to ask any questions if you want to give this a try yourself.


r/raspberry_pi 20h ago

Troubleshooting Any way to speed up the display?

0 Upvotes

So i have a 3.5 inch generic tft display and i got it to work on a pi zero 2 w with a pios bullseye image from the dlc wiki, but the problem is that the display is VERY slow. I know tft i pretty limited but i wanna see if i can at keast speed it up enough so that my mouse cursor doesnt lag so much. Heres the link to the dlc wiki where i got my image from : https://www.lcdwiki.com/3.5inch_RPi_Display

Does anybidy know how to solve this?


r/raspberry_pi 20h ago

Troubleshooting PWM not working on gpio 12 and 13

2 Upvotes

Im working on a motor controller and in the code ive made ive successfully made it so the controller can control the PWM voltage of the pins. But when i test it, no voltage is coming out of the pins. Im using a raspberry pi 5b and gpio 12 and 13 are mapped to pwm0 and pwm1 respectivly. Below is the code im using.

package org.example;
import com.pi4j.Pi4J;
import com.pi4j.boardinfo.util.BoardInfoHelper;
import com.pi4j.io.gpio.digital.DigitalInput;
import com.pi4j.io.gpio.digital.DigitalOutput;
import com.pi4j.io.gpio.digital.DigitalState;
import com.pi4j.io.gpio.digital.PullResistance;
import com.pi4j.util.Console;
import de.gurkenlabs.input4j.InputDevices;
import de.gurkenlabs.input4j.InputDevices.*;
import de.gurkenlabs.input4j.components.Axis;
import de.gurkenlabs.input4j.components.Axis.*;
import de.gurkenlabs.input4j.components.Button;
import de.gurkenlabs.input4j.components.XInput;
import com.pi4j.io.pwm.Pwm;
import com.pi4j.io.pwm.PwmType;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static int leftPower = 0;
    public static int rightPower = 0;
    public static int shooterPower = 0;
    public static int rightPowerTurn = 0;
    public static int leftPowerTurn = 0;
    public static float turnMult = .60f;

    public static void main(String[] args) throws Exception{

        final var console = new Console();
        console.title("||----Mini Outreach Robot----||");

        var pi4j = Pi4J.newAutoContext();

        var rightMotorConfig = Pwm.newConfigBuilder(pi4j)
                .id("rightMotor")
                .name("Right Motor")
                .address(0)
                .pwmType(PwmType.HARDWARE)
                .provider("linuxfs-pwm")
                .initial(0)
                .shutdown(0)
                .build();
        var leftMotorConfig = Pwm.newConfigBuilder(pi4j)
                .id("leftMotor")
                .name("Left Motor")
                .address(1)
                .pwmType(PwmType.HARDWARE)
                .provider("linuxfs-pwm")
                .initial(0)
                .shutdown(0)
                .build();
        var shooterConfig = Pwm.newConfigBuilder(pi4j)
                .id("shooterMotor")
                .name("Shooter Motor")
                .address(3)
                .pwmType(PwmType.HARDWARE)
                .provider("linuxfs-pwm")
                .initial(0)
                .shutdown(0)
                .build();

        Pwm rightPWM = pi4j.pwm().create(rightMotorConfig);
        Pwm leftPWM = pi4j.pwm().create(leftMotorConfig);
        Pwm shooterPWM = pi4j.pwm().create(shooterConfig);

        try (var devices = InputDevices.init()) {
            var device = devices.getAll().stream().findFirst().orElse(null);
            if (device == null) {
                System.out.println("No input devices found.");
                return;
            }

            device.onAxisChanged(Axis.AXIS_Y, Main::yAxis);
            device.onAxisChanged(Axis.AXIS_RX, Main::xAxis);
            device.onAxisChanged(XInput.RIGHT_TRIGGER, Main::shooter);

            // simulate external polling loop
            while (true) {
                rightPWM.on((Math.round(rightPower * turnMult)) + (Math.round(rightPowerTurn * (1 - turnMult))), 100);
                leftPWM.on((Math.round(leftPower * turnMult)) + (Math.round(leftPowerTurn * (1 - turnMult))), 100);
                //rightPWM.on(50, 1000);
                shooterPWM.on(shooterPower);

                //System.out.println(rightPower);
                //System.out.println(leftPower);
                //System.out.println(shooterPower);

                System.out.println((Math.round(leftPower * turnMult)) + (Math.round(leftPowerTurn * (1 - turnMult))) + ", " + ((Math.round(rightPower * turnMult)) + (Math.round(rightPowerTurn * (1 - turnMult)))) + ", " + shooterPower);

                device.poll();
                Thread.sleep(5);
            }
        }
    }

    public static void yAxis(Float value) {
        rightPower = 0;
        leftPower = 0;

        if (Math.abs(Math.round(value * 100)) > 15){
            rightPower = Math.round(-value * 100);
            leftPower = Math.round(-value * 100);
        }
    }

    public static void xAxis(Float value) {
        rightPowerTurn = 0;
        leftPowerTurn = 0;

        if (Math.abs(Math.round(value * 100)) > 15) {
            rightPowerTurn = Math.round(-value * 100);
            leftPowerTurn = Math.round(value * 100);
        }
    }

    public static void shooter(float value) {
        if (value > 0.5) {
            shooterPower = 50;
        } else shooterPower = 0;
    }
}package org.example;
import com.pi4j.Pi4J;
import com.pi4j.boardinfo.util.BoardInfoHelper;
import com.pi4j.io.gpio.digital.DigitalInput;
import com.pi4j.io.gpio.digital.DigitalOutput;
import com.pi4j.io.gpio.digital.DigitalState;
import com.pi4j.io.gpio.digital.PullResistance;
import com.pi4j.util.Console;
import de.gurkenlabs.input4j.InputDevices;
import de.gurkenlabs.input4j.InputDevices.*;
import de.gurkenlabs.input4j.components.Axis;
import de.gurkenlabs.input4j.components.Axis.*;
import de.gurkenlabs.input4j.components.Button;
import de.gurkenlabs.input4j.components.XInput;
import com.pi4j.io.pwm.Pwm;
import com.pi4j.io.pwm.PwmType;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static int leftPower = 0;
    public static int rightPower = 0;
    public static int shooterPower = 0;
    public static int rightPowerTurn = 0;
    public static int leftPowerTurn = 0;
    public static float turnMult = .60f;

    public static void main(String[] args) throws Exception{

        final var console = new Console();
        console.title("||----Mini Outreach Robot----||");

        var pi4j = Pi4J.newAutoContext();

        var rightMotorConfig = Pwm.newConfigBuilder(pi4j)
                .id("rightMotor")
                .name("Right Motor")
                .address(0)
                .pwmType(PwmType.HARDWARE)
                .provider("linuxfs-pwm")
                .initial(0)
                .shutdown(0)
                .build();
        var leftMotorConfig = Pwm.newConfigBuilder(pi4j)
                .id("leftMotor")
                .name("Left Motor")
                .address(1)
                .pwmType(PwmType.HARDWARE)
                .provider("linuxfs-pwm")
                .initial(0)
                .shutdown(0)
                .build();
        var shooterConfig = Pwm.newConfigBuilder(pi4j)
                .id("shooterMotor")
                .name("Shooter Motor")
                .address(3)
                .pwmType(PwmType.HARDWARE)
                .provider("linuxfs-pwm")
                .initial(0)
                .shutdown(0)
                .build();

        Pwm rightPWM = pi4j.pwm().create(rightMotorConfig);
        Pwm leftPWM = pi4j.pwm().create(leftMotorConfig);
        Pwm shooterPWM = pi4j.pwm().create(shooterConfig);

        try (var devices = InputDevices.init()) {
            var device = devices.getAll().stream().findFirst().orElse(null);
            if (device == null) {
                System.out.println("No input devices found.");
                return;
            }

            device.onAxisChanged(Axis.AXIS_Y, Main::yAxis);
            device.onAxisChanged(Axis.AXIS_RX, Main::xAxis);
            device.onAxisChanged(XInput.RIGHT_TRIGGER, Main::shooter);

            // simulate external polling loop
            while (true) {
                rightPWM.on((Math.round(rightPower * turnMult)) + (Math.round(rightPowerTurn * (1 - turnMult))), 100);
                leftPWM.on((Math.round(leftPower * turnMult)) + (Math.round(leftPowerTurn * (1 - turnMult))), 100);
                //rightPWM.on(50, 1000);
                shooterPWM.on(shooterPower);

                //System.out.println(rightPower);
                //System.out.println(leftPower);
                //System.out.println(shooterPower);

                System.out.println((Math.round(leftPower * turnMult)) + (Math.round(leftPowerTurn * (1 - turnMult))) + ", " + ((Math.round(rightPower * turnMult)) + (Math.round(rightPowerTurn * (1 - turnMult)))) + ", " + shooterPower);

                device.poll();
                Thread.sleep(5);
            }
        }
    }

    public static void yAxis(Float value) {
        rightPower = 0;
        leftPower = 0;

        if (Math.abs(Math.round(value * 100)) > 15){
            rightPower = Math.round(-value * 100);
            leftPower = Math.round(-value * 100);
        }
    }

    public static void xAxis(Float value) {
        rightPowerTurn = 0;
        leftPowerTurn = 0;

        if (Math.abs(Math.round(value * 100)) > 15) {
            rightPowerTurn = Math.round(-value * 100);
            leftPowerTurn = Math.round(value * 100);
        }
    }

    public static void shooter(float value) {
        if (value > 0.5) {
            shooterPower = 50;
        } else shooterPower = 0;
    }
}