# How to Make an AI Robot Recognize the Weather
In the age of modern technology, Artificial Intelligence (AI) is becoming more and more prevalent and its applications are becoming more and more widespread. One of the exciting areas is creating your own AI assistant, especially when it comes to weather prediction.
Learning how to program a robot that recognizes the date, weather, temperature, and humidity is a great learning opportunity for both kids and educators. Not only does this spark children's interest in programming, but it also provides teachers with an innovative way to teach.
This #HowTo will teach you how to use your programming skills to make an AI assistant that recognizes the weather around you.
How to get kids to learn science by understanding weather
• Observation and Measurement: With the weather given by the AI assistant, children are led outdoors or indoors to observe weather phenomena and use tools such as thermometers and hygrometers to measure the temperature and humidity around them. Through field observation and measurement, children can experience first-hand the changes in weather and climate and deepen their understanding of weather phenomena.
• Exploring Weather Phenomena: Explore the causes and effects of weather phenomena with children, discussing the effects of temperature and humidity on the weather and the relationship between them. Through observation and discussion, children can learn the basic principles and methods of weather prediction and develop their scientific thinking and observation skills.
• Participation in science projects: Children are encouraged to participate in science projects or activities, such as weather observation and climate change research. By participating in science projects, children can collaborate with other peers or scientists to explore the mysteries of weather and climate and stimulate their interest and passion for science.
Enhancing Learning with AI: mBot2's By Asking Feature for Interactive Education
• In the field of artificial intelligence (AI), the concept of "by asking" typically refers to a way of interacting and controlling through verbal inquiries or questions. It mainly involves using natural language processing and internet connectivity to retrieve information and perform tasks, enhancing the interactive capabilities of robots and automated systems.
• How can we help children understand this concept using mBot2? We have created a related case study."When you ask mBot2 about the weather, it can quickly answer by searching for information online."
• This feature not only demonstrates the application of AI in understanding and executing verbal commands but also helps children see how AI robots retrieve and utilize information from the internet to provide assistance. This showcases the integration of Internet of Things (IoT) technology.
How to write a weather recognition program
Step1:Preparation
• An assembled mBot 2 cart.
• Type C cable*1
• A computer with internet access
After assembling the mBot 2, use the data cable to connect the mBot 2 to your computer, open the Wise Programming Tool (desktop, web, mobile), connect to the mBot 2, and switch to upload mode.
Step2:Programming
Substep 2.1: Connect To The Network
The first step in programming is to get the mBot2 connected to the network. This step is crucial because it allows the device to access Internet resources for real-time data processing and communication.
• First, drag a hat block from "Events" and place it on top of the other blocks to activate them.
• Next, take out the blocks for connecting to Wi-Fi from "IoT" and fill in the Wi-Fi name and password.
• Then we need to check whether the Wi-Fi connection is successful, and drag the wait condition from "Control".
• Drag the "network connected?" block from "Control" and put it into the waiting condition.
• Finally, drag the colored lights from "LED" as the condition for a successful Wi-Fi connection.
With the above steps, mBot2 will be able to connect to a Wi-Fi network. Next, we will program mBot2 to interact with us!
Substep 2.2: Write a speech recognition judgment program
With the above procedure of connecting to the network complete, we have taken the first step in programming. By connecting to the network, we have gained the ability to interact with the online world, which lays the foundation for our subsequent work. Next, we will work on programs for recognizing speech and recognizing weather.
By recognizing voice, our AI robot will be able to understand human commands and needs; and by recognizing weather, we can make the AI robot an intelligent weather expert, providing us with timely and accurate weather information.
• First, drag the "forever" block from "control".
• Then drag out the speech recognition block in "AI", change the language to English, and set the recognition time to 2 seconds.
• Then drag out the judgment condition block from "control".
• Put the speech recognition result block in "AI" into the inclusion condition block in "Operators", and fill in "weather" as the recognition condition.
• Finally, put the speech recognition result into the display label of "Display", and then put the display label block into the else condition.
After completing this step, when the machine fails to recognize "weather," it will display the speech it recognizes on the screen. We will be able to understand the reason why it was not recognized by the display.
Substep 2.3: Write a date recognition program
After completing the else step, we will write the program that will make the AI robot react to the recognition of "weather".
• Find the speak block in "AI" and drag it to the judgment condition block, then change the text to be read out to "Today's date is".
• Then drag the time block from "IoT" into the speak block, then click on "UTC", find the time zone of your city and select it, then select "week" for the time.
• After the robot tells the time, it has to display the obtained time on the screen by selecting the print and line feed block from "Display" and writing "Today's date is" in the text.
• Finally, put the time block into the printed and line feed block and the display will show the time of the day.
By this point, we've been able to get the AI bot to tell us the day's date by voice and display it on the screen. The next step is to write a weather recognition program.
Substep 2.4: Write the weather recognition program
Before writing a weather recognition program, let's get acquainted with the weather block.
• Click on "location" to enter your city and select it.
• The second option allows you to select weather information, including temperature, weather, and humidity.
Next, we will program using this block
• Same procedure as for the date program, replace the text with "weather", "temp", and "humidity".
• Change "location" to the city where you want to know the weather information.
• Then select the option at the back of the weather block that corresponds to the text of the previous block.
• Finally, write the text to the display block as before, and put the weather block into the "Display" block.
Substep 2.5: Supplementary text size and volume
Add the set text size and volume to the top program and the program is complete!
Now we'll be able to control the AI robot with our voice and have him tell us the weather information and display it on the screen.
Full Program & Download
Click to download