Introduction: DIY Weather Assistant

Last time I used ESP32 to make a weather broadcast station, which can broadcast the current weather. If you are interested, you can check the previous instructable. Now I want to make an upgraded version, that I will designate a city to check the weather in this city. Not only does it play the weather in one city, it also queries and broadcasts the weather in other cities according to my commands.



  1. Raspberry Pi 3B+ (with SD card)
  2. Voice Interaction Hat
  3. PIR Motion Sensor Module
  4. Micro USB cable
  5. Dupont Line

Step 1: How to Do

  • We plan to implement these functions with Raspberry Pi. But the Raspberry Pi does not have a microphone to receive voice, and there is no device to play sound if the speaker is not plugged in. We made an expansion board for the Raspberry Pi with two microphones input and speaker output, so that the Raspberry Pi can realize the function of voice input, and play audio without connecting to the speaker.
  • We need three API, which are speech-to-text, weather, and text-to-speech. Then play the audio.

  • In addition, we are going to connect a sensor to recognize that RasPi starts to work when someone approaches.

Step 2: Connection

Voice Interaction Hat is a Raspberry Pi expansion board. Just insert the Raspberry Pi according to the pins. We also need to solder several DuPont wires to connect the sensors. The pin connections are as follows:

Voice Interaction Hat ------ PIR
5V ------ VCC
GND ------ GND
GPIO27 ------ OUT

Step 3: Install the Driver of the Expansion Board

  • Since the expansion board is designed with reference to the product of seeed, we can use the driver of seeed to drive it to work.
  • Enter the following command in the Raspberry Pi terminal window to install the driver:

git clone  
cd seeed-voicecard  
sudo ./  
sudo reboot 

Step 4: Code

r =
        ''+api_key, data=data, headers=headers)
headers = {
    'x-rapidapi-host': "",
    'x-rapidapi-key': "**************************************"
r =
        ''+api_key, data=data, headers=headers)

  • Fill in the name of the place in the and it will be recognized from this address list. Of course, you can fill in the names of cities across the country and even the world if the weather API can recognize them.

address = ['Beijing','London']

  • If you do not use the speakers of the expansion board, but use your own speakers, you need to replace “hw:0,0” in the following code with “hw:1,0” in the

os.system("aplay -Dhw:1,0 output1.wav")

  • Copy all the files in Raspi-Voice-Interaction-Hat/weather_workSpace/ to a working directory of the Raspberry Pi.

Step 5: Make a Packaging Box

In order to look more beautiful, we packed it in a carton. Cut appropriately to expose the speaker and microphone, and use colored pens to paint on the paper box to decorate it.

Step 6: How to Use

Use the USB cable to power the Raspberry Pi, control Raspberry Pi to run, and trigger the sensor. After it broadcasts a sound, we start to talk about a place and then wait for it to broadcast the weather. A weather Assistant is complete.