Using DS3231 RTC to move Servo Arm at specific time

First time arduino user here. I'm trying to program it to move a servo arm at a specific time of the day. I did some troubleshooting and it doesn't like the line DateTime now = rtc.now() line for some reason.

#include <Wire.h>
#include "RTClib.h"
#include <Servo.h>


RTC_DS3231  rtc;
Servo myServo;


int pos = 0; 
// Set your target execution time here (24-hour format)
const int targetHour = 20;   // 2 PM
const int targetMinute = 55; // 30 minutes
bool adjustedToday = false;


void setup() {


Serial.begin(9600);
  myServo.attach(9);
  myServo.write(0); // Default startup position
}


void loop() {
 DateTime now = rtc.now(); // Get current time data



   //Check if current time matches the target hour and minute
  if (now.hour() == targetHour && now.minute() == targetMinute) {
    if (!adjustedToday) {
      myServo.write(90); // Move servo to 90 degrees
      delay(2000);       // Wait for 2 seconds
      myServo.write(0);  // Return to 0 degrees
      
      adjustedToday = true; // Mark done so it doesn't loop continuously during that minute
   }
 }


 // Reset the trigger flag at midnight so it can run again the next day
  if (now.hour() == 0 && now.minute() == 0) {
   adjustedToday = false;




 delay(1000); // Polling delay to reduce processor load
  }
}

I used this code to set the time on the RTC

#include <Wire.h>
#include "RTClib.h"


RTC_DS3231 rtc;


void setup() {
  // put your setup code here, to run once:


  Serial.begin(9600);
  Wire.begin();
// Set RTC using the compile time
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}


void loop() {}
reddit.com
u/TemporarySyrup3728 — 3 days ago

Using DS3231 RTC to move Servo Arm at specific time

First time arduino user here. I'm trying to program it to move a servo arm at a specific time of the day. I did some troubleshooting and it doesn't like the line DateTime now = rtc.now() line for some reason.

#include <Wire.h>
#include "RTClib.h"
#include <Servo.h>


RTC_DS3231  rtc;
Servo myServo;


int pos = 0; 
// Set your target execution time here (24-hour format)
const int targetHour = 20;   // 2 PM
const int targetMinute = 55; // 30 minutes
bool adjustedToday = false;


void setup() {


Serial.begin(9600);
  myServo.attach(9);
  myServo.write(0); // Default startup position
}


void loop() {
 DateTime now = rtc.now(); // Get current time data



   //Check if current time matches the target hour and minute
  if (now.hour() == targetHour && now.minute() == targetMinute) {
    if (!adjustedToday) {
      myServo.write(90); // Move servo to 90 degrees
      delay(2000);       // Wait for 2 seconds
      myServo.write(0);  // Return to 0 degrees
      
      adjustedToday = true; // Mark done so it doesn't loop continuously during that minute
   }
 }


 // Reset the trigger flag at midnight so it can run again the next day
  if (now.hour() == 0 && now.minute() == 0) {
   adjustedToday = false;




 delay(1000); // Polling delay to reduce processor load
  }
}

I used this code to set the time on the RTC

#include <Wire.h>
#include "RTClib.h"


RTC_DS3231 rtc;


void setup() {
  // put your setup code here, to run once:


  Serial.begin(9600);
  Wire.begin();
// Set RTC using the compile time
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}


void loop() {}
reddit.com
u/TemporarySyrup3728 — 3 days ago

Best Method to Objectively Measure Where Sound is Coming From

Hi All - My apartment is directly above the building’s garage lift and door. I can hear it pretty well in both of my bedrooms which share a wall.

I’m working on some solutions to dampen the noise (underlayment, new quieter lift). One thing I’m struggling with is figuring out how much of the noise is coming through the floor vs wall. I’m hoping there’s a device that can help me with this. Would a simple decibel meter held up to the wall vs floor? It’s really hard to pinpoint the sounds and my approach to fix the issue would be different if it’s the floor vs ceiling.

If it was the wall, would my upstairs neighbors also hear it?

I don’t mind spending like $100-$200 but after that not sure I’m willing to pay. I could hire an acoustical engineer but that will be $$$$$. Any advice is greatly appreciated!

https://preview.redd.it/7ld3lsv9h01h1.jpg?width=5712&format=pjpg&auto=webp&s=db3d0d06c315615fe692f24c11fcfc971feabca3

https://preview.redd.it/dg7eurv9h01h1.jpg?width=5712&format=pjpg&auto=webp&s=d35bdd9bebf3a4158ba85c09e4942c62b461453f

https://preview.redd.it/sklcluv9h01h1.jpg?width=4284&format=pjpg&auto=webp&s=95e3f39dade3ccdb033bf2f87f2b872f93a5489e

https://preview.redd.it/s7asmuv9h01h1.jpg?width=4284&format=pjpg&auto=webp&s=44533a7de5f2b63e8b9a27a6e12df773f5ab76d3

https://preview.redd.it/onsqzlu5h01h1.jpg?width=5712&format=pjpg&auto=webp&s=7d421973ccac7dc3a7c2c4420dae62aa0ece5908

https://preview.redd.it/xvlwjpv2wz0h1.jpg?width=3024&format=pjpg&auto=webp&s=6a684798732ad811ad576df30d1545b5279fe340

https://preview.redd.it/pnyja5t4wz0h1.jpg?width=4284&format=pjpg&auto=webp&s=cdda7b38d3c8c293aba55eb5ba8da3c50bbcf726

https://preview.redd.it/llziiri6wz0h1.jpg?width=3024&format=pjpg&auto=webp&s=7004037a3f4b17bfb88d8ca52fc67ad7b14cf4ce

reddit.com
u/TemporarySyrup3728 — 2 months ago

Hi All - We live in a unit directly above the garage door. We knew about the noise prior, but we sleep with white noise machines so it doesn't bother us. However, I'm looking for solutions to lessen the noise which will make it easier to eventually sell the place.

Providing as many details as I can:
- It's a chain drive opener
- The garage ceiling and walls are concrete
- There's not a lot of clearance above the door so a roll up door might not be possible. The opener itself is essentially right below our bedroom so moving it would move the noise at least away from the bedroom a good bit
- Most of the noise seems to be from the door turning the right angle, not the actual opener itself
- The noise is somewhat inconsistent. Sometimes I can barely hear it. Sometimes it's fairly loud.

Things we've tried:
- Switching to nylon rollers (didn't help)
- Adding rubber washers and isolation pads to every bolt that connects the garage opener and tracks to the walls and ceiling (very small help)
- Replaced the sprocket on the garage opener to slow down the door (helped quite a bit)

Some of my own ideas:
- Adding a rubber subfloor to our unit (expensive)
- Adding vibration damping mounts (also expensive as the garage company said they would need to refit our whole setup)
- Adding vibration dampening tape to the rails (fairly cheap)

Curious if anyone has less expensive options and/or if the ones above would make a big difference. Happy to provide more information or answer questions

https://preview.redd.it/bsmrx8z6stzg1.jpg?width=4284&format=pjpg&auto=webp&s=8845dd1b25d1c458e7e019e685ae819082e9f8ed

https://preview.redd.it/wfkg61jxrtzg1.jpg?width=5712&format=pjpg&auto=webp&s=d6b6947b45424cb5e3e4b9013f83ce0675a15aff

https://preview.redd.it/j3sig8pertzg1.jpg?width=5712&format=pjpg&auto=webp&s=13584c4911d556b7d62d480b0999e406daf07fa8

https://preview.redd.it/2wxgnrycrtzg1.jpg?width=4284&format=pjpg&auto=webp&s=1fd7e87bbc64a52fe323e50191688bebbf1c0279

https://preview.redd.it/nug0crhj2szg1.jpg?width=3961&format=pjpg&auto=webp&s=3e559d7b4d43fc4c090fbbb2f7cb068a4521f007

https://preview.redd.it/q3qtdbdk2szg1.jpg?width=5712&format=pjpg&auto=webp&s=2b27dc9cceaa2d6b2f01c8059d2a82ef7d8c355d

reddit.com
u/TemporarySyrup3728 — 2 months ago