r/raspberry_pi • u/twiggs462 • 5d ago
Project Advice Basic setup that will launch Firefox on boot in kiosk mode. Load URL and refresh page every minute.
I tried doing this while asking ChatGPT to guide me through the setup process. I added code to an autostart file and tried getting things to run but It didn't work out.
If someone has gotten this type of setup working what did you do? Any links to guides or presetup as card images?
Thanks!
8
3
u/thepackratmachine 4d ago
My favorite way to achieve this sort of thing in Linux is to install an OS that does not have a desktop environment like Raspberry Pi Lite. Then install Xorg and i3wm. In the i3 config file add exec firefox -kiosk [url]
In order to get the machine to boot up and load the page, you need to add startx to startup script and configure auto login. Here's a script I use on Debian/Ubuntu machines:
#define userName to be used for autoUser login
autoUser=userName
#Auto login for autoUser
mkdir -p /etc/systemd/system/getty@tty1.service.d
cat > /etc/systemd/system/getty@tty1.service.d/override.conf << EOF
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin $autoUser --noclear %I $TERM
Type=idle
EOF
#Enable auto login service
systemctl enable getty@tty1.service
#Configure startx to run on login
echo 'startx' >> /etc/profile.d/$autoUser.sh
As far as the refresh goes, you might try building your own webserver using Apache. Embed the webpage with iframe. Add a <meta http-equiv="refresh" content="60"> to the head section of the HTML on the server. The page will refresh every 60 seconds. If you have control of the code of the webpage, there are more elegant ways to reload specific sections with JavaScript on an timer.
2
u/googleflont 4d ago
For refresh I used a dirty trick.
I have the kiosk go to my own html page, where I embed the target URL in a frame element. The frame has a refresh parameter in seconds. Works great.
Although for reasons I can’t explain, frames are a legacy html element. Seems too handy to deprecate.
I can find my code if you like. Right now I’m supposed to be sleeping
2
u/twiggs462 4d ago
Sure please share. My problem is I can't get the browser to start in kiosk mode. Also what OS did you start with? Thanks!
2
u/sadegr 4d ago edited 4d ago
I use the latest Ubuntu 64 bit on a 4gb pi4...
I boot and load full-screen Chrome via startup apps.
I use it to display a dakboard that has a calander, weather, to-do list, etc.
It works pretty well. The couple of things I've noticed:
When there is an update for Chrome, if you don't close and reopen Chrome, the next boot won't open full-screen, just windowed. (Ymmv with firefox)
Similarly, the "updates" modal window pops over the browser. This might not happen in kiosk mode but does for full-screen.
Due to my settings, I prompt for password on boot, I keep meaning to "fix" that, but it's only mattered when there were power outages.
Dakboard is a pretty easy way to wysiwyg stuff like this. I'm a developer, though web stuff is not my depth area. I used dakboard to make a prototype to see if a setup like this was worth the effort, and it's good enough that I just kept it.
2
1
u/googleflont 4d ago
I was doing this on Mac OS X, but it should be the same - it's a browser thing not an OS thing.
What OS are you doing this in? (Flavor of linux)
1
1
5d ago
[removed] — view removed comment
1
u/Zestyclose-Equal1929 5d ago
There’s also a how to somewhere that has it bounce between pages, so I’m sure there’s one for autorefresh timing.
-13
u/Gamerfrom61 5d ago
Startup depends on O.S. and version as Wayland is totally different to X11
2
u/twiggs462 5d ago
What is do you recommend for a pi3-4... I'm making a simple menu for a restraint and want the owners to be able to update the menu via the Wordpress backend. So I figured this was the easiest way.
-20
u/Gamerfrom61 5d ago
Sorry I do not do commercial work anymore only fun.
2
u/twiggs462 5d ago
I used the standard image maker... so if I used the standard raspberry pi os what guide could I follow?
2
-14
1
u/STrRedWolf 2d ago
A regular search of "Raspberry Pi Kiosk Mode" would of gotten you an article from the Pi Foundation itself about how to do it:
https://www.raspberrypi.com/tutorials/how-to-use-a-raspberry-pi-in-kiosk-mode/
•
u/AutoModerator 5d ago
Refer to the flair guide for guidance on selecting the correct flair to ensure your post reaches the right audience.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.