Introduction: How to Make a Mini Weather Status Display
About the project
Microcontroller can be fun and entertaining at the same time, add some internet connectivity for real Internet of things ! Allow me to show you how I did manage to create a mini weather status display using 8x8 matrix display and a cute but power full MKR1000.
I will be using Genuino MKR1000 to fetch temperature, humidity and condition of weather within a selected location.
Show status to display in an slide animation pattern.
Utilize the power of your microcontroller and level up for real Internet of Things!
Since 8x8 Matrix is basically an array of LEDs, I will need to program it to show text and animation effects
On this project you will also learn how to
- consume rest web service api
- how to fully utilize the power of your microcontroller
- utilize internet connection for IOT
- how to parse Json data
- how to use Threads and Wifi libraries in Arduino
Step 1: Assemble MKR1000 and 8x8 Display to Mini Bread Board
The setup is pretty simple, we just need to attach the 8x8 matrix display to our microcontroller.
- 16pcs of Male to Female jumpers
- Mini Bread Board
- 8x8 Matrix Display'
Divide your jumpers to group of 8pcs.
Make sure that the jumper wires are perfectly alligned.
Connect the 8 female jumpers to the first 8 pins of matrix display.
Connect the other 8 female jumpers to the 2nd 8 pins of matrix display.
Attach to microcontroller
Attach the microcontroller to the mini breadboard
Using the end male pins of the jumper wires, insert them on the first 8 holes where the microcontoller pins are attached (5-A5).
Insert the remaining on the other 8 holes where the microcontoller pins are attached (6-13).
Adjust the 8x8 Matrix Display so it is facing the front when you place it on the table.
Step 2: Create Your Weather Api Account
To be fully called Internet of Things, we need to fetch some data from the internet.
I used APIXU API to fetch weather data from my selected location.
Sign Up for the account here https://www.apixu.com/login.aspx and get your account API Key.
Feel free to use my own api key
String apiKey = "8f0ff191defb4a20b5583518171203"; // your apixu api key
Step 3: Flash or Program Your MKR1000
Add the attached HexFont.h to your Arduino libraries.
Use attached simple_weather_display.ino to flash your microcontroller.
On this part of the code:
Replace with your WiFi settings
char ssid = ""; // your network SSID (name)
char pass = ""; // your network password (use for WPA, or use as key for WEP)
Replace with your Apixu Api Key and location coordinates
String apiKey = "8f0ff191defb4a20b5583518171203"; // your apixu api key String coordinates = "14.3335591,120.9758737"; // your location coordinates
You can also changed what data to be displayed on this part of the code
//update display text to new weather condition message = ""; //get the current condition String condition = result["current"]["condition"]["text"]; appendMessage(condition); appendMessage(" "); String temp_c = result["current"]["temp_c"] ; appendMessage(temp_c); appendMessage("C"); appendMessage(" "); String humidity = result["current"]["humidity"]; appendMessage(humidity); appendMessage("H"); appendMessage(" ");
For example if you want to add wind_mph from apixu api result:
String wind_mph = result["current"]["wind_mph"] ; appendMessage(wind_mph); appendMessage("Wind mph"); appendMessage(" ");
Step 4: Finish!
Once flashed it will try to connect to your WiFI and will fetch your weather condition, temperature and humidity!
Make sure you have internet connection.
Feel free to comment here.
Support the project on my Github repo
Also Please please please vote for me in Microcontroller Contest. :)