About the project
I'll show you how to create a mini weather status display from a 8x8 matrix display.
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.
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 parse Json data
- how to use Threads and Wifi libraries in Arduino
Add a Teacher Note to share how you incorporated it into your lesson.
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 Your MKR1000
Get full code here View on GitHub
Feel free to submit issues or revisions :)
Add HexFont.h to your Arduino libraries.
Use 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 = "28.4810971,-81.5088347"; // 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(" ");
Get the full code here View on GitHub
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 from this Github repo
Also Please vote for me on Internet of Things Contest. :)