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

Hey:)
The project works great for me but I was wondering if it is possible to add more output fields? I want to display the air pressure and indoor humidity as well. I have a sensor for that but how do I implement that in the data?
Fred

3 Likes

Heyya mate,

The code is completely open-source so you can do with it and edit it as you like. So adding more output fields is definitely possible :slight_smile:

This guide will get you up to speed with pulling air pressure and indoor humidity data from a sensor - https://core-electronics.com.au/tutorials/piicodev-atmospheric-sensor-bme280-raspberry-pi-guide.html

Then all you need to do is alter code in the Pi-Weather-Station so you can include your new information.

Hope this helps and kindest regards,
Tim

4 Likes

Hey Tim:)
Thanks for your responds! The sensor is all set-up thanks for the link it really helped.
But now I have problems with the structure of the files and were I actually would have to input my changes. Do you have any tipps for that? I am kind of new to the topic so if you have any further tipps that would be amazing :blush:

Kind regards
Fred

2 Likes

Sure mate, I am keen to see what you can come up with.

In the code, this folder location is where all the fonts and components of the dashboard are placed/decided so you will need to edit that to fit in the barometric pressure. pi-weather-station/client/src/components at master · elewin/pi-weather-station · GitHub

Once you have created space for it you will need to pull your recorded barometric information into the system and have it update every so often. A lot of different ways you can do that. The two main languages in this project are C++ and Javascript. Give the code folders a run through and learn how it is pulling information and what it is doing with it.

Kindest regards,
Tim

1 Like

I’m considering making one of these and have it mounted in a tractor with the rain radar and windy so i could have it up all the time without the need to get my phone out. I could get power from the tractor so that wouldn’t be an issue. But how would I get internet without having to hotspot from my phone?

1 Like

Hey Jordy,

The easiest solution I can think of would just be picking up a 4G USB dongle/modem like this one and a data only SIM plan. I imagine this wouldn’t be sinking much data making occasional API calls so you wouldn’t need anything above a small data pool.

I can confirm that specific one I linked above works with Raspberry Pi OS from a previous project I’ve done, however, another alternative might be the Waveshare 4G HAT for the Pi. I haven’t had the chance to fiddle around with one of these, but I recall @Oliver33 sharing a bit of knowledge on the SIMCom chips on some other forum posts, he might have some suggestions/insight!

3 Likes

Hello all I have just finished building this project and I need some help. It doesnt display any map data I believe that I have the APIs correct. Any tips ? I believe that I haven’t set my location correctly and I am not sure how to do that.

1 Like

API can sometimes take a little bit of time on their side to kick in and allow you to pull information from them. You can also set you location by dropping a pin anywhere on the map by clicking a location or by typing in the desired Latitude and Longitude. Hope that helps!

2 Likes

Yeah it doesnt display a map unfortunately. I will delete everything and try again. Somethings not quite right

3 Likes

Hello, I just finished installing and setting up this project and neither maps or weather will display. I have double checked my APIs and I still receive the same messages “Cannot retrieve map data” and Could not retrieve weather data". I did notice that during the install of " curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -" 10.x was no longer available and I had to select a newer version, could that be causing the no data issue?

2 Likes

Heyya mate, I reckon installing a newer version of the node source is definitely the issue.

I ran the line just then, it does say that it is no longer supported and it recommends a newer version but if you wait 20 seconds it will download the desired 10.x version just fine.

Hopefully by redoing the terminal commands from a fresh Raspberry Pi OS will solve your problem and you can have your weather dashboard up and running asap :slight_smile:

2 Likes