Weather Portal

by Chuggy1501 in Living > Education

24 Views, 1 Favorites, 0 Comments

Weather Portal

db8faa8f-4935-422a-aed5-b0a570067b4f.JPG

We designed a Weather portal wall display that is able to read and detect the level of the air humidity, temperature and condition of the weather outside, this also helps with the users mental health.

One module pulls real life data through the MQTT on the current weather outside.

Our other module uses a LCD screen pulls the air humidity and temperature using a DHT11 sensor.

Supplies

  1. A computer with Arduino IDE, MQTT Explorer and Creality Slicer installed
  2. Adobe Illustrator or similar software
  3. 3D CAD software such as fusion
  4. A soldering Kit
  5. MDF board
  6. PLA filament
  7. A 3D printer
  8. A laser cutter
  9. 2x Arduino uno r3 board
  10. 2x bread board
  11. 24 wires
  12. DHT11 LCD screen PC1
  13. DHT11 temperature and humidity sensor
  14. 3 10K restrictors
  15. 2x Blue LED
  16. 2x Yellow LED
  17. 2x Red LED
  18. Potentiometer
  19. USB Cable
  20. Sand paper
  21. Arduino uno
  22. 9x wires
  23. 6 LED'S
  24. infrared receiver
  25. battery with clip-on adapter
  26. Breadboard

Weather Portal Lights.

ab093ca7-2d3f-4f29-ad24-ed39bfde193a.JPG
c16582ef-4d5b-4485-bbe2-c778588bde84 1.JPG
IMG_0068 1.JPG
IMG_0069.JPG

First off, copy and paste the code below into Arduino IDE, and double check you have the required libraries. Then upload the code to the D1 Mini.


#include <Arduino.h>


// This section supplies the arguments we need to connect to WiFi and MQTT.

#include <ESP8266WiFi.h> // WiFi

#include <MQTT.h> // MQTT

#include "conns.h"

const char ssid[] = "StudentResidences"; // Student Residences wifi

const char pass[] = ""; //No password needed

WiFiClient net;

MQTTClient client;

unsigned long lastMillis = 0;

int myVal;




// ---------------------------------------------


void setup() {

//WIFI SETUP

Serial.begin(115200); //Sets up for the serial monitor

WiFi.begin(ssid, pass); //WiFi setup

client.begin("test.mosquitto.org", net); // Connection for the test publisher

client.onMessage(messageReceived);

connect();


// --------------------------------------

//LED SETUP


//Green LEDs. | Green = Clear weather

pinMode(1, OUTPUT);

pinMode(D2, OUTPUT);


// White LEDs. | White = Snow

pinMode(D3, OUTPUT);

pinMode(D4, OUTPUT);


// Blue LEDs. | Blue = Rain

pinMode(D5, OUTPUT);

pinMode(D6, OUTPUT);


// Yellow LEDs. | Yellow = Storm, thunder

pinMode(D7, OUTPUT);

pinMode(D8, OUTPUT);

}


//------- CONNECTION CODE -------

void connect() {

Serial.print("checking wifi..."); //Default code that makes things more readable and shows the progress/status of the connection.

while (WiFi.status() != WL_CONNECTED) {

Serial.print(".");

delay(1000);

}

Serial.print("\nconnecting..."); //Default code that makes things more readable and shows the progress/status of the connection.

while (!client.connect("weatherportal", "", "")) { //Project name is Weatherportal :)

Serial.print(".");

delay(1000);

}

Serial.println("\nconnected!");

client.subscribe("/WeatherReadings"); //Subscribing to MQTT topic showing weather and temp readings

}

// ---------------------------------------


void messageReceived(String &topic, String &payload) { // Returns data from the broker

Serial.println("incoming: " + topic + " - " + payload);

myVal = payload.toInt(); //Change data to integer form for further code

Serial.println(myVal);


//LED receiving integer value

digitalWrite(D1, myVal);

digitalWrite(D2, myVal);

digitalWrite(D3, myVal);

digitalWrite(D4, myVal);

digitalWrite(D5, myVal);

digitalWrite(D6, myVal);

digitalWrite(D7, myVal);

digitalWrite(D8, myVal);

}


//-----------------------------------------

void loop() {

client.loop();

delay(10); // Wifi stability adjustment


if (!client.connected()) {

connect();


//LED functions. | NOTE: VALUES ARE PLACEHOLDER ONLY

if (myVal = 1) { //1 = Green

digitalWrite(D1, HIGH);

digitalWrite(D2, HIGH);

}


if (myVal = 2) { // 2 = White

digitalWrite(D3, HIGH);

digitalWrite(D4, HIGH);

}


if (myVal = 3) { // 3 = Blue

digitalWrite(D5, HIGH);

digitalWrite(D6, HIGH);

}


if (myVal = 4) { // 4 = Yellow

digitalWrite(D7, HIGH);

digitalWrite(D8, HIGH);

}

}

}


Setting Up the LED'S

IMG_0104.JPG
IMG_0105.JPG

Wire the LED'S as shown above.

Setting Up the LCD Screen

2e4cd120-1483-48fc-9cea-aa9bf16511fc.JPG

Now, lets set up our LCD screen to detect the air humidity and temperature. To start of setting up the wiring

For the coding again Just copy and paste this into Arduino IDE.


#include <LiquidCrystal.h> // Include the LiquidCrystal library to control the LCD screen

#include "DHT.h" // Include the DHT sensor library for temperature and humidity readings


#define DHTPIN A2 // Define the DHT sensor which is connected to pin 8

#define DHTTYPE DHT11 // Define the type of DHT sensor



const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7); // Initialize the LCD object The numbers correspond to the pins connected to the LCD

DHT dht(DHTPIN, DHTTYPE); // Initialize the DHT sensor object with the defined pin and sensor type#



void setup() {

lcd.begin(16, 2); // Initialize the LCD with 16 columns and 2 rows

lcd.setCursor(0, 0); //set the Cursor to then start of the row


Serial.begin(9600);

dht.begin(); //start DHT sensor



lcd.print("Temp:"); // Tempreture word displayed on LCD screen

lcd.setCursor(0, 1); //Move cursor to next line

lcd.print("Humid:"); //Humidity word displayed on LCD screen

}


void loop() {


// delay(500); //wait 500 milliseconds

float T = dht.readTemperature(); //read the Temprature from the DHT sensor

float H = dht.readHumidity(); //^^the same but with Humidity

Serial.println(T);


/*

if (isnan(H) && isnan(T)) { // check is readings are NOT A NUMBER

lcd.print("ERROR"); //print ERRORR on the LCD screen if there was a error

return; //if there is ever an error then break the loop and exit

}


lcd.setCursor(12, 0); // Update the LCD screen with the Tempreture Value.

lcd.print(T); //Print Temprature on LCD screen on colum 12 row 0



lcd.setCursor(12, 1); // Update the LCD screen with the Humidity Value.

*/

lcd.setCursor(0, 0);

lcd.print("Temp:"); // Tempreture word displayed on LCD screen

lcd.print(T);

lcd.setCursor(0, 1); //Move cursor to next line

lcd.print("Humid:"); //Humidity word displayed on LCD screen

lcd.print(H); //print Humitity on LCD screen on colum 12 row 1



delay(2000);

lcd.clear();

}

After uploading this to the LCD screen it should display the readings of air temperature and humidity.

3D Printing and Laser Cutting & Engraving

weather portal2.png
weather portal frame.png

If you open each of these files below one at a time one in photoshop (the .ai) for the laser cutting, and the other (.stl) in any 3D CAD software that can be sent to a 3D printer.


For the Graphic you need to engrave the .ai file first onto the bamboo at a 23cm radius. i have attached the settings i edited.

Threshold - 128

Paths - 50%

Corners - 75%

Assembly

IMG_0076.JPG
IMG_0078.PNG
IMG_0110.JPG

To remove the support PLA from the 3D printer place the base in hot water to loosen the PLA then pick away at it, it may need sanded down after.


Then proceed to insert all the wiring into the frame carefully not causing any damage to the wiring. once you are happy we used tracing paper as a layer in between the PLA and the bamboo graphic. we roughed the tracing paper up with some sand paper to give it more of a blurry affect but this is optional as it still looked good without doing this.

Enjoy :)

IMG_0106.JPG
IMG_0107.JPG
IMG_0108.JPG

You should now have a fully functional weather portal that is able to read and detect air humidity and temperate and lights corelating to the weather outside. Now this can be hung up or put on display. enjoy !!!

Downloads