/r/raspberry_pi

3,205,800 Subscribers

0

What is this connector? I thought it was JST but the grooves don't look quite right.

Please disregard if this is not the appropriate forum. Please let me know if you have the correct forum for this post. Any help is greatly appreciated. This is on a Waveshare peripheral connection extension board for a Raspberry Pi 4/5. It is power out at 5v and <5amp output.

https://preview.redd.it/o6bq8cxhma4e1.png?width=248&format=png&auto=webp&s=504974cd96ec7999a067ce559c2348277ad7d286

5 Comments
2024/12/01
20:02 UTC

1

Raspberry Pi Pico W LCD not working (random letters showing)

A few days ago I got my first ever Raspberry Pi Pico W and tried it. Already tried a few things with the built in LED and thought I should move to LCD. Its a 16x2, no i2c but for some reason it doesnt show the things I try.
The LCD itself is working and shows some letters but not the right ones and im not sure why.
lcd.clear() works, but lcd.putstr("hello") shows "dd", sometimes g, basically random letters.
I cant find online what could be the problem, any idea?
Ps.: Sorry for bad english its not my first language

1 Comment
2024/12/01
10:25 UTC

6

SMB Permissions Question

I have successfully mounted a share from a TrueNAS Core server to a Pi5 using the following command.

sudo mount -t cifs //192.168.x.x/DataSet /mnt -o username=byrdd,password=xxx

The mount works and i can view the share on the Pi, however I was unable to copy files from the Pi to the NAS. When I examined the permissions this is what I saw. Left side is the terminal from the Pi. Right side is terminal when SSH into the NAS. The Pi indicates that the user and group is root however the NAS says differently for the same directory. Not sure what is going on here.

https://preview.redd.it/ixqfei0jq54e1.png?width=994&format=png&auto=webp&s=5006a8b2e1b5df3e4570edd92bcef1337c77f80b

3 Comments
2024/12/01
03:46 UTC

1

Guidance on wiring and power - from breadboard to final project

I am working on creating a large-scale Connect 4 game with balls and break beam sensors. Addressable LEDs will light up showing the positions on the board (currently, it just displays on the computer screen). The prototype and code are finished.

The first picture shows my breadboard. The second pictures shows the wiring that I am currently thinking of.

My lights are a strand of 50 addressable LED WS2811 (5V) with 40cm between each node.

There are a few areas I have questions about after my research:

  1. Power supply.
    • I am considering the Mean Well RS-25-5. This has 25W power, which should be enough per my calculations of 60 mA * 50 bullets * 5V = 15W.
    • Should I connect all three items (sensors, LED pigtail, and Raspberry Pi Pico) directly to the power supply via stacked terminal connectors? Or should I make some kind of power distribution area?
    • If I distribute the power, should it be with solder on a board or via a busbar? Is there an advantage/disadvantage?
    • Will I have any voltage issues over this distance (20m on the LED strand, 4-5m on the sensors)?
    • Any concerns with this power supply and direct connection to 5.5V in on Pico?
  2. Wiring the sensors
    • Given that there are 14 sensors that need to be powered (7 transmitters, 7 receivers), I'd like to avoid making a home run for each sensor. What would you consider the best way to do that?
    • The game will be outside, so I need to protect the connections. Is there a way to make the green circle pigtail connections on the diagram waterproof? I saw some folks use heat shrink or butt step-down connectors + liquid electrical tape. Is there a better way?
    • Is it better instead to do a home run of the power wires all the way back to the main box (or to a junction box near the main project box)? If so, best way to make a connection of so many to one? I saw 5 to 1 wago connectors, but I've read that those aren't very stable. I would like the ability to disconnect all the power for easier repair/maintenance/storage/debugging.
  3. Random
    • Would I need a logic converter for the 3V GPIO and the 5V Power supply?
    • Would I need a step-down converter to power the Pico?
    • I was planning on soldering female headers onto some perfboard and plugging my Pico with male headers into it. I would then bridge from the wires to the female header pin on the back for the GPIO and power supply connections. Any concerns or better ideas?
    • I am planning on using a project box with a grid at the back to put mounting. I will use three cable glands for the AC, LED, and wire bundle for sensors.
    • What is the best way to make a detachable connection for service/replacement? I was thinking about those locking tab things you see in tractors. They have a nub on one side and a square hole that goes over it on the other. Would they be appropriate to use? I cannot figure out what they are called despite lots of googling and reverse image searching.

https://preview.redd.it/w4qagyvp344e1.jpg?width=3072&format=pjpg&auto=webp&s=cf03f4ea50b119492d0ca753c5951ac77c32a292

https://preview.redd.it/75khl2ir344e1.png?width=1395&format=png&auto=webp&s=d7ff729daf476be81325682216b377cd4d291cc4

1 Comment
2024/11/30
22:04 UTC

2

Questions about battery system for raspberry pi

Hi! Currently I have been working on a little Raspberry Pi handheld side project, and was intending to use some lipo batteries to power it. Since this is the my first time working with these, I just wanted to check that this setup would work / be safe. I currently have:

Charging Module

Boost Circuit

LiPo Battery (possible x2 depending on space constraints)

This will be powering:

Screen

Speaker

Keyboard (removing stock battery and just running a wire directly)

I have a draft of a case 3d modeled, along with some small heat sinks for the pi (a zero 2w) and boost circuit. Is there anything I should know before building this? Is there any other parts / replacements that you would suggest? Did I do something stupid when planning this? Thank you so much for your help!

2 Comments
2024/11/30
18:06 UTC

2

Pi5. Setup to boot from nvme. Was working fine, now getting stuck.

Hiya, I was setting it up as a home server, installed apache, unbound and pi hole. Did a restart at one point and it is just getting stuck...

It's a pi nvme, I do not have an sd card as that failed (couldn't even format it) so that's on its way back, I do have an external ssd which is how I originally got it up and running, but decided to set up boot from nvme.

I would just start a fresh install and start again but... I can't access the nvme, not in any way I can think of 😂

Any help would be greatly appreciated. Mainly in a reinstall of everything

8 Comments
2024/11/30
20:42 UTC

616

DIY minimal E-paper clock with a Raspberry Pi Zero W

27 Comments
2024/11/30
17:03 UTC

5

Errors connecting to RPI via finder on Mac - ssh works fine

Hi yall - I can ssh into my rpi just fine. when I go to Finder, click connect to server and try smb://raspberrypi.local , it gives me a connection error. I have also tried just the IP address. Thoughts?

5 Comments
2024/11/30
14:41 UTC

0

Pi-FAN with 4 cables for RPi4?

I've bought a Unity V2 case with Pi-FAN (ODS232-3007). The instructions only mention red, black and blue, but the fan also has a green cable.

https://i.postimg.cc/3xxGTN4C/hc-m-W8ndrq2-X1-Bq-Wddxs-YFFP9h-Mj-Dn-L4cj.png

I did some searching, I am correct in thinking this cable is meant for a RPi5, so I can just snip it, because it's of no use in my RPi4?

5 Comments
2024/11/30
09:10 UTC

18

Be very careful when screwing or plugging a fan into a Raspberry Pi 5

Recently, I was building a robot when I knocked the fan port accidentally with a nut driver, it was really thick, and I was mounting it unconventionally.

https://preview.redd.it/p8fks2k0ry3e1.jpg?width=1920&format=pjpg&auto=webp&s=69586c51883c90c9ff3a50951af64cee738defa9

3 Comments
2024/11/30
04:07 UTC

1

Help with UVC Gadget for Webcam Simulator on Pi Zero 2 W

Hi,

I am a newbie to Raspberry Pi and hardware devices, so I apologize in advance if this is a dumb question/post. I also probably overshared a lot of detail here, but I wanted to make sure there was enough info to be useful.

I am trying to create a "webcam simulator" that will show up on my mac as a webcam, but instead of streaming from a camera, it will stream from an MP4 file on the device using ffmpeg.

I have a Zero 2 W device running Raspberry Pi OS Lite (64-bit). I am using a v4l2loopback to create a device on /dev/video0 which seems to be working.

I have configured the device with the latest updates and configured it to be in peripheral mode. From my /boot/firmware/config.txt:

[all]

dtoverlay=dwc2,dr_mode=peripheral

My setup code, which I cobbled together from various posts is:

#!/bin/bash

# Variables we need to make things easier later on.

CONFIGFS="/sys/kernel/config"

GADGET="$CONFIGFS/usb_gadget"

VID="0x0525"

PID="0xa4a2"

SERIAL="0123456789"

MANUF=$(hostname)

PRODUCT="UVC Gadget"

BOARD=$(strings /proc/device-tree/model)

UDC=\ls /sys/class/udc` # will identify the 'first' UDC`

# Later on, this function is used to tell the usb subsystem that we want

# to support a particular format, framesize and frameintervals

create_frame() {

# Example usage:

# create_frame <function name> <width> <height> <format> <name> <intervals>

FUNCTION=$1

WIDTH=$2

HEIGHT=$3

FORMAT=$4

NAME=$5

wdir=functions/$FUNCTION/streaming/$FORMAT/$NAME/${HEIGHT}p

mkdir -p $wdir

echo $WIDTH > $wdir/wWidth

echo $HEIGHT > $wdir/wHeight

echo $(( $WIDTH * $HEIGHT * 2 )) > $wdir/dwMaxVideoFrameBufferSize

cat <<EOF > $wdir/dwFrameInterval

$6

EOF

}

# This function sets up the UVC gadget function in configfs and binds us

# to the UVC gadget driver.

create_uvc() {

CONFIG=$1

FUNCTION=$2

echo " Creating UVC gadget functionality : $FUNCTION"

mkdir functions/$FUNCTION

create_frame $FUNCTION 640 480 uncompressed u "333333

416667

500000

666666

1000000

1333333

2000000

"

create_frame $FUNCTION 1280 720 uncompressed u "1000000

1333333

2000000

"

create_frame $FUNCTION 1920 1080 uncompressed u "2000000"

create_frame $FUNCTION 640 480 mjpeg m "333333

416667

500000

666666

1000000

1333333

2000000

"

create_frame $FUNCTION 1280 720 mjpeg m "333333

416667

500000

666666

1000000

1333333

2000000

"

create_frame $FUNCTION 1920 1080 mjpeg m "333333

416667

500000

666666

1000000

1333333

2000000

"

mkdir functions/$FUNCTION/streaming/header/h

cd functions/$FUNCTION/streaming/header/h

ln -s ../../uncompressed/u

ln -s ../../mjpeg/m

cd ../../class/fs

ln -s ../../header/h

cd ../../class/hs

ln -s ../../header/h

cd ../../class/ss

ln -s ../../header/h

cd ../../../control

mkdir header/h

ln -s header/h class/fs

ln -s header/h class/ss

cd ../../../

# This configures the USB endpoint to allow 3x 1024 byte packets per

# microframe, which gives us the maximum speed for USB 2.0. Other

# valid values are 1024 and 2048, but these will result in a lower

# supportable framerate.

echo 2048 > functions/$FUNCTION/streaming_maxpacket

ln -s functions/$FUNCTION configs/c.1

}

# This loads the module responsible for allowing USB Gadgets to be

# configured through configfs, without which we can't connect to the

# UVC gadget kernel driver

##########################

# RDS

# First, Unload existing video hardware

modprobe -r bcm2835_v4l2

modprobe -r bcm2835_codec

modprobe -r bcm2835_isp

# Then load the loopback as video0

modprobe v4l2loopback devices=1 video_nr=0 card_label="VirtualCam" exclusive_caps=1

# Ensure that video0 is there

ls /dev/video*

##########################

echo "Loading composite module"

modprobe libcomposite

# This section configures the gadget through configfs. We need to

# create a bunch of files and directories that describe the USB

# device we want to pretend to be.

if

[ ! -d $GADGET/g1 ]; then

echo "Detecting platform:"

echo " board : $BOARD"

echo " udc : $UDC"

echo "Creating the USB gadget"

echo "Creating gadget directory g1"

mkdir -p $GADGET/g1

cd $GADGET/g1

if

[ $? -ne 0 ]; then

echo "Error creating usb gadget in configfs"

exit 1;

else

echo "OK"

fi

echo "Setting Vendor and Product ID's"

echo $VID > idVendor

echo $PID > idProduct

echo "OK"

echo "Setting English strings"

mkdir -p strings/0x409

echo $SERIAL > strings/0x409/serialnumber

echo $MANUF > strings/0x409/manufacturer

echo $PRODUCT > strings/0x409/product

echo "OK"

echo "Creating Config"

mkdir configs/c.1

mkdir configs/c.1/strings/0x409

echo "Creating functions..."

create_uvc configs/c.1 uvc.0

echo "OK"

echo "Binding USB Device Controller"

echo $UDC > UDC

echo "OK"

fi

Running that script produces:

root@raspberrypi:~ # ./setup.sh

/dev/video0

Loading composite module

Detecting platform:

board : Raspberry Pi Zero 2 W Rev 1.0

udc : 3f980000.usb

Creating the USB gadget

Creating gadget directory g1

OK

Setting Vendor and Product ID's

OK

Setting English strings

OK

Creating Config

Creating functions...

Creating UVC gadget functionality : uvc.0

OK

Binding USB Device Controller

OK

After running the script, I can see two v4l2 devices:

root@raspberrypi:~ # v4l2-ctl --list-devices

3f980000.usb (gadget.0):

`/dev/video1`

VirtualCam (platform:v4l2loopback-000):

`/dev/video0`

However, no USB device is showing up on my Mac at that point, which is what I was expecting when it bound to the UDC.

On my mac:

%system_profiler SPUSBDataType

USB:

USB 3.1 Bus:

Host Controller Driver: AppleT6000USBXHCI

USB 3.1 Bus:

Host Controller Driver: AppleT6000USBXHCI

USB 3.1 Bus:

Host Controller Driver: AppleT6000USBXHCI

More investigation led me to believe that I need uvc-gadget to make this work.

I have downloaded and built two different uvc-gadget devices, each of which has different switches:

- https://gitlab.freedesktop.org/camera/uvc-gadget (which seems relatively new) which I built and installed as "uvc-gadget"

- https://github.com/wlhe/uvc-gadget (which appears to be older) and which I built and installed as "uvc-gadget2"

Trying to use uvc-gadget, I am getting:

root@raspberrypi:~ # uvc-gadget -d /dev/video1 uvc.0

Device /dev/video1 opened: 3f980000.usb (gadget.0).

v4l2 device does not support video capture

root@raspberrypi:~ # uvc-gadget -d /dev/video0 uvc.0

Error: driver returned invalid frame ival type 2

Error opening device /dev/video0: unable to enumerate formats.

Trying to use uvc-gadget2:

root@raspberrypi:~ # uvc-gadget2 -d /dev/video1 -u /dev/video0 -r 1 -f 1 &

[1] 637

root@raspberrypi:~ # uvc device is VirtualCam on bus platform:v4l2loopback-000

uvc open succeeded, file descriptor = 3

It appears to work! But sadly no, still no USB device is showing up on my mac.

So... what am I doing wrong?

Any help appreciated, thanks in advance!

1 Comment
2024/11/29
21:05 UTC

0

How can I use 2 USB joysticks at once?

I'm trying to use 2 USB joysticks on a pi. I'm able to see one using jstest /dev/input/js0 but not sure how to see the second one. I tried jstest/dev/input/js1 figuring it would identify them as 0 & 1, but it didn't work.

For anyone looking for specifics, I'm using the pi to convert joystick inputs to a PPM signal for radio control models. I'm using it for construction equipment which often uses 2 joysticks.

5 Comments
2024/11/30
00:44 UTC

0

Passive buzzer buzzes on boot

I am following this tutorial, I have a RP5 and a passive buzzer, I connected the buzzer to the pi like the tutorial schematic shows, and when I turn my pi up, the buzzer starts buzzing immediately.

Chat gpt suggested to set the GPIO pins to "pull down" like so:
sudo nano /boot/firmware/config.txt
gpio=2-27=pd

but it didn't work.

How can I make sure the buzzer stays off until I call it in my python script?

2 Comments
2024/11/29
19:47 UTC

77

Well... At least it works

Didnt go as planned. The Board slipped hanging on hdmi cable and hit the ground with the card slot The slot was gone. Now I have a integrated memory 🤣 surprisingly it works...

14 Comments
2024/11/29
14:56 UTC

1

Problems connecting to main router with WPA2 (Pi zero 2)

I have 2 networks, main one and secondary hotspot which I use to even have access to it.

wpa_supplicant.conf

when I have the hotspot it works fine. Yet when I want to look for the router it just say wpa_status=SCANNING. I think I am going crazy and there is a simple way but I have been unable to fix this for the past 4 hours.
Thank you for any help!!

5 Comments
2024/11/29
11:20 UTC

1

[Pi4B4gb] Packet loss with Raspberry Pi OS 2024-11-19

Hey everyone,

I don't know what is going on but I am experiencing significant packet loss with both eth0 and wifi on my Pi 4B 4gb device running the latest Raspberry Pi OS (and lite). I haven't had this issue running any other OS on the device.

Searches I've found so far only suggest a faulty device, but it can't be that due to multiple OSes not having this issue.

Eth0 occurs constantly and persistently, connected through PoE and a switch, again, this did not affect it with any other OS installed.

Wifi is intermittent but no other device connected to wifi is experiencing this issue at the same time, so I believe I can rule out my router.

Any suggestions?

3 Comments
2024/11/29
12:43 UTC

0

Serial communication over bluetooth connection on Rpi 4B

Hello, I have used linux for some time now, but I am new to Raspberrypi.
I have a project in which I need to connect my raspberrypi 4B to another device using bluetooth and perform serial com.
I did it already once using this old guide: https://www.reddit.com/r/raspberry_pi/comments/6nchaj/guide_how_to_establish_bluetooth_serial/

After it was working, I cloned the SD card, moved the clone to another Rpi4B with the objective of running the same project, but as the bluetooth address on the new device was different, it didn't work. I paired this new Rpi4B with the device again, but it wouldn't work.

I guess I will have to try it again from a clean OS installation, but then my question is: Is there a new, easier method to setup serial communication over bluetooth on raspbian? My system is the lastest version (bookworm). Maybe another method not using the system setup, but python?

I am kind of concerned now because the project was ready, now it doesn't work anymore and the professor wants to check it on monday =(

2 Comments
2024/11/29
07:50 UTC

5

PI4: Unable to boot from USB SSD

Hello there!

I'm stuck on the error below, while trying to migrate from the micro SD to an USB SSD (home assistant os). I tried everything I could think of, everything I found online, without luck. it's stuck in a loop trying to boot on different support.

The hardware: Pi4 model B 2GB, X862 V2.0 SSD shield, SSD 128 Go, 27W official raspberry power supply.

The error (always the same, no matter what I've tried):

Boot mode: USB-MSD (04) order f1
USB3[3] 00281203 connected enabled
USB3 root HUB port 3 init
MSD [02:00] 3.00 000000:03 register MDD
MSD [02:00] 3.00 000000:03 LUN 0
MSD READ_CAPACITY [02:00] 3.00 000000:03 lun 0 block-count 250069680 block size 512
trying partition 0
type: 16 lba: 2048 'mkfs.fat' '  V     ^ ' clusters 16343 (4)
trying partition 0
type: 16 lba: 2048 'mkfs.fat' '  V     ^ ' clusters 16343 (4)
Read config.txt bytes    2160 hnd 0x59
xHC-CMD err: 13 type: 1 [02:00] 3.00 000000:03
FAT read failed @ 4772
Block device timeout 

I tried (after enabling usb boot, changing boot order, use latest firmware, update eeprom):

  • Flashing the Home assistant on the SSD (using rpi-imager, then tried with balenaEtcher)
  • Flashing the pi os lite on SSD.
  • creating an image of my home assistant micro SD and then flashing it on the SSD (using W32 disk imager)
  • Tried flashing from Linux and Windows 🤷
  • Toggle boot flag on /dev/sda1 (not by default)
  • Unplug anything else on USB
  • Cleaning all partitions before flashing
  • Playing with USB_MSD_PWR_OFF_TIME and USB_MSD_STARTUP_DELAY values

Booting on pi os lite from the micro SD, with the SSD plugged in, I'm able to access and mount the SSD partitions, so the SSD shield adapter seems to work without any issue.

I ran out of ideas, advises would be greatly appreciated! 🙏

13 Comments
2024/11/29
06:44 UTC

3

Pi 5 I/O Control in C++

I can manipulate I/O just fine in Python but all attempts to do this in C++ have been unsuccessful. Pigpio doesn't work on the Pi5 and Wiringpi has been deprecated. How do I do this? I'm losing my mind.

8 Comments
2024/11/28
23:47 UTC

4

Help! Can't connect to pi from computer frequently but I can from phone

What I've tried from some googling -- is pi and computer on the same subnet? It seems pi is on a .68.* while y computer is on a .1.*, and my phone is also on .68.* -- however, when I tried to manually set IP on my computer to .68.*, it still couldn't connect and threw error "raspberry pi.local DNS address could not be found."

If I revert to automatic DHCP IP on my computer the error is simply "This site can’t be reached Check if there is a typo in raspberrypi.local."

EDIT I mean they are all 196.168.1.X OR 192.168.68.X IP

How do I figure this out and make it so my computer can always connect to pi? Sometimes it'll just randomly be able to connect and sometimes not...

12 Comments
2024/11/28
23:00 UTC

34

Raspberry Pi 5 Powered Tracked Rover

I recently started working on a rover project, based on a Lynxmotion Tri-Track Chassis platform. The servos are off of a Lynxmotion arm kit.

https://preview.redd.it/p1fwfue5kp3e1.jpg?width=1920&format=pjpg&auto=webp&s=7338614c7b349da87bb81af0a1abe05bc675bbf0

I started by building this

https://preview.redd.it/mrty5ei8kp3e1.jpg?width=1920&format=pjpg&auto=webp&s=0b49210e01c0df33f270e9ad5ebc377840a801f8

https://preview.redd.it/16kcyzz8kp3e1.jpg?width=1920&format=pjpg&auto=webp&s=0851b9bc61d4d64bcf53d4e224905863725e4452

Then I needed a camera, so I tried to use a GoPro (which didn't work)

https://preview.redd.it/kuitqkickp3e1.jpg?width=1920&format=pjpg&auto=webp&s=c20e7ac9d913aaf9c64896205722567da47cb4a6

I decided to add a 500 GB NVME drive as the boot drive, I think I need to add two smaller batteries to fit in between the plates, wire them in parallel, add a depth camera, and see what happens.

Another thing I have in mind is installing a radio system to transmit video, and to add a LiDAR later down the line.

15 Comments
2024/11/28
21:15 UTC

3

MediaMTX and RPI Camera

I am trying to use my RPi 4 and Arducam 5MP OV5647 camera to get a better view in my P1S

I was able to get it all set up and running MediaMTX to stream video, but how I think MediaMTX has settings messing w the video.

The video doesn't look like it's 1080p like the camera suggests and I need to rotate the video 90° if possible (can do after the fact I guess).

How would I make changes to the aspect ratio and such to get these changes?

5 Comments
2024/11/28
19:36 UTC

0

CAN BUS Motors not initializing (Device not found)

Hello, we are using 2 CAN Bus Motors (link below) to a Raspberry Pi 4 Model B. Then, when trying to initialize the motors, only one of them initializes while the other always says: Device can1 cannot be found.

When doing the command:

dmesg | grep -i can

We get:

[    9.741468] mcp251x spi0.0 can0: MCP2515 successfully initialized.
[    8.499928] mcp251x spi0.1: Cannot initialize MCP2515. Wrong wiring?
[    8.503873] mcp251x spi0.1: Probe failed, err=19

We checked the wiring multiple times and also tested the wires continuity and it all seems okay.

Here is our config.txt settings:

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=8000000,interrupt=25,spimaxfrequency=500000
dtoverlay=mcp2515-can1,oscillator=8000000,interrupt=24,spimaxfrequency=500000
dtoverlay=spi-bcm2835

We double checked the crystal oscillator on both mcp2515 and it is 8MHz. We also tested the spi communication using spidev and it has the correct output. And also tested one individual mcp2515 to see if each works and it does. So we're really confused on the problem. I'd appreciate any tips because we are lost so far. Usually, it's the spi0.0 that cannot initialize.

1 Comment
2024/11/28
08:39 UTC

2

Argon Case V3 NVME Not Powering Raspberry Pi 5

My argon case isnt powering my pi, i checked and the pi works when plugged in directly, but when plugged in through the HDMI power board of the argon case, it doesnt light up or show any other signs. I've tried switching the jumper pin modes from "ON when BUTTON pressed" to "ON when RECEIVES POWER". Any ideas?

5 Comments
2024/11/28
11:07 UTC

1

Improving experience with a Pi Zero print server?

I decided to save an old Samsung CLX-3185 from e-waste by using a spare Pi Zero W to make a print server. It’s a combination of CUPS, printer-driver-foo2zjs (for the drivers), and Samba.

I have it all working but performance is bad with print jobs often taking over a minute before the printer starts responding when it is much faster over a direct USB connection.

I don’t know if this is down to using Samba as an intermediate layer, if there is something I can optimize with CUPS (so much of the documentation I found is woefully out of date), if it’s that the PI Zero is underpowered for this task, or something else.

I’ve been trying to take Samba out of the equation and get IPP printing working (and hopefully my mobile devices will then be able to use the printer). But the aforementioned out of date documentation has been an issue (much referring cupsd.conf parameters that are no longer supported).

But if anyone else has been through this and knows of ways to improve the experience, I’d like to learn from your experience.

1 Comment
2024/11/27
18:08 UTC

1

Home Assistant on Eero on Pi3 not working

Hi guys,

I am using the Eero mesh network for my home. I’m trying to use home assistant but i can’t connect to the http://homeassistant:8123

I went through the troubleshooting steps and the only one I see that I couldn’t confirm is the NTP. The Eero app does not have a settings option for NTP.

Am I unable to home home assistant while with this WiFi or has anyone discovered a workaround?

Thanks for your help!

Note: I am using a Raspberry Pi 3. I tried following these instructions but it did not work: https://community.home-assistant.io/t/ha-green-error-installing-home-assistant-on-eero-network/738521

4 Comments
2024/11/27
18:59 UTC

15

I found my Raspberry pi 4/5 Bookworm lockup problem

I'd appreciate it if the mods didn't reflexively take this down with the claim that the problem is voltage or a bad SD card. It's neither. I spent over a week tracking this down and I think it's important that people know there's an actual issue.

tl;dr: I can cause a hard freeze on my Raspberry pi 4 (and it happened on both my Raspberrypi 5's as well) by hooking a cheap USB camera into a powered USB hub, and writing a few lines of code to periodically open the device, and do a quick series of reads on it to collect the raw image data. It doesn't lock up the device on the first try, but if I do that every couple of minutes, the board will freeze hard, not respond to any inputs, and need to be power cycled, within 24 hours - sometimes within seconds. Unplug the camera or disable the code and it does not freeze.

It's an up to date copy of Bookworm. It doesn't come close to using all available memory, it's fan cooled down to 40C typical, it's a 5A power supply with battery backup for a PI 4 with no voltage sags or low voltage warnings, and the only USB port in use it for the powered hub that has only a mouse, keyboard, TrueRND3 and the video camera plugged in. The other used ports are a short run of ethernet; the crash happens regardless of whether I use the HDMI ports for video or not. Wifi is used.

I have used this same cheap USB cam on a Raspberry pi 2 with an older OS for years, without issue. I've also used it on other linux based systems, no issue.

This is how the cam reports in dmesg when it's plugged in:

    usb 1-1.2.2: new full-speed USB device number 8 using xhci_hcd
    usb 1-1.2.2: New USB device found, idVendor=045e, idProduct=00f5, bcdDevice= 1.01
    usb 1-1.2.2: New USB device strings: Mfr=0, Product=1, SerialNumber=0
    usb 1-1.2.2: Product: USB camera
    gspca_main: v2.14.0 registered
    gspca_main: sonixj-2.14.0 probing 045e:00f5
    input: sonixj as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2.2/input/input8
    usbcore: registered new interface driver sonixj
    usbcore: registered new interface driver snd-usb-audio

The code to cause the lockup is this, called occasionally:

   const int vh = ::open("/dev/video0", O_RDONLY);
   if (vh == -1)
      return false; //not plugged in

   //read what we expect is a raw video stream
   for (unsigned int i = 0; i < 33; ++i)
   {
      unsigned char buf[2048 - 7];
      ssize_t count = ::read(vh, buf, sizeof buf);
      if (count <= 0)
         break;
      //do quick hashing on buf...
      sched_yield();   //removing this doesn't help
   }
   ::close(vh);
   return true;

(The point of the code is to collect raw video pixels, hash them, and ultimately feed them to /dev/random.)

If you want to reproduce this, the thread that reads the camera is set for FIFO scheduling at a lowish priority (pretty much every thread in the app uses FIFO scheduling, with priorities up to 50.) I don't know if the scheduling matters, but see below.

It took a long time to pin this down, because the application collects input from other sources and devices - it hashes up web pages, reads from a TrueRND3, collects inputs over sockets. etc.. so I was disabling different pieces of code, running it for a day, disabling other pieces of code...

There's nothing in the dmesg log that signals the crash (or it happens too fast for dmesg to report on it.)

The symptom is that the mouse freezes, the keyboard is ignored, and anything happening on the displays (not much) freezes. Things being written over socket stop, apparently immediately.

My only wild theory is that there's some sort of bug in the driver handling of the video stream buffers. My suspicion is based on the fact that I read from the cam at a lowish thread priority and there are other threads in the app that run periodically at higher priorities. In a multi-core system you wouldn't think I'd often have all the cores in use at once, and the load averages and very low, so priorities should scarcely matter. But maybe sometimes several things happen at once, and the low priority video read thread doesn't keep up with the flow of data. All it would take is a buffer overrun in the kernel/driver to screw things up. It would explain why the freeze is so intermittent. I'm not going to try to play with thread priorities to test this out because I can live without this video camera so it's easiest just to not use it.

I'm hoping there is enough material here for a defect report.

7 Comments
2024/11/27
09:36 UTC

Back To Top