Things used in this project

Hardware components:
Arduino Uno
×1
Adafruit DS3231 RTC
×1
Pmod oled  17060.1456867080.1280.1280
Digilent Pmod OLED
×1
Texas Instruments LM35 Temperature Sensor
×1
Jumper wires (generic)
×1
12002 04
Breadboard (generic)
×1

Schematics

arduino-weather-clock_bb_r3RznyasiL.jpg
Arduino weather clock bb (1) r3rznyasil

Code

Code snippet #4Plain text
  display.clearDisplay();
  display.setTextColor(WHITE);
  display.setTextSize(2);
  display.setCursor(0,0);
  display.print("  Weather ");
  display.setCursor(0,17);
  display.print("  Clock ");
  display.display();
  delay(5000);
Code snippet #5Plain text
 output = analogRead(sensor_pin);
  temp =(output*500)/1023;
  display.clearDisplay();
  display.setTextSize(2);
  display.setCursor(20,0);
  display.print(rtc.getTimeStr());
  display.setTextSize(1);
  display.setCursor(0,15);
  display.print(rtc.getDateStr());
  display.setTextSize(1);
  display.setCursor(70,15);
  display.print(rtc.getDOWStr());
Code snippet #6Plain text
#include 
#include 
DS3231 rtc(SDA, SCL);
#define OLED_MOSI 11
#define OLED_CLK 13
#define OLED_DC 9
#define OLED_CS 10
#define OLED_RESET 8
Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
const int sensor_pin = A0;
float temp;  
float output;

void setup() 
{
  pinMode(sensor_pin,INPUT);
  rtc.begin();
  display.begin(SSD1306_SWITCHCAPVCC);
  //rtc.setDOW(WEDNESDAY);     // Set Day-of-Week to SUNDAY
  //rtc.setTime(19, 02, 0);     // Set the time to 12:00:00 (24hr format)
  //rtc.setDate(7, 12, 2017);   // Set the date to June 6th, 2017
  display.clearDisplay();
  display.setTextColor(WHITE);
  display.setTextSize(2);
  display.setCursor(0,0);
  display.print("  Weather ");
  display.setCursor(0,17);
  display.print("  Clock ");
  display.display();
  delay(5000);
}

void loop()
{
  output = analogRead(sensor_pin);
  temp =(output*500)/1023;
  display.clearDisplay();
  display.setTextSize(2);
  display.setCursor(20,0);
  display.print(rtc.getTimeStr());
  display.setTextSize(1);
  display.setCursor(0,15);
  display.print(rtc.getDateStr());
  display.setTextSize(1);
  display.setCursor(70,15);
  display.print(rtc.getDOWStr());
  display.setTextSize(1);
  display.setCursor(20,25);
  display.print("Temp: ");
  display.print(temp);
  display.print("C");
  display.display(); 
  delay(1000);
}

Credits

16996498 1423413207709969 2623568762044732287 n
Keval Doshi

Hardware Hacker. Love going to hackathons. Enough said!

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / Login