lollos01
Published © CC BY

Blynk Internet Clock

How to realize an alarm clock controlled by a smartphone, using simple raw materials and an Arduino-based ESP32.

IntermediateFull instructions provided201
Blynk Internet Clock

Things used in this project

Hardware components

FireBeetle ESP32 IOT Microcontroller (Supports Wi-Fi & Bluetooth)
DFRobot FireBeetle ESP32 IOT Microcontroller (Supports Wi-Fi & Bluetooth)
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Speaker: 3W, 4 ohms
Speaker: 3W, 4 ohms
×1
SparkFun display nokia 5510
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×20

Software apps and online services

Blynk
Blynk

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Soldering iron (generic)
Soldering iron (generic)
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Custom parts and enclosures

box

here is the structure of the box

Schematics

nokia 5510

here is the scheme that was used to connect the esp 32 module to the display.

DHT11

is the scheme that was used to connect the esp 32 module to the DHT11

Code

alarmclock.ino

Arduino
the code of the project is here
#include <DHTesp.h>
#include <WiFi.h>
#include <PCD8544.h>
#include "driver/gpio.h"
#include <SPI.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <Blynk.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <BlynkSimpleEsp32.h>
DHTesp dht;
const char* ssid     = "TIM-69381033";
const char* password = "DT6vrJYAt6Z4bJ64";
char auth[] = "2c9cf057d5cd4207962e49220c646e19";
int freq = 2000;
int channel = 0;
int resolution = 8;
int runMinutes = 0;
int runHours = 0;
int secsRemaining = 0;
int runSeconds = 0;
static PCD8544 lcd = PCD8544(14, 13, 27, 26, 15);\\pin of 5510 lcd
#define BLYNK_PRINT Serial
#define NTP_OFFSET  3600 // In seconds 
#define NTP_INTERVAL 60 * 1000    // In miliseconds
#define NTP_ADDRESS  "1.it.pool.ntp.org"
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, NTP_ADDRESS, NTP_OFFSET, NTP_INTERVAL);
BLYNK_WRITE(V1) {
  runHours = param[0].asLong() / 3600;
  secsRemaining = param[0].asLong() % 3600;
  runMinutes = secsRemaining / 60;
  runSeconds = secsRemaining % 60;
}
void setup() {
  gpio_set_direction( GPIO_NUM_23, GPIO_MODE_OUTPUT);
  gpio_set_level( GPIO_NUM_23, 1);
  dht.setup(22);
  Blynk.begin(auth, ssid, password);
  ledcSetup(channel, freq, resolution);
  ledcAttachPin(12, channel);
  lcd.begin(84, 48);
  timeClient.begin();
}
void loop()
{
  Blynk.run();
  timeClient.update();
  float temperature = dht.getTemperature();
   Blynk.virtualWrite(V6, temperature);.
  String formattedTime = timeClient.getFormattedTime();
  lcd.clear();
  // digital clock display of the time
  lcd.setCursor(20, 1);
  lcd.print(formattedTime);
  int ore = timeClient.getHours();
  int minuti = timeClient.getMinutes();
  int secondi = timeClient.getSeconds();
  if (minuti == runMinutes && ore == runHours)
  {
    ledcWriteTone(channel, 500);
    delay(500);
    ledcWriteTone(channel, 0);
  }
  delay(500);
   }

Credits

lollos01

lollos01

1 project • 0 followers

Comments

Add projectSign up / Login