Core Electronics Forum

Raspberry Pi Rain Radar & Weather Dashboard

Hey all just finished my newest tutorial a Raspberry Pi Rain Radar & Weather Dashboard,

Today, if you follow along with this build, we are going to create the perfect device to keep track of the rain so you can always stay dry. This project will inform you at a glance of the current and future weather and let you know if there is or was rain in your local area. This build uses are Raspberry Pi 4 Model B but this is a great project for an older Pi. This build also uses an Official 7 inch Raspberry Pi Touch screen. Sam did a great tutorial on how to construct these two components together in a Display Case. Just a few lines into the Raspberry Pi Terminal and a couple of free API keys later you will have created a locally hosted webpage and constructed the coolest weather radar on your block.

Read More

2 Likes

Nice tutorial - the flight radar is a pretty schmick idea for budding pilots and travel afficianados!

Had an idea regrading restarting, just to make it fully automated - set-up a little bash script to run on startup. For those who aren’t linux gurus: What is a Bash Script? - Bash Scripting Tutorial

So you should be able to write a little script like:

#!/bin/bash

cd Downloads/pi-weather-station
npm start

And then:

Put a script containing the command in your /etc directory. Create a script such as “startup.sh” using your favorite text editor. Save the file in your /etc/init.d/ directory. Change the permissions of the script (to make it executable) by typing “chmod +x /etc/init.d/mystartup.sh”.
(From: How to Run a Command on Startup in Linux | Small Business - Chron.com)

2 Likes

You hero Ollie! To further your script I was looking at using xdotools to automate making the browser full screen (keyboard stroke of pressing F11). Once that full sizing step is done the setup complelely a go. This is my idea so far,

#!/bin/bash

cd Downloads/pi-weather-station
npm start

xdotool key F11

I have a feeling I will need to create a pause between the terminal commands and the keystroke to give the Raspberry Pi enough time to automatically open up the browser. As soon as I have a second I’ll be testing this out and * fingers crossed * have a good solution. It would really complete this project.

2 Likes

Ah awesome! Yeah that’d make it perfect :slight_smile:

Though I’m not sure if it’ll work as the browser might not be the active window so the wrong program would get the command - try it and see! If not, adding this line to the script will work I think:

chromium-browser --start-fullscreen https://localhost:8080/

(From: How to open Chromium in full screen at startup on the Raspberry Pi · GitHub )

You might also need to fiddle around with waiting for npm to start? If so, looks like there might be answers here:

2 Likes

I have come to an acceptable solution!

It involves PM2 to run the | npm start | whenever the Raspberry Pi turns on (and it has connected to the internet) in combination with using Firefox as the default browser. On Firefox I installed an Extension called Auto Fullscreen so when the browser opens with the Weather Station it will take up all the screen as it should.

Very happy with the solution. I’ll write up a line-by-line on the project page and will do a full tutorial on PM2 soon.

3 Likes

Will write the process here. Start by downloading Firefox on your Raspberry Pi and making it the default browser. Go to the Firefox extensions and install Auto Fullscreen. Make that plugin active so it will automatically full-size all windows.

Now open the terminal. Type to following lines and press enter after each.

npm install pm2@latest -g
pm2 startup

Then copy and paste the command into the terminal that it supplies for you (it will start with sudo) and enter that (you will need to right-click to copy and paste with your mouse). This will make the PM2 start as soon as the Raspberry Pi Boots. Once that is done type and enter the following into terminal.

cd Downloads/pi-weather-app
pm2 start npm --start
pm2 save

With that whenever you turn on your Raspberry Pi it will automatically open up the Raspberry Pi Weather app.

3 Likes

Tim, really cool project. One issue I’m having is that the map does not show any names or boundaries. Everything else is working fine. Do you know how to get it to show names, boundaries, etc.?

3 Likes

Heyya mate :slight_smile: can you send through a photo of the problem. From what your saying I reckon it is an issue with the MapBox API Key.

3 Likes

Tim,

Hello. Thank you for the response. I figured it out. It was the API in the wrong field. It’s working now.

Thanks,

Darcy

4 Likes