Cities are heating up during the summer, and deaths related to this are on the rise. To mitigate this ever-increasing risk, we have prototyped, built, and user-tested an entirely open-source, personalized city climate warning system called Wera. Wera can access the high-density temperature sensor network in Zurich, along with meteorological data and the user's location, to formulate a weather and risk potential report with Llama3, which is then synthesized into either German or English for the end user. Wera primarily targets seniors, as they are the most affected by the city's hotspots. It features a very intuitive and accessible interface, making it a reliable weather risk informer and a helpful weather assistant. Wera comes in two form factors: the Kub, its strengths being its constant visibility, personal feeling, and accessibility, and the Fong, which is widely deployable and offers the option to ask back questions directly on your phone.
- Raspberry Pi (we used the Pi 4 model b)
- 1x GPS Module
- 2x Status LED's (1x Green 1x Red)
- 1x Rotary encoder
- 1x Speaker, easiest if it has it's own amplifier built in
Be sure to get all API Keys, .env is formatted like this in the /server
directory
METEO_API_KEY=key
TTS_API_KEY=key // -> VoiceRSS API (backup TTS), package can be removed also
GROQ_API_KEY=key
UNREAL_SPEECH_API_KEY=key // -> Unreal TTS (backup TTS), package can be removed also
GOOGLE_APPLICATION_CREDENTIALS=key.json-file
cd server
docker build -t wera-server .
docker run -d -p 8080:8080 wera-server
cd server
go mod tidy
go build cmd/server/main.go
./main
- Navigate to the kub directory:
cd kub
- Initialize the Go module (if not already done):
go mod tidy
- Fetch dependencies:
go get github.com/stianeikeland/go-rpio/v4 go.bug.st/serial.v1
- Build the kub application:
go build kub.go
- Run the built application:
./kub
- Create a Service for the Kub
sudo nano /etc/systemd/system/kub.service
- Add the following content to the service file. Adjust the
ExecStart
path to point to your executable and modify other settings as necessary:
[Unit]
Description=Kub Service
After=network.target
[Service]
ExecStart=/home/user/wera/kub/kub
WorkingDirectory=/home/user/wera/kub
StandardOutput=inherit
StandardError=inherit
Restart=always
User=root
RestartSec=10
StartLimitIntervalSec=500
StartLimitBurst=5
[Install]
WantedBy=multi-user.target
- Reload the systemd manager configuration to read the newly created service file:
sudo systemctl daemon-reload
- Enable the service to start on boot:
sudo systemctl enable goradio.service
- Start the service immediately to test it:
sudo systemctl start goradio.service
- Check the status of the service to ensure it is active and running:
sudo systemctl status goradio.service
Render Hosted Service (2min startup time): https://spatial-interaction.onrender.com
Responds with OK status 200.
Responds with the sensor dataset of the ZHAW Grid, currently only has access to about 50 sensors and the temperature data only.
Responds with the sensor dataset of the ZHAW Grid, sorted by distance (closest to furthest).
Sample Request Body:
{
"device_id": "username",
"Latitude": 47.3653466,
"Longitude": 8.5282651,
"Language": "english"
}
Sample Response Body:
[
{
"id": "03400120",
"name": "Sihlhölzlistrasse",
"timestamp": "1716555600",
"values": 22.8375,
"colors": "#9baf33",
"active": 1,
"Distance": 0.3995830946586305,
"geometry": {
"type": "point",
"coordinates": {
"lon": 8.528826,
"lat": 47.36892
}
}
}
]
Responds with a 3-hour forecast from Meteoblue data, also provides a 24-hour overview. Data contains temperature, wind, rain, and some more. Each request takes 8000 tokens and our free API is limited to 10M, so please make only as many requests as needed.
Fetches and combines data from both the MeteoBlue and CityClimate APIs, processes it to compute different data points, to create a current weather analysis and forecast. It uses the GPS data of the kub to deliver data for the current location of the radio, constructs a nice response, and generates a speech file (.wav) which is returned as an audio stream.
Sample Request Body:
{
"device_id": "Device_1",
"Latitude": 47.3653466,
"Longitude": 8.5282651,
"Language": "english"
}
Sample text it generates and speaks:
"Good morning! It's a lovely day outside! The temperature has been quite pleasant, a gentle breeze is blowing and the temperature is just right - not too hot, not too cold. Just perfect. Make sure to stay hydrated and take a break if you're spending time outdoors. And remember, on especially warm days, please be extra careful to avoid heat exhaustion. Stay cool and comfortable!"
Fetches and combines data from both the MeteoBlue and CityClimate APIs, processes it to compute different data points, to create a current weather analysis and forecast, constructs a descriptive sentence, and generates a speech file (.wav) which is returned as an audio stream. This endpoint is used as a relay in case weathergps fails.
Sample Request Body:
{
"device_id": "username",
"Language": "english"
}
The response contains:
- The current average temperature of the sensor grid.
- The temperature and wind speed according to MeteoBlue.
Sample text it generates and speaks:
The current average temperature of the Sensor Grid is 22.50 degrees Celsius. According to MeteoBlue, the temperature is 20.10 degrees Celsius with a windspeed of 3.5 meters per second.
Resonds with an array of sensors that are over a certain set threshold, on default it is set to 28 degrees celsius.
Sample Response Body:
[
{
"id": "0340011C",
"name": "Zollikerstrasse",
"timestamp": "1716555600",
"values": 28.8025,
"colors": "#743933",
"active": 1,
"geometry": {
"type": "point",
"coordinates": {
"lon": 8.556188,
"lat": 47.3617
}
}
}
]
Resonds with an array of sensors that are over a certain set threshold, on default it is set to 28 degrees celsius, sorted by distance to the post location.
Sample Request Body:
{
"device_id": "Device_1",
"Latitude": 47.3653466,
"Longitude": 8.5282651
}
Sample Response Body:
[
{
"id": "0340011C",
"name": "Zollikerstrasse",
"timestamp": "1716555600",
"values": 28.8025,
"colors": "#743933",
"active": 1,
"geometry": {
"type": "point",
"coordinates": {
"lon": 8.556188,
"lat": 47.3617
}
}
}
]
Text to speech endpoint. (Unreal speech)
Sample Request Body:
{
"text": "Note: As soon as the green light comes on, I can provide more detailed information, this normally takes 15 minutes. The kub can be used nevertheless ",
"language": "english"
}
Sample Response Body:
{
"file": "output.wav",
"message": "Speech generated successfully"
}
github.com/jackc/pgx/v4
for PostgreSQL database interaction.github.com/gorilla/mux
for routing.google.golang.org/genproto/googleapis/cloud/texttospeech/v1
&cloud.google.com/go/texttospeech/apiv1
for Google Text to Speech integration
github.com/stianeikeland/go-rpio/v4
for GPIO pin support.go.bug.st/serial.v1
for Serial Support.
This Project lies under the MIT License.