Raspberry Pi Camera Module Troubleshooting - raspberry-pi

Typically I use the basic camera module 2 on my boards but I wanted to up the resolution and purchased the HQ camera module. After I installed the component and executed the
raspistill -o .jpgs command I just end up with these blank images. I've tried just about everything but get the same result and I'm hoping this thing isn't just a lost cause.
I set-up the config file for a camera
sudo raspi-config
Then ran the following command
raspistill -o testing.jpg
This will just output the blank image and I also tried to view the camera by executing
raspistill -t 0
Still no view opens from the camera

Related

How to run a MicroPython host script file on the Raspbery Pi PIco from the host command line and receive UART output back on terminal?

I know how to do something similar with Thonny: I could paste my code into the editor, and press the green "Run" button. This would run the program and give me output. But it would require copy pasting my file into Thonny (I want to code in Vim or run pre-existing examples) and pressing GUI buttons which I don't want to do.
Another related approach would be to copy the program as main.py to the pico, e.g. with rshell: How can you make a micropython program on a raspberry pi pico autorun? But this requires plugging and unplugging the USB, and then reconnecting to the UART every time to see the output.
Is it possible to send file contents to a GNU Screen session? would likely also solve or almost solve my problem, but:
I don't want to start a named server and then run another command, it's messy, I just want to run!
I would need to think about how to send Ctrl+D to soft restart. Should not be hard, but lazy to learn
The first way I got it to work was with https://github.com/scientifichackers/ampy That tool is just designed for the job, and does it perfectly with the run command:
python3 -m pip install --user adafruit-ampy
ampy --port /dev/ttyACM0 run blink.py
Outcome:
stops execution of current program
starts execution of blink.py
shows UART output on my shell
I can then quit ampty with Ctrl + C to get back to my shell, and the program continues to run.
Tested on adafruit-ampy==1.1.0, Ubuntu 22.04 host, Raspberry Pi Pico W, MicroPython rp2-pico-w-20221014-unstable-v1.19.1-544-g89b320737.uf2.

Prevent Raspberry from blanking (console)

Is there any way to prevent the rasberry console from getiing black after a while?
I use only the console without any GUI. I already tried the following, but it didnt work at all :(
/etc/kbd/config
BLANK_TIME=0
POWERDOWN_TIME=0
Would be very greatful for any hints
Type this...
sudo sh -c "TERM=linux setterm -blank 0 >/dev/tty0"
Add this line to the bottom of your ~/.bashrc file to have the blank screen disabled on boot.

Resizing Epiphany browser (Webbrowser) in Raspberry pi

I have been searching in google since one day and I have not found any information of how to resize the webbrowser window (for example, half of the screen) just starting the raspberry pi.
At the moment I achieved starting the webbrowser in kiosk with this code:
In /etc/xdg/lxsession/LXDE-pi/autostart
#xset s off
#xset -dpms
#xset s noblank
#epiphany-browser http://www.google.de
Any idea of how can give/configure a given size to the browser?
I solved by my own.
Just creating a script and using wmctrl in the script.
When starting the PC it run automatically this script.
#!/bin/bash
epiphany http://www.google.de &
sleep 15s
epiphany --new-window www.wikipedia.com &
sleep 15s
SOURCE=/usr/bin
echo "$SOURCE"
$SOURCE/wmctrl -r wikipedia -e 0,0,0,800,1080
$SOURCE/wmctrl -r Google -e 0,800,0,1120,1080

Display GUI on Raspberry Pi without startx

I'm currently playing with my brand-new raspberry with adafruit's touch-tft and raspberry Cam.
I noticed, if I run raspivid -p, it displays the preview in a frame on top of the bash.
How can I create an application (java, python, c++(preferred)) to display a GUI without having to startx?
I'd love to use adafruit's touch-tft for a project, but startx needs a lot of resources. Of course it would be cool to have the touch-functionality too.
Edit:
Maybe I expressed myself a little bit confusing: I would like to create an application that doesn't need startx but has some kind of GUI.
The answers below aren't 100% ready to go but they pointed me to the right direction. Since I saw many similar questions I will try to give a step-by-step solution:
Setup your raspberry with adafruit's TFT: https://learn.adafruit.com/adafruit-pitft-28-inch-resistive-touchscreen-display-raspberry-pi/overview
(you don't have to replace the TFT with HDMI as standart display)
be sure FRAMEBUFFER=/dev/fb1 startx is running correctly on the TFT screen, I have my TV plugged in the HDMI port, this way I can use the bash on the TV screen and run x on the TFT
Follow this tutorial to create your first pygame: http://www.pygame-doku.laymaxx.de/tut/intro/intro.html
(you can just copy&paste, wget ball.gif)
Insert this 2 lines at the beggining: (github.com/notro/fbtft/wiki/Pygame)
import os
os.environ["SDL_FBDEV"] = "/dev/fb1"
If you want to test the touch-screen to, you can change Line 15:
From:
if event.type == pygame.QUIT: sys.exit()
To:
if event.type == pygame.MOUSEBUTTONDOWN: sys.exit()
This will exit the application if you touch the screen
Save file e.g. pygame1.py and execute with $python pygame1.py
You should now see a bouncing ball on your TFT while the HDMI output still displays the BASH on your TV (but it isn't active of course) touching the screen will exit the game if you completed step 6
Why I'm doing this? This way you can display a simple GUI with e.g. buttons to do some action, like turn your lights on/off if you use your RPI for home-control.
You can use for example pygame library! check this tutorial http://archive.furtherfield.org/rp-resources/RP-workshop-handout.pdf pg. 17
Below, you will find a detailed description of how to be a minimal window manager to start a graphics program of your choice.
-Install Required Packages:
apt-get update
apt-get install xorg - no-install-recommends gdm3 matchbox-window-manager Iceweasel rsync-y
-The system in question, select Add a new user interface gdm3. The terminal is the default name will be used.
adduser kiosk
-Create-Xsession. This script will be executed when the user logs on.
xset s off
xset -dpms
matchbox-window-manager &
while true; do
rsync -qr --delete --exclude='.Xauthority’ /opt/kiosk/ $HOME/
firefox http://www.google.com (Replace your application!!!)
done
Save Ctrl + O; Exit: Ctrl + X
chmod a + x. xsession
cp / opt / kiosk / .xsession / home / kiosk
Set Auto-Login. Kiosk user will enter automatically after boot.
nano / etc/gdm3/daemon.conf
[Daemon]
AutomaticLoginEnable = true
AutomaticLogin = kiosk
We have chosen to configure, program, if necessary
-Screen calibration when not loaded up the whole screen:
/ Boot / config.txt file, clear the comment:
disable_overscan = 1
I hope I helped
Check out Urwid, a text-based ui that can run in a terminal, or, I assume, on a Raspberry Pi started up without startx.
In short you can't, applications like gedit are built atop of a desktop environment (e.g. Gnome, Kde).

How can I start X11 window with no display associated

I'd like to start Firefox for example with no display associated and eventually take a screenshot with import.
Can I in fact make it periodically with cronjobs?
I'm now making a ssh -X connection, take the xwininfo for the window started in background and everything's OK. But I'd like to automate it.
You could start Firefox inside Xvfb.
If you gave Xvfb its -fbdir option then you would also have the option to take your screenshot from the Xvfb framebuffer file. You would probably want to specify the same geometry for Xvfb and Firefox.
How about starting firefox inside a vncserver?
You can capture the value for $DISPLAY using grep
e.g.
export DISPLAY=`vncserver 2>&1 | egrep --only-matching ":[0-9]+" | head -n1`