Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cool Cloud #43

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions designs/weather_stations/cool-cloud/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Here is my submission for the weather station
It uses the display to show current weather and a forecast
Instead of a case, I will put this in an old box that I have and fill it with cotton to make it look like a cloud.

# PCB
![image](https://github.com/user-attachments/assets/b9cdcbb0-c48c-4ea6-b68c-3efaf5abf042)
[] I ran DRC in KiCad and have made sure there are 0 errors!

1 change: 1 addition & 0 deletions designs/weather_stations/cool-cloud/code/first
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

78 changes: 78 additions & 0 deletions designs/weather_stations/cool-cloud/code/sketch_dec14a.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>
#include <WiFi.h>
#include <HTTPClient.h>
#include <Arduino_JSON.h>

#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF

const char* ssid = "SSID";
const char* password = "PASSWORD";

String api = "https://api.open-meteo.com/v1/forecast?latitude=43.8396194&longitude=-72.714202&current=temperature_2m,precipitation&hourly=is_day&daily=weather_code,temperature_2m_max,temperature_2m_min,precipitation_probability_max,wind_speed_10m_max&temperature_unit=fahrenheit&wind_speed_unit=mph&precipitation_unit=inch&timezone=America%2FNew_York&forecast_days=1";

#define TFT_CS 16
#define TFT_RST 15
#define TFT_DC 4

#define TFT_SCLK 13
#define TFT_MOSI 11

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

void setup() {
Serial.begin(115200);
tft.initR(INITR_BLACKTAB);
tft.fillScreen(ST7735_BLACK);
WiFi.begin(ssid, password);
Serial.println("Connecting");
while(WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("Connected");
}

void loop() {
if(WiFi.status()== WL_CONNECTED){
HTTPClient http;
http.begin(api.c_str());
int httpResponseCode = http.GET();
if (httpResponseCode>0) {
Serial.print("HTTP Response code: ");
Serial.println(httpResponseCode);
String payload = http.getString();
JSONVar wetherObj = JSON.parse(payload);
if (JSON.typeof(wetherObj) == "undefined") {
Serial.println("Parsing input failed!");

}else{
tft.fillScreen(ST7735_BLACK);
tft.setCursor(0,0);
tft.setTextColor(ST7735_WHITE);
tft.setTextSize(1);

tft.print("Temp: ");
tft.println(wetherObj["current"]["temperature_2m"]);
tft.print("Rain chance: ");
tft.println(wetherObj["current"]["precipitation"]);
}
}
else {
Serial.print("Error code: ");
Serial.println(httpResponseCode);
}
http.end();
} else {
Serial.println("WiFi Disconnected");
}
delay(5000);
}
1 change: 1 addition & 0 deletions designs/weather_stations/cool-cloud/first
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading