RaspberryPi ASCII Weather Station
The next guide reach that RaspberryPi launch a Go program that show the current weather and 3 days of weather forecast. I’m using a fork that I did from wego developed by Schachmat. The main program is the only program that run in the Pi, for that I forced it to start with xinit on full screen, also I included some improvments for:
- No window manger (only xinit with fullscreen mod)
- disabled extra system services
- improved system logs only in memory
- disabled some devices for improve power consumption
- fast boot improvements
- RaspberryPi (any version should be works)
- Any TFT display compatible (I’m using a 4inch HDMI LCD)
Note: you don’t need keyboard or mouse, this guide is a headless installation, we only need SSH.
Open Weather Map API key
You can create an account and get a free API key by signing up
RaspiOS config on PC
Please first install in your SD RaspiOs lite or any Raspberry OS compatible with it on your RaspberryPi. Before run it, please add the next changes:
In the boot partition or boot folder, modify and add the next configs:
Add a simple empty file for enable SSH access in boot folder:
Add your WiFi secrets on a new file wpa_supplicant.conf in the boot folder, you can generate it like this:
wpa_passphrase yourwifiname yourpassword > wpa_supplicant.conf
edit it and put the next line at the start of file:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1
More info about WiFi headless configure here.
Connect your RaspberryPi
Via SSH, please update and install the next packages for build and run the wego application:
sudo apt-get update && sudo apt-get upgrade sudo apt-get install --no-install-recommends xserver-xorg xserver-xorg-legacy xinit xterm golang build-essential git
Config that Pi user can launch the xserver without root:
sudo dpkg-reconfigure xserver-xorg-legacy
in the console menu please select Anybody
Build and install Wego
go get -u github.com/hpsaturn/wego
Then configure wego like is described here. Remember only fill the settings for openweathermap.
- Unfortunately forecast.io, now Darksky, was acquired by the fuck company Apple, and they closed it, for this reason please only use these API, the steps 2 and following.
- The last version of go and dependencies on some Debian version has some troubles. On Debian Buster it should be works, but if you have issues, I added the complete go directory to the assets here in Hackaday and also a pre-build wego binary
- Sometimes a third party of OpenWeather API that maybe retrieve the city from your coordinates fails, is better use your exact coordinates of your city, the official coordinates (centroid) in the config file.
Please edit /etc/rc.local and put the next line before the last line:
sudo su -l pi -c "xinit -geometry =800x400+0+0 -fn 8x13 -j -fg white -bg black /home/pi/go/bin/wego -- -nocursor" &
reboot the Pi and it is all, the Pi will start the Wego app like unique X application.
Speed: Boot mods
In config.txt add the next lines to end of file:
[all] arm_freq_min=250 core_freq_min=100 sdram_freq_min=150 over_voltage_min=0 disable_splash=1 dtoverlay=pi3-disable-bt dtparam=act_led_trigger=none dtparam=act_led_activelow=on boot_delay=0
With that, we have: reduced CPU usage, no boot splash, disabled bluetooth, disabled LEDs and reduced the boot delay.
Edit and add to the end of the line the next changes, quiet for remove boot verbose, fastboot, noswap and ro, for improve SD life and improve boot speed:
console=serial0,115200 console=tty1 root=PARTUUID=132a822c-02 rootfstype=ext4 elevator=deadline fsck.repair=yes quiet rootwait fastboot noswap ro
Speed: Disable some services
Optional, you could disabled some unused services, for example:
sudo systemctl disable...Read more »