The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

Tag: RPi

Raspberry Pi

  • RPi: Logitech Camera Data

    After installing things like imagemagick and mjpg_streamer on the Raspberry Pi, I exhumed a quartet of Logitech cameras from the heap to see how they worked. None bear any identification, apart from a tag on the cable, so here’s what I found out for later reference.

    They’re all reasonably good for still pictures, if you don’t mind terrible initial exposures. The default program works OK:

    fswebcam -d /dev/video0 -r 320x240 image.jpg
    

    On the other hand, getting any streaming video requires searching through the parameter space, which wasn’t helped by the total lack of documentation. The Arch Linux wiki has a useful summary of camera & drivers, with pointers to additional lists-of-lists. The OctoPrint repo documents the mjpg-streamer plugin parameters.

    So, we begin…

    This camera, one of two identical cameras in the heap, has a clip that used to fit on the upper edge of a laptop display:

    Logitech QuickCam for Notebook Plus - front
    Logitech QuickCam for Notebook Plus – front

    One has a tag:

    Logitech QuickCam for Notebook Plus - tag
    Logitech QuickCam for Notebook Plus – tag

    To make the tag data more useful for search engine inquiries:

    • M/N: V-UBG35
    • P/N: 861228-0000
    • PID: CE64105

    From lsusb:

    Bus 001 Device 008: ID 046d:08d8 Logitech, Inc. QuickCam for Notebook Deluxe
    

    With Raspbian on the RPi, 640×480 video tears and stutters, leaving 320×240 as the least-worst alternative:

    mjpg_streamer -i "/usr/local/lib/input_uvc.so -r 320x240" -o "/usr/local/lib/output_http.so -w /usr/local/www"
    

    The cameras don’t support YUYV at all and the video quality is mediocre, at best, but they do have a manual focus ring that lets you snuggle the camera right up against the subject.

    This ball camera:

    Logitech QuickCam Pro 5000 - on tripod
    Logitech QuickCam Pro 5000 – on tripod

    Has a tag:

    Logitech QuickCam Pro 5000 - tag
    Logitech QuickCam Pro 5000 – tag

    Which reads:

    • M/N: V-UAX16
    • P/N: 861306-0000
    • PID: LZ715BQ

    From lsusb:

    Bus 001 Device 009: ID 046d:08ce Logitech, Inc. QuickCam Pro 5000
    

    It requires YUYV at 320×240 (on the Pi) and nothing else works at all:

    mjpg_streamer -i "/usr/local/lib/input_uvc.so -r 320x240 -y" -o "/usr/local/lib/output_http.so -w /usr/local/www"
    

    It produces even worse video than the Notebook camera.

    This HD 720p camera has C130 scrawled on the front in my handwriting:

    Logitech HD Webcam C510 - front
    Logitech HD Webcam C510 – front

    And a tag:

    Logitech HD Webcam C510 - tag
    Logitech HD Webcam C510 – tag

    Bearing this text:

    • M/N: V-U0016
    • P/N: 860-000261
    • PID: LZ114SF

    The scrawled C130 doesn’t match up with what lsusb reports:

    Bus 001 Device 010: ID 046d:081d Logitech, Inc. HD Webcam C510
    

    It produces very nice results in many resolutions, using YUYV mode, although I think its native resolution is 1280×720 and that works perfectly on the Pi:

    mjpg_streamer -i "/usr/local/lib/input_uvc.so -r 1280x720 -y" -o "/usr/local/lib/output_http.so -w /usr/local/www"
    

    Video over USB is mysterious…

  • Raspberry Pi Setup Tweaks

    Things to remember during Raspberry Pi setups…

    You can do some of this through raspi-config.

    The NOOBS setup configures the HDMI video parameters to work with the worst possible display, so edit the /boot/config.txt (per the Official Doc):

    • Comment out all the NOOBS auto-configuration entires at the bottom
    • Set disable_overscan=1

    The highest mutually compatible setting for the U2711 monitor was 1920×1080@60Hz, which turned out to be CEA Mode 16 and was automagically selected as the monitor’s “native” mode. Disabling overscan lets the X session use the entire monitor screen, rather than being confined within the (huge) black overscan borders.

    That requires a power off-on cycle to take effect. Shut down properly with sudo shutdown -H now or just sudo halt.

    To set the default size of the lxterminal window so that it’s big enough to be useful, edit the Exec entry (down near the bottom) in /usr/share/raspi-ui-overrides/applications/lxterminal.desktop to read:

    Exec=lxterminal --geometry=80x60
    

    The Droid font family seems more readable than the default selection.

    Create a user for yourself, just so SSH will eventually work the way it does for all the other boxes. The group list comes from the default pi user:

    sudo adduser ed
    sudo usermod -a -G pi,adm,dialout,cdrom,sudo,audio,video,plugdev,games,users,netdev,input,spi,gpio ed
    

    Regrettably, the default pi user has the same numeric ID as the one I use on all the other boxes, which leads to problems with file sharing permissions. I may need to swap numeric IDs to make this work out correctly.

    To set a static IP, edit /etc/network/interfaces thusly:

    #iface eth0 inet dhcp     <-- comment this out to stop DHCP
    
    auto eth0
    iface eth0 inet static
     address 192.168.1.9      <-- obviously, pick your own
     gateway 192.168.1.1
     netmask 255.255.255.0
     network 192.168.1.0
     broadcast 192.168.1.255
    

    Change the hostname in /etc/hostname and /etc/hosts.

    Set up SSH for public-key access on an unusual port by editing /etc/ssh/sshd_config:

    1. Port 12345 <— choose your own
    2. PermitRootLogin no
    3. PasswordAuthentication no

    Create the ~/.ssh directory and put your own public key in it, which you can do from the remote system:

    scp ~/.ssh/id_rsa.pub octopi-1:.ssh/authorized_keys
    # a dummy line to reveal underscores in the previous line
    

    Twiddle ~/.ssh/config on the remote box to include the Pi and specify the unusual port:

    Host octopi-1 thisone thatone anotherone
    	ForwardX11	yes
    	Port	12345   <--- pick your own
    	User	ed
    

    Using ssh-agent -t 4h helps relieve the tedium of typing your passphrase all the time. Then sudo service ssh restart on the pi will require you to use your key passphrase; it’s a Good Idea to remain signed in through Port 22 with the original authorization while you fiddle with this stuff, then sign out when it all works.

    Update with the usual routine:

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade    <-- for system-level update
    sudo apt-get clean           <-- flushes /var/cache/apt/archives to save space