• DIY iPhone Stand with Sleep Reminder Using Arduino UNO R4 Wi-Fi

QC

DIY iPhone Stand with Sleep Reminder Using Arduino UNO R4 Wi-Fi

An IMac-style iPhone charging stand powered by Arduino Uno R4 Wi-Fi

Devices and components

Arduino® UNO R4 Wi-Fi

Piezoelectric buzzer

IR sensors

Jumper wires (generic)

Software and tools

Arduino IDE

Project description

How the project works

Arduino Uno R4 Wi-Fi: Controls the system.

At bedtime, a buzzer (pin D11) starts to sound.

An IR sensor (D7 pin) checks if the phone is placed on the holder.

When the phone is detected:

Required Components

Arduino UNO R4 Wi-Fi

Buzzer

Infrared sensor module

Connecting wires

Circuit connections

Buzzer at D11

IR sensor output to pin D7

IR sensor VCC to 5V

IR sensor GND to GND

Arduino code

#include "RTC.h" // Arduino UNO R4 RTC library

const int buzzerPin = 11;

const int sensorPin = 7; // Change to your actual sensor pin

void setup() {

Serial.begin(115200);

while (!Serial); // Wait for serial

pinMode(buzzerPin, OUTPUT);

pinMode(sensorPin, INPUT);

if (!RTC.begin()) {

Serial.println("Couldn't find RTC");

while (1);

}

// Set initial RTC time: 16 August 2025, 09:26:00 Friday

RTCTime myTime(

16, Month::AUGUST, 2025, // Day, Month, Year

9, 26, 0, // Hour, Minute, Second

DayOfWeek::FRIDAY, // Day of the week

SaveLight::SAVING_TIME_INACTIVE // No daylight saving

);

RTC.setTime(myTime);

Serial.println("RTC time set to 16 Aug 2025, 09:26:00");

}

void loop() {

RTCTime currentTime;

RTC.getTime(currentTime);

int hour = currentTime.getHour();

int minute = currentTime.getMinutes();

int second = currentTime.getSeconds();

// Print current time

Serial.print(currentTime.getYear());

Serial.print("-");

Serial.print((int)currentTime.getMonth());

Serial.print("-");

Serial.print(currentTime.getDayOfMonth());

Serial.print(" ");

Serial.print(hour);

Serial.print(":");

Serial.print(minute);

Serial.print(":");

Serial.println(second);

// Check if it's 9:30

if (hour == 9 && minute == 30) {

int sensorState = digitalRead(sensorPin);

if (sensorState == LOW) {

// Stop buzzer if sensor is LOW

digitalWrite(buzzerPin, LOW);

} else {

// Beep continuously if sensor is HIGH

digitalWrite(buzzerPin, HIGH);

delay(200); // ON for 200ms

digitalWrite(buzzerPin, LOW);

delay(200); // OFF for 200ms

return; // Exit loop early to keep beeping

}

} else {

// Make sure buzzer is off at other times

digitalWrite(buzzerPin, LOW);

}

delay(1000);

}

The IMac-style charging stand

Final project in action

https://youtube.com/shorts/juen5rXewZQ?si=O18Ubt_5zFog-Lh0

When it's time to go to bed, the bell starts to ring.

I place my iPhone on the support.

IR sensor detects phone

The buzzer stops

The phone starts charging.

Make it look professional – JUSTWAY to the rescue

Why JUSTWAY?

Instant Quotes - Upload CAD Files and Get Prices Instantly

Live 3D Model Preview – Inspect Every Detail Before Production

Variety of materials: SLA resin, PA-12 nylon, CNC aluminum, etc.

Industrial Finish – Smooth, precise and professional.

Expert support: Engineers help you refine your design.

NEW for 2025

Transparent 3D printing: show the infrared sensor and wiring inside.

Multicolor 3D Printing: Add logo labels or branding directly to the case.

JUSTWAY 15% Cash Back for Summer

Get 15% cash back on all eligible orders.

Once completed, send an email to marketing03@justway.com with your order number.

The cashback is credited to your JUSTWAY account for future projects.

How I ordered my personalized stand from JUSTWAY

Step 1: Upload design

Step 2: Select Material and Finish

Step 3: Model Preview

Step 4: Place the order

Conclusion

1#include "RTC.h" // Arduino UNO R4 RTC library
2const int buzzerPin = 11;
3const int sensorPin = 7; // Change to your actual sensor pin
4void setup() {
5 Serial.begin(115200);
6 while (!Serial); // Wait for serial
7 pinMode(buzzerPin, OUTPUT);
8 pinMode(sensorPin, INPUT);
9 if (!RTC.begin()) {
10 Serial.println("Couldn't find RTC");
11 while (1);
12 }
13 // Set initial RTC time: 16 August 2025, 09:26:00 Friday
14 RTCTime myTime(
15 16, Month::AUGUST, 2025, // Day, Month, Year
16 9, 26, 0, // Hour, Minute, Second
17 DayOfWeek::FRIDAY, // Day of the week
18 SaveLight::SAVING_TIME_INACTIVE // No daylight saving
19 );
20 RTC.setTime(myTime);
21 Serial.println("RTC time set to 16 Aug 2025, 09:26:00");
22}
23void loop() {
24 RTCTime currentTime;
25 RTC.getTime(currentTime);
26 int hour = currentTime.getHour();
27 int minute = currentTime.getMinutes();
28 int second = currentTime.getSeconds();
29 // Print current time
30 Serial.print(currentTime.getYear());
31 Serial.print("-");
32 Serial.print((int)currentTime.getMonth());
33 Serial.print("-");
34 Serial.print(currentTime.getDayOfMonth());
35 Serial.print(" ");
36 Serial.print(hour);
37 Serial.print(":");
38 Serial.print(minute);
39 Serial.print(":");
40 Serial.println(second);
41 // Check if it's 9:30
42 if (hour == 9 && minute == 30) {
43 int sensorState = digitalRead(sensorPin);
44 if (sensorState == LOW) {
45 // Stop buzzer if sensor is LOW
46 digitalWrite(buzzerPin, LOW);
47 } else {
48 // Beep continuously if sensor is HIGH
49 digitalWrite(buzzerPin, HIGH);
50 delay(200); // ON for 200ms
51 digitalWrite(buzzerPin, LOW);
52 delay(200); // OFF for 200ms
53 return; // Exit loop early to keep beeping
54 }
55 } else {
56 // Make sure buzzer is off at other times
57 digitalWrite(buzzerPin, LOW);
58 }
59 delay(1000);
60}




Note: Content and images are from: https://projecthub.arduino.cc/, with some modifications.
If you want it removed due to copyright reasons, please leave a comment. Thank you.
I want to share this article more widely so that everyone knows about Arduino and your project.

Easy remote control

Remotely control an LED with ease. Devices and components Arduino Nano 33 BLE with headers Box 525 Resistors precision 1% - 17 values Breadb...