Alarm Clock

Alarm Clock with Arduino.

Feb 6, 2017

243994 views

113 respects

Components and supplies

4

Pushbutton switch 12mm

1

Resistor 221 ohm

1

Arduino UNO

1

Real Time Clock (RTC)

1

Jumper wires (generic)

1

LED (generic)

1

Standard LCD - 16x2 White on Blue

1

Buzzer

Project description

Code

Downloadable files

Fritzing scheme

Fritzing scheme

Fritzing Scheme link

http://fritzing.org/projects/alarm-clock

electric schematic

electric schematic

Fritzing Scheme link

http://fritzing.org/projects/alarm-clock

electric schematic

electric schematic

Fritzing Scheme Jpg

Fritzing Scheme Jpg

Fritzing scheme

Fritzing scheme

Comments

Only logged in users can leave comments

ulysbek

2 years ago

is lcm1602 iic is important in this project?

Anonymous user

2 years ago

Hi! I'm working on a school project and I'm new to arduino.. Could you help with on using this code with 16x2 lcd display and a ds3231 rtc? Thanks

tittiamo68

2 years ago

This code was written for a 20 x 4 display. To use a smaller display you need to put less information. I made another watch project with a 16 x 2 display (https://www.hackster.io/Tittiamo/clock-set-date-time-0d46a4) and I always used the I2c module, if you do not have one available, there are several tutorials that can explain the link. the RTC DS3231 and DS1307 are equivalent and both work with the same library, the DS3231 is better

Anonymous user

2 years ago

Can you please help me modify the code so I can use this alarm for my school project? I need it to work with LCD 16x2 I2C and a ds3231 rtc. I have no clue what I'm doing and I really need help.. I don't know what I should change to have my 16x2 display work, or the RTC work with the code, because when i try to change "RTC_DS1307 RTC;" into "RTC_DS3231 RTC;" I get errors, such as: "Alarm_Clock:134: error: 'RTC' was not declared in this scope" and way more, and the RTC's even use the same libary, so it shouldnt be a problem? Please help me modify the whole code to make it work. Thanks

tittiamo68

2 years ago

You do not need to change the wording from "RTC_DS1307 RTC;" to "RTC_DS3231 RTC;" it works very well the same. I can not change the code as you want, you have to work alone. I can give you some suggestions: LiquidCrystal_I2C lcd (0x27,20,4); 0x27 is the I2c address of my display, to find yours, I suggest you read "http://playground.arduino.cc/Main/I2cScanner". 20,4 says it is a display of 20 columns and 4 rows yours is 16,2 To use a smaller display, you must enter less information (delete the day of the week, remove the wording "Date", "Time" and delete the seconds), doing so, put the date and time in the first line <dd/mm/yyyy hh:mm> (16 characters) and in the second the alarm.

Anonymous user

2 years ago

How can I configure the clock to activate a servo so that it moves 90 degrees and then to zero as the alarm comes on? I need this to happen every 12 hours to help someone with their medications. Thank you.

tittiamo68

2 years ago

you have to study "https://www.arduino.cc/en/Reference/Servo"

Anonymous user

2 years ago

I did some more tweaking and was able to get it working! Just don't ask me how... Here is the working code for 128x64 OLED display: https://pastebin.com/Kw8zBZce Here is the wiring diagram: https://gyazo.com/f68f1c60d904db62ebd654a8195602d4 I'm trying to add one more button to display DHT22 temp/hum readings but I keep running in to a dead-end...

Anonymous user

2 years ago

(I was a bit too tired last night and posted this to the other clock project but I feel like this comment should be here so I'll post it again.) Thank you for this project. It has helped me alot with my OLED + RTC clock. I changed the code to accept SD 1306 (128x64) OLED screen instead of the LCD. Everything is working but the screen keeps flickering. I'm not experienced enough to find out why it's flickering. I think working OLED version of this code would be useful to many people today. Here is the sketch if someone wants to take a look at it and try to find out if it can be fixed. https://pastebin.com/afRJb1NN

Anonymous user

2 years ago

I need this alarm to continue for more than a minute, can you help me?

Anonymous user

2 years ago

Hi Greetings!! I am 72 years old retired Telecom Engineer. I am fascinated by your clock projects and tried your clock and Clock with alarm and both are working fine. Thank you.

Anonymous user

2 years ago

What should I do in the code if i'll only use 3 push buttons??

tittiamo68

2 years ago

You have to change the logic of the code. My logic uses 4 buttons: set, plus and minus to adjust the time and Alarm switch to activate or deactivate the alarm

Anonymous user

2 years ago

We tried everything but the LCD doesn't display the output or the hours, can you help us about this?

tittiamo68

2 years ago

There can be various problems: Check the I2C address of the display, mine is 0x27, replace this value with yours, to find your I suggest you read "http://playground.arduino.cc/Main/I2cScanner". Check the potentiometer that adjusts the contrast (it is in the I2C module). Check that the display is correctly connected (SCL - A5, SDA - A4). Verify that the display is working.

Anonymous user

2 years ago

Can i use an OLED display for this project? I tried to modify the code and it gave me this error: C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino\\Print.h: In function 'write.constprop': C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino\\Print.h:55:5: internal compiler error: Segmentation fault } ^ Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper.exe: fatal error: C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\\hardware\ ools\\avr/bin/avr-gcc returned 1 exit status compilation terminated. c:/program files/windowsapps/arduinollc.arduinoide_1.8.15.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board Arduino/Genuino Mega or Mega 2560.

tittiamo68

2 years ago

If I do not see all the code, I do not know where the error is. I did not use OLED displays, but I think it can be done.

Anonymous user

2 years ago

The code is working, but the display is not showing on the LCD. We have 16x2 LCD display while you are using 16x4 display. What could be the changes made according 16x2 display? Please help. Also where can we find the libraries?

Anonymous user

2 years ago

Thanks. Have done that. But the display is only showing odd characters and symbols. And I don't have any idea what to do with the "void DisplayDateTime()" code for 16x2 LCD. Also, I have a green colored LCD display. Does that make any difference? Please help! Thanks & Regards

Anonymous user

2 years ago

Sure

Anonymous user

2 years ago

I sent you an email.

Anonymous user

2 years ago

Thanks again for the help. I tried the code, but it gives me error on "lcd.begin()" function in the "void setup()" code. I then tried "lcd.begin(16,2)", it worked, but the display is still not what it should be. In the serial monitor window, it is displaying the message "RTC is NOT running!"

tittiamo68

2 years ago

i answered your email

tittiamo68

2 years ago

Try this code that I have modified for you. I deleted the date display. I did not try the code, let me know if it's okay. https://github.com/tittiamo68/AlarmCloc-16x2

tittiamo68

2 years ago

photos tittiduino@gmail.com

tittiamo68

2 years ago

There can be various problems: Check the I2C address of the display, mine is 0x27, replace this value with yours, to find your I suggest you read "http://playground.arduino.cc/Main/I2cScanner". Check the potentiometer that adjusts the contrast (it is in the I2C module). Check that the display is correctly connected (SCL - A5, SDA - A4). Verify that the display is working. The alarm clock has been created with a 16x4 display, if you want to use a smaller display, you have to change the "void DisplayDateTime ()" code

Anonymous user

2 years ago

How would I add a servo motor to swing a toy hammer

Anonymous user

2 years ago

pls help me, why is the push button that the alarm setting does not work and does not want to function the alarm (pinD9)

Anonymous user

2 years ago

pls fast respon

tittiamo68

2 years ago

Have you checked the electrical connections?

Anonymous user

2 years ago

Hi i was just wondering would it be possible to programme the arduino for the alarm clock to not go off until it is plugged into something, has made contact with a docking station etc. Alternatively would it be possible to make it so that the alarm would not go off until a certain distance was traveled using a pedometer meter like in smartphones?

Anonymous user

2 years ago

im getting an error saying a function definition is not allowed before a '{' token. what does this mean and how should i fix it?

Anonymous user

2 years ago

Hi sorry to ask if I'm going to do a seven segment digital clock with leds and buzzer for alarm, how can I create the alarm code for it? Because I found many examples of 7 segment digital clock without alarm so I'm struggling to get the code. Advanced thank you if you're willing to help.

Anonymous user

2 years ago

Can i use this code to set reminders? And can i replace lcd with oled?

Anonymous user

2 years ago

Hi Tittiamo, your project is very nice. One suggestion is to replace the 4 buttons with a Rotary Encoder; What do you think? Daniel

Anonymous user

2 years ago

Hey I did everything to set up the clock but it doesn't seem to turn on when I upload the code only the LED flashes. I'm I missing a step or could my wiring be wrong.

tittiamo68

2 years ago

Check the I2C address of the display, mine is 0x27, replace this value with yours. To find your 'I suggest you read "http://playground.arduino.cc/Main/I2cScanner".

Anonymous user

2 years ago

Thanks so much for the awesome alarm clock sketch! I've been trying to build one from scratch, then I found yours, and it is perfect!

Anonymous user

2 years ago

can you please send me code for several alarms tahakh585@gmail.com

Anonymous user

2 years ago

Hi, I am doing this for a school project bur the code doesn´t seem to work. It tells me this: /usr/local/bin/arduino-cli compile --fqbn arduino:avr:uno --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/741032413/build --build-path /tmp/arduino-build-429654218982FC022C4610A747C77A80 /tmp/741032413/Alarm_Clock Using library liquidcrystal_i2c_1_1_2 at version 1.1.2 in folder: /home/builder/opt/libraries/liquidcrystal_i2c_1_1_2 Using library SPI at version 1.0 in folder: /home/builder/.arduino15/packages/arduino/hardware/avr/1.8.4/libraries/SPI /tmp/741032413/Alarm_Clock/Alarm_Clock.ino: In function 'void setup()': /tmp/741032413/Alarm_Clock/Alarm_Clock.ino:48:13: error: no matching function for call to 'LiquidCrystal_I2C::begin()' lcd.begin(); ^ In file included from /tmp/741032413/Alarm_Clock/Alarm_Clock.ino:17:0: /home/builder/opt/libraries/latest/liquidcrystal_i2c_1_1_2/LiquidCrystal_I2C.h:58:8: note: candidate: void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t) void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS ); ^~~~~ /home/builder/opt/libraries/latest/liquidcrystal_i2c_1_1_2/LiquidCrystal_I2C.h:58:8: note: candidate expects 3 arguments, 0 provided Error during build: exit status 1 I would appreciate your help on this. Thank you in advance, Helen :)

Anonymous user

2 years ago

Why didn't you debounce the push-buttons?

Anonymous user

2 years ago

I can't do it... to many errors :( Some HELP? C:\\Users\\user\\Desktop\\Orologi\\Alarm_Clock\\Alarm_Clock.ino: In function 'void setup()': Alarm_Clock:49: error: no matching function for call to 'LiquidCrystal_I2C::begin()' lcd.begin(); ^ C:\\Users\\user\\Desktop\\Orologi\\Alarm_Clock\\Alarm_Clock.ino:49:13: note: candidate is: In file included from C:\\Users\\user\\Desktop\\Orologi\\Alarm_Clock\\Alarm_Clock.ino:18:0: C:\\Users\\user\\Documents\\Arduino\\libraries\\LiquidCrystal_I2C1602V1/LiquidCrystal_I2C.h:58:8: note: void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t) void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS ); ^ C:\\Users\\user\\Documents\\Arduino\\libraries\\LiquidCrystal_I2C1602V1/LiquidCrystal_I2C.h:58:8: note: candidate expects 3 arguments, 0 provided exit status 1 no matching function for call to 'LiquidCrystal_I2C::begin()'

tittiamo68

2 years ago

Hi Dimitri Your problem is the "LiquidCrystal_I2C.h" library. What you have is different from what I use. Download and install this: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library Let me know. Always at your disposal. Tiziano

Anonymous user

2 years ago

Can we set multiple alarm for a single day which will remain activate through all the days of the week?

Anonymous user

2 years ago

please send me code for multiple alarms in a days and week

Anonymous user

2 years ago

I am having difficulties in setting several alarms... can you please help me??? and email me the codes... or help me persandk@gmail.com

Anonymous user

2 years ago

i am getting a lot of errors. Arduino: 1.8.4 (Windows Store 1.8.8.0) (Windows 10), Board: "Arduino/Genuino Uno" C:\\Users\\user\\Desktop\\pill dispenser\\arduino codes\\alarm clock 3 alarms\\1_alarms\\1_alarms.ino: In function 'void setup()': 1_alarms:50: error: 'printAllOff' was not declared in this scope printAllOff(); ^ C:\\Users\\user\\Desktop\\pill dispenser\\arduino codes\\alarm clock 3 alarms\\1_alarms\\1_alarms.ino: In function 'void loop()': 1_alarms:76: error: 'DisplaySetHourAll1' was not declared in this scope DisplaySetHourAll1(); ^ 1_alarms:77: error: 'DisplaySetMinuteAll1' was not declared in this scope DisplaySetMinuteAll1(); ^ 1_alarms:88: error: 'DisplaySetHourAll2' was not declared in this scope DisplaySetHourAll2(); ^ 1_alarms:89: error: 'DisplaySetMinuteAll2' was not declared in this scope DisplaySetMinuteAll2(); ^ 1_alarms:100: error: 'DisplaySetHourAll3' was not declared in this scope DisplaySetHourAll3(); ^ 1_alarms:101: error: 'DisplaySetMinuteAll3' was not declared in this scope DisplaySetMinuteAll3(); ^ C:\\Users\\user\\Desktop\\pill dispenser\\arduino codes\\alarm clock 3 alarms\\1_alarms\\1_alarms.ino: At global scope: 1_alarms:114: error: expected unqualified-id before 'if' if (menu==0) ^ 1_alarms:119: error: expected unqualified-id before 'if' if (menu==1) ^ 1_alarms:123: error: expected unqualified-id before 'if' if (menu==2) ^ 1_alarms:127: error: expected unqualified-id before 'if' if (menu==3) ^ 1_alarms:131: error: expected unqualified-id before 'if' if (menu==4) ^ 1_alarms:135: error: expected unqualified-id before 'if' if (menu==5) ^ 1_alarms:139: error: expected unqualified-id before 'if' if (menu==6) ^ 1_alarms:145: error: expected constructor, destructor, or type conversion before '(' token delay(100); ^ 1_alarms:146: error: expected declaration before '}' token } ^ exit status 1 'printAllOff' was not declared in this scope This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

tittiamo68

2 years ago

You have to change the logic of reasoning… 1. Decide that buttons use to set different alarms. if((digitalRead(P2)== LOW)&&(digitalRead(P3)== LOW)) { DisplaySetHourAll1(); DisplaySetMinuteAll1(); DisplaySetHourAll2(); DisplaySetMinuteAll2(); ecc… void DisplaySetHourAll1(){… alarmHours1 void DisplaySetMinuteAll1(){… alarmMinutes1 void DisplaySetHourAll2(){… alarmHours2 void DisplaySetMinuteAll2(){… alarmMinutes2 2. Decide where to view the different alarms. void printAllOn(){…. 3. Check each alarm cycle for an alarm to sound void Alarm(){…. if ( now.hour() == alarmHours1 && now.minute() == alarmMinutes1 ){…. else if ( now.hour() == alarmHours2 && now.minute() == alarmMinutes2 ){… ecc…

tittiamo68

2 years ago

Send me the code so I can better understand Arduino's mistakes. I sent you an email Ciao Tiziano

tittiamo68

2 years ago

I did not try, but I think it's possible. You have to work by adding more void DisplaySetHourAll (); void DisplaySetMinuteAll (); (All1, All2 ... etc). In "void Alarm ()" add the other "if" cases. Logically, the display of the display will also change. Good work and let me know.

Anonymous user

2 years ago

Hey please tell me how did u improve ur skill like creating arduino library like this. Its really complex that rtc.h file. Please guide me to improve that skill any documents??

Anonymous user

2 years ago

can i set an alarm according to days not dates

Anonymous user

2 years ago

can you play a .mp3 or .wav from an sd card for the alarm?

tittiamo68

2 years ago

I think you can do Try searching for "arduino music player shield", should be your case.

Anonymous user

2 years ago

I can't get my I2C lcd to work. All it's doing is showing random characters. Do you know what can help this?

Anonymous user

2 years ago

Try changing your baud rate

guy06210

2 years ago

Merci pour ce sketch qui fonctionne bien je l'ai modifié concernant l'écran pas en IC2 et traduit en français. Sortie sur un relais qui alimente la radio!! Encore bravo!!!!!!!!

tittiamo68

2 years ago

Merci beaucoup

Anonymous user

2 years ago

Hey, I was wondering if the time format could be changed from 24 hour to 12 hour format. I believe that bit 6 changes the format, and bit 5 toggles between am/pm. My question is where would I be able to access that part of the code? Where do I change the bits in this program?

Anonymous user

2 years ago

Good afternoon. Good project congratulations compile the program works everything but I disconnect the power supply and reconnect and it does not work it comes out as basuritas in the lcd.

tittiamo68

2 years ago

Can you send an image of the problem you described to me?

saharshnair

2 years ago

I have a question, can I use a 16 by 2 lcd display

Anonymous user

2 years ago

Belo projeto,gostaria de saber se teria como usar o esp8266 com ajuste das horas pelo servidor ntp e o relógio ser o pcf8563?

Anonymous user

2 years ago

Hello, one question. When i upload the code to arduino, this message pops up: exit status 1 no matching function for call to 'LiquidCrystal_I2C::begin()'. How do i fix it?

tittiamo68

2 years ago

You are missing the library

Anonymous user

2 years ago

hello one question can this alarm be controlled by bluetooth or sopmething like that ? It is for a school project. thank you

tittiamo68

2 years ago

Surely you can do it You need a special App that simulates the push of the buttons. If you search the internet, I think you'll find what you are looking for.

Anonymous user

2 years ago

Hello, I have one question, can this alarm code be used as automated dosing pump? so the output will be fertilizer quantity instead alarm sound? thank you

Anonymous user

2 years ago

THANKS!!!!! This cde help me

Anonymous user

2 years ago

code

Anonymous user

2 years ago

hello. printAllOn() and printAllOff() functions are not working,....

Anonymous user

2 years ago

Fiz o projecto do relógio e funcionou logo à primeira.Muitos Parabéns pelo projecto. Aguardo novidades suas.Obrigado.

tittiamo68

2 years ago

I'm happy with your result good job

Anonymous user

2 years ago

I cannot find a library that works for the LiquidCryatal I2C for this alarm clock. OK I am new at Arduino but have some knowledge and would like some help in finding a working Libraries for this project. I get this message (no matching function for call to 'LiquidCrystal_I2C::begin()') I have tried several libraries without success. Thanks

tittiamo68

2 years ago

Hello the error message is due to a library error. I used this, (https://github.com/tittiamo68/LiquidCrystal_I2C) and did not give me no problem.

Anonymous user

2 years ago

Hello I have a little question, is there a snooze function on this alarm?

tittiamo68

2 years ago

It was not expected. But I think it can be done.

Anonymous user

2 years ago

The RTC module in the picture diagram is not the same RTC module in the parts list which one do I actually purchase and use?

Anonymous user

2 years ago

Thanks for the help. When verifying the code I now get "RTC_DS1307 does not name a type" error. any ideas?

tittiamo68

2 years ago

The RTC card was not included in the component list, but in the description I specified the DS1307 or DS3231

tittiamo68

2 years ago

Did you use the library https://github.com/adafruit/RTClib?

Anonymous user

2 years ago

Hi, I'm having trouble with the project, i did everything but my LCD won't turn on.

tittiamo68

2 years ago

There can be various problems: Check the I2C address of the display, mine is 0x27, replace this value with yours, to find your I suggest you read "http://playground.arduino.cc/Main/I2cScanner". Check the potentiometer that adjusts the contrast (it is in the I2C module). Check that the display is correctly connected (SCL - A5, SDA - A4). Verify that the display is working. Ciao

jmherreramovil

2 years ago

Hola. ¿Como puedo hacer para no usar un RTC y usar este mismo proyecto con un nodeMCU y la hora que la tome desde NTP? Gracias

Anonymous user

2 years ago

Hello one question can this ... seconds ... hour .... day? it is for give gift to my girlfriend.

tittiamo68

2 years ago

what do you mean with ... seconds ... hour .... day? Explain better

jussikoria

2 years ago

Hi! Just to let you know, I took my old Arduinos and LCD displays from 2013 and am creating an alarm clock to control a sunlamp. I will use your code as the main code for the clock and alarm functions. Thank you! Cheers, Jussi

Anonymous user

2 years ago

Hi, in your list of components the RTC is a simple black chip. But in your drawings the RTC is a separate board. Do I need the chip, board, or will either one do?

tittiamo68

2 years ago

The code was written for a 20x4 Display (20 columns, 4 rows). Row 1: Day Row 2: Dates Row 3: Hour Row 4: Alarm If you want to use a 16x2 you have to change the Arduino code and the visualization.

tittiamo68

2 years ago

The RTC card was not included in the component list, but in the description I specified the DS1307 or DS3231

tittiamo68

2 years ago

Unfortunately, in the material list, I did not find the standard 20x4 Display, but in the notes below, I specified "LCD Display 20x04 with I2C module" You can use any Display 20x4 with I2c module, without changing the code, at the exclusion of the I2C address of the display, mine is 0x27, replace this value with yours, to find your suggest to read "http://playground.arduino.cc/Main/I2cScanner ". https://www.aliexpress.com/item/-/32670836804.html?spm=a2g0s.8937460.0.0.e1492e0e2vJsu7

Anonymous user

2 years ago

Hi, if I use a generic standard 16x2 LCD instead of one by AdaFruit, will I need to change the circuit or code?

Anonymous user

2 years ago

Also, the list of hardware components says "Adafruit Standard LCD - 16x2 White on Blue" but your drawings is 20x4, does this work with a 16x2 LCD display?

Anonymous user

2 years ago

Can I use a 16x2 display and simply have two things per line? 

Anonymous user

2 years ago

Can you set different alarms for different days of the week or is the alarm the same for every day. Say if I want to wake up at 9 on Monday and 8 on Tuesday is that possible without having to change the alarm every time?

tittiamo68

2 years ago

The code was made thinking of a single time but, changing the logic, I think we can do because RTC recognizes the day of the week

Anonymous user

2 years ago

Hi, as someone new to Ardiuno, would you say this is a good project for someone like me to start with?

tittiamo68

2 years ago

This is not a very difficult project, although there are many easier projects to start. You must have the basics of electronics and the programming bases of the c ++ language. Understand the I2c protocol, and know the Arduino card well. good job

Anonymous user

2 years ago

Very clear and logical. Thanks

Anonymous user

2 years ago

Hello, can I ask what did you plug your display into? I have the display given in the Arduino Starter Kit and I don't know where to plug it in to.

Anonymous user

2 years ago

Hello i have a question, how would you modify the code to turn the alarm off using an RFID tag (the alarm continuing until the tag is sensed)? I'm new to coding and need help for a school project. Thank you

tittiamo68

2 years ago

I've never used an "RFID tag", but I think it can be done. I've seen several tutorials on the "RFID tag" and you should replace the "P4" button with the tag. Note that due to the "if (now.hour () == alarmHours && now.minute () == alarmMinutes)" the alarm itself turns off after 1 minute

rickface

2 years ago

Is there any way to set alarms without going into the code and editing it there?

Anonymous user

2 years ago

Can I create this project using Arduino UNO only?? thank you in advance

tittiamo68

2 years ago

What you need is: "Arduino uno" or similar, Real Time Clock (DS1307 or DS3231) and an LCD display. Hello

Anonymous user

2 years ago

Hi, I have built this alarm clock which is great so far, just wondering if anyone produced the code for multiple alarms? I am not good at getting out of bed! Thanks

gennaro

2 years ago

Ciao sono Rino,mi complimento per i tuoi progetti, li ho scoperti da poco tempo, ed è anche da poco che mi sono avvicinato a questo fantastico mondo....nonostante l'età...ma come si dice.... "c'è sempre da imparare. Ho provato a realizzare questo tuo progetto e funziona tutto tranne gli Allarmi, non riesco ad impostare l'ora ed i minuti, nonostante i pulsanti che sono tutti attivi e funzionanti, ma quando entro nel menu mi lascia solo settare data e ora e finito il ciclo salva i dati, ma per impostare l'allarme non c'è verso....secondo te dove sbaglio. grazie e ciao Rino

gennaro

2 years ago

.....trovato...ho letto meglio il codice... ed ho letto che i pulsanti P2 e P3 devono essere schiacciati entrambi per attivare il menu di allarme....grande!!! funziona tutto Rino

Anonymous user

2 years ago

Made this And made some changes Timeout on menus Alarlmtime to eeprom for reload on reboot Rotary encoder input http://84.106.2.21:8888/forum/index.php?action=view&id=299

Anonymous user

2 years ago

Hello, I was wondering if you could provide me with some insight on how I could edit this code to achieve the following: Instead of turning the alarm off after 1 minute, I want to make it louder after a specific time passed IF the alarm is not user-shut off.

keithfitch

2 years ago

Excellent piece of work. Answered an awful amount of my questions. Expertly lain out and really easy to follow. many thanks for sharing your knowledge.

mo7amedhoo252

2 years ago

I can't quite understand what this project is doing

rickface

2 years ago

Is there any way to set alarms without going into the code and editing it there?

Anonymous user

2 years ago

Hi, I am doing this for a school project bur the code doesn´t seem to work. It tells me this: /usr/local/bin/arduino-cli compile --fqbn arduino:avr:uno --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/741032413/build --build-path /tmp/arduino-build-429654218982FC022C4610A747C77A80 /tmp/741032413/Alarm_Clock Using library liquidcrystal_i2c_1_1_2 at version 1.1.2 in folder: /home/builder/opt/libraries/liquidcrystal_i2c_1_1_2 Using library SPI at version 1.0 in folder: /home/builder/.arduino15/packages/arduino/hardware/avr/1.8.4/libraries/SPI /tmp/741032413/Alarm_Clock/Alarm_Clock.ino: In function 'void setup()': /tmp/741032413/Alarm_Clock/Alarm_Clock.ino:48:13: error: no matching function for call to 'LiquidCrystal_I2C::begin()' lcd.begin(); ^ In file included from /tmp/741032413/Alarm_Clock/Alarm_Clock.ino:17:0: /home/builder/opt/libraries/latest/liquidcrystal_i2c_1_1_2/LiquidCrystal_I2C.h:58:8: note: candidate: void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t) void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS ); ^~~~~ /home/builder/opt/libraries/latest/liquidcrystal_i2c_1_1_2/LiquidCrystal_I2C.h:58:8: note: candidate expects 3 arguments, 0 provided Error during build: exit status 1 I would appreciate your help on this. Thank you in advance, Helen :)

Anonymous user

2 years ago

can i set an alarm according to days not dates

jussikoria

3 years ago

Hi! Just to let you know, I took my old Arduinos and LCD displays from 2013 and am creating an alarm clock to control a sunlamp. I will use your code as the main code for the clock and alarm functions. Thank you! Cheers, Jussi

Anonymous user

3 years ago

Hi Tittiamo, your project is very nice. One suggestion is to replace the 4 buttons with a Rotary Encoder; What do you think? Daniel

Anonymous user

3 years ago

How would I add a servo motor to swing a toy hammer

Anonymous user

4 years ago

Hello, can I ask what did you plug your display into? I have the display given in the Arduino Starter Kit and I don't know where to plug it in to.

Anonymous user

4 years ago

Belo projeto,gostaria de saber se teria como usar o esp8266 com ajuste das horas pelo servidor ntp e o relógio ser o pcf8563?

jmherreramovil

4 years ago

Hola. ¿Como puedo hacer para no usar un RTC y usar este mismo proyecto con un nodeMCU y la hora que la tome desde NTP? Gracias

gobitzi

4 years ago

THANKS!!!!! This cde help me

gobitzi

2 years ago

code

veryzer

4 years ago

Very clear and logical. Thanks

Anonymous user

4 years ago

Hi sorry to ask if I'm going to do a seven segment digital clock with leds and buzzer for alarm, how can I create the alarm code for it? Because I found many examples of 7 segment digital clock without alarm so I'm struggling to get the code. Advanced thank you if you're willing to help.

Anonymous user

4 years ago

Hi Greetings!! I am 72 years old retired Telecom Engineer. I am fascinated by your clock projects and tried your clock and Clock with alarm and both are working fine. Thank you.

Anonymous user

4 years ago

im getting an error saying a function definition is not allowed before a '{' token. what does this mean and how should i fix it?

saharshnair

4 years ago

I have a question, can I use a 16 by 2 lcd display

gennaro

5 years ago

Ciao sono Rino,mi complimento per i tuoi progetti, li ho scoperti da poco tempo, ed è anche da poco che mi sono avvicinato a questo fantastico mondo....nonostante l'età...ma come si dice.... "c'è sempre da imparare. Ho provato a realizzare questo tuo progetto e funziona tutto tranne gli Allarmi, non riesco ad impostare l'ora ed i minuti, nonostante i pulsanti che sono tutti attivi e funzionanti, ma quando entro nel menu mi lascia solo settare data e ora e finito il ciclo salva i dati, ma per impostare l'allarme non c'è verso....secondo te dove sbaglio. grazie e ciao Rino

gennaro

2 years ago

.....trovato...ho letto meglio il codice... ed ho letto che i pulsanti P2 e P3 devono essere schiacciati entrambi per attivare il menu di allarme....grande!!! funziona tutto Rino

Anonymous user

5 years ago

Thanks so much for the awesome alarm clock sketch! I've been trying to build one from scratch, then I found yours, and it is perfect!

dog568

5 years ago

I can't get my I2C lcd to work. All it's doing is showing random characters. Do you know what can help this?

Anonymous user

2 years ago

Try changing your baud rate

Anonymous user

5 years ago

Hello, one question. When i upload the code to arduino, this message pops up: exit status 1 no matching function for call to 'LiquidCrystal_I2C::begin()'. How do i fix it?

tittiamo68

2 years ago

You are missing the library

Anonymous user

5 years ago

Hi, I have built this alarm clock which is great so far, just wondering if anyone produced the code for multiple alarms? I am not good at getting out of bed! Thanks

Anonymous user

5 years ago

I need this alarm to continue for more than a minute, can you help me?

GPMarzuki

5 years ago

Hello, I have one question, can this alarm code be used as automated dosing pump? so the output will be fertilizer quantity instead alarm sound? thank you

Anonymous user

5 years ago

I did some more tweaking and was able to get it working! Just don't ask me how... Here is the working code for 128x64 OLED display: https://pastebin.com/Kw8zBZce Here is the wiring diagram: https://gyazo.com/f68f1c60d904db62ebd654a8195602d4 I'm trying to add one more button to display DHT22 temp/hum readings but I keep running in to a dead-end...

Anonymous user

5 years ago

(I was a bit too tired last night and posted this to the other clock project but I feel like this comment should be here so I'll post it again.) Thank you for this project. It has helped me alot with my OLED + RTC clock. I changed the code to accept SD 1306 (128x64) OLED screen instead of the LCD. Everything is working but the screen keeps flickering. I'm not experienced enough to find out why it's flickering. I think working OLED version of this code would be useful to many people today. Here is the sketch if someone wants to take a look at it and try to find out if it can be fixed. https://pastebin.com/afRJb1NN

Anonymous user

5 years ago

Why didn't you debounce the push-buttons?

Anonymous user

5 years ago

Made this And made some changes Timeout on menus Alarlmtime to eeprom for reload on reboot Rotary encoder input http://84.106.2.21:8888/forum/index.php?action=view&id=299

Anonymous user

5 years ago

pls help me, why is the push button that the alarm setting does not work and does not want to function the alarm (pinD9)

tittiamo68

2 years ago

Have you checked the electrical connections?

Anonymous user

2 years ago

pls fast respon

Anonymous user

6 years ago

can you please send me code for several alarms tahakh585@gmail.com

Anonymous user

6 years ago

We tried everything but the LCD doesn't display the output or the hours, can you help us about this?

tittiamo68

2 years ago

There can be various problems: Check the I2C address of the display, mine is 0x27, replace this value with yours, to find your I suggest you read "http://playground.arduino.cc/Main/I2cScanner". Check the potentiometer that adjusts the contrast (it is in the I2C module). Check that the display is correctly connected (SCL - A5, SDA - A4). Verify that the display is working.

Anonymous user

6 years ago

Can i use this code to set reminders? And can i replace lcd with oled?

Anonymous user

6 years ago

Hello i have a question, how would you modify the code to turn the alarm off using an RFID tag (the alarm continuing until the tag is sensed)? I'm new to coding and need help for a school project. Thank you

tittiamo68

2 years ago

I've never used an "RFID tag", but I think it can be done. I've seen several tutorials on the "RFID tag" and you should replace the "P4" button with the tag. Note that due to the "if (now.hour () == alarmHours && now.minute () == alarmMinutes)" the alarm itself turns off after 1 minute

Anonymous user

6 years ago

Can you please help me modify the code so I can use this alarm for my school project? I need it to work with LCD 16x2 I2C and a ds3231 rtc. I have no clue what I'm doing and I really need help.. I don't know what I should change to have my 16x2 display work, or the RTC work with the code, because when i try to change "RTC_DS1307 RTC;" into "RTC_DS3231 RTC;" I get errors, such as: "Alarm_Clock:134: error: 'RTC' was not declared in this scope" and way more, and the RTC's even use the same libary, so it shouldnt be a problem? Please help me modify the whole code to make it work. Thanks

tittiamo68

2 years ago

You do not need to change the wording from "RTC_DS1307 RTC;" to "RTC_DS3231 RTC;" it works very well the same. I can not change the code as you want, you have to work alone. I can give you some suggestions: LiquidCrystal_I2C lcd (0x27,20,4); 0x27 is the I2c address of my display, to find yours, I suggest you read "http://playground.arduino.cc/Main/I2cScanner". 20,4 says it is a display of 20 columns and 4 rows yours is 16,2 To use a smaller display, you must enter less information (delete the day of the week, remove the wording "Date", "Time" and delete the seconds), doing so, put the date and time in the first line <dd/mm/yyyy hh:mm> (16 characters) and in the second the alarm.

Anonymous user

6 years ago

Hi! I'm working on a school project and I'm new to arduino.. Could you help with on using this code with 16x2 lcd display and a ds3231 rtc? Thanks

tittiamo68

2 years ago

This code was written for a 20 x 4 display. To use a smaller display you need to put less information. I made another watch project with a 16 x 2 display (https://www.hackster.io/Tittiamo/clock-set-date-time-0d46a4) and I always used the I2c module, if you do not have one available, there are several tutorials that can explain the link. the RTC DS3231 and DS1307 are equivalent and both work with the same library, the DS3231 is better

Anonymous user

6 years ago

Hello one question can this ... seconds ... hour .... day? it is for give gift to my girlfriend.

tittiamo68

2 years ago

what do you mean with ... seconds ... hour .... day? Explain better

Anonymous user

6 years ago

The code is working, but the display is not showing on the LCD. We have 16x2 LCD display while you are using 16x4 display. What could be the changes made according 16x2 display? Please help. Also where can we find the libraries?

tittiamo68

2 years ago

There can be various problems: Check the I2C address of the display, mine is 0x27, replace this value with yours, to find your I suggest you read "http://playground.arduino.cc/Main/I2cScanner". Check the potentiometer that adjusts the contrast (it is in the I2C module). Check that the display is correctly connected (SCL - A5, SDA - A4). Verify that the display is working. The alarm clock has been created with a 16x4 display, if you want to use a smaller display, you have to change the "void DisplayDateTime ()" code

tittiamo68

2 years ago

photos tittiduino@gmail.com

tittiamo68

2 years ago

Try this code that I have modified for you. I deleted the date display. I did not try the code, let me know if it's okay. https://github.com/tittiamo68/AlarmCloc-16x2

tittiamo68

2 years ago

i answered your email

Anonymous user

2 years ago

Sure

Anonymous user

2 years ago

Thanks again for the help. I tried the code, but it gives me error on "lcd.begin()" function in the "void setup()" code. I then tried "lcd.begin(16,2)", it worked, but the display is still not what it should be. In the serial monitor window, it is displaying the message "RTC is NOT running!"

Anonymous user

2 years ago

I sent you an email.

Anonymous user

2 years ago

Thanks. Have done that. But the display is only showing odd characters and symbols. And I don't have any idea what to do with the "void DisplayDateTime()" code for 16x2 LCD. Also, I have a green colored LCD display. Does that make any difference? Please help! Thanks & Regards

Anonymous user

6 years ago

Hello I have a little question, is there a snooze function on this alarm?

tittiamo68

2 years ago

It was not expected. But I think it can be done.

Anonymous user

6 years ago

Can i use an OLED display for this project? I tried to modify the code and it gave me this error: C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino\\Print.h: In function 'write.constprop': C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\\hardware\\arduino\\avr\\cores\\arduino\\Print.h:55:5: internal compiler error: Segmentation fault } ^ Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper.exe: fatal error: C:\\Program Files\\WindowsApps\\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\\hardware\ ools\\avr/bin/avr-gcc returned 1 exit status compilation terminated. c:/program files/windowsapps/arduinollc.arduinoide_1.8.15.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld.exe: error: lto-wrapper failed collect2.exe: error: ld returned 1 exit status exit status 1 Error compiling for board Arduino/Genuino Mega or Mega 2560.

tittiamo68

2 years ago

If I do not see all the code, I do not know where the error is. I did not use OLED displays, but I think it can be done.

Emmett_morley

6 years ago

Can you set different alarms for different days of the week or is the alarm the same for every day. Say if I want to wake up at 9 on Monday and 8 on Tuesday is that possible without having to change the alarm every time?

tittiamo68

2 years ago

The code was made thinking of a single time but, changing the logic, I think we can do because RTC recognizes the day of the week

Anonymous user

6 years ago

Hi i was just wondering would it be possible to programme the arduino for the alarm clock to not go off until it is plugged into something, has made contact with a docking station etc. Alternatively would it be possible to make it so that the alarm would not go off until a certain distance was traveled using a pedometer meter like in smartphones?

ZitoTech

6 years ago

The RTC module in the picture diagram is not the same RTC module in the parts list which one do I actually purchase and use?

tittiamo68

2 years ago

Did you use the library https://github.com/adafruit/RTClib?

tittiamo68

2 years ago

The RTC card was not included in the component list, but in the description I specified the DS1307 or DS3231

ZitoTech

2 years ago

Thanks for the help. When verifying the code I now get "RTC_DS1307 does not name a type" error. any ideas?

Zaneeq

7 years ago

Hi, in your list of components the RTC is a simple black chip. But in your drawings the RTC is a separate board. Do I need the chip, board, or will either one do?

tittiamo68

2 years ago

The code was written for a 20x4 Display (20 columns, 4 rows). Row 1: Day Row 2: Dates Row 3: Hour Row 4: Alarm If you want to use a 16x2 you have to change the Arduino code and the visualization.

tittiamo68

2 years ago

Unfortunately, in the material list, I did not find the standard 20x4 Display, but in the notes below, I specified "LCD Display 20x04 with I2C module" You can use any Display 20x4 with I2c module, without changing the code, at the exclusion of the I2C address of the display, mine is 0x27, replace this value with yours, to find your suggest to read "http://playground.arduino.cc/Main/I2cScanner ". https://www.aliexpress.com/item/-/32670836804.html?spm=a2g0s.8937460.0.0.e1492e0e2vJsu7

tittiamo68

2 years ago

The RTC card was not included in the component list, but in the description I specified the DS1307 or DS3231

Zaneeq

2 years ago

Also, the list of hardware components says "Adafruit Standard LCD - 16x2 White on Blue" but your drawings is 20x4, does this work with a 16x2 LCD display?

Zaneeq

2 years ago

Hi, if I use a generic standard 16x2 LCD instead of one by AdaFruit, will I need to change the circuit or code?

Zaneeq

2 years ago

Can I use a 16x2 display and simply have two things per line? 

aquintanillaposadas

7 years ago

Hi, I'm having trouble with the project, i did everything but my LCD won't turn on.

tittiamo68

2 years ago

There can be various problems: Check the I2C address of the display, mine is 0x27, replace this value with yours, to find your I suggest you read "http://playground.arduino.cc/Main/I2cScanner". Check the potentiometer that adjusts the contrast (it is in the I2C module). Check that the display is correctly connected (SCL - A5, SDA - A4). Verify that the display is working. Ciao

alok_shah

7 years ago

Hey, I was wondering if the time format could be changed from 24 hour to 12 hour format. I believe that bit 6 changes the format, and bit 5 toggles between am/pm. My question is where would I be able to access that part of the code? Where do I change the bits in this program?

Anonymous user

7 years ago

Hey I did everything to set up the clock but it doesn't seem to turn on when I upload the code only the LED flashes. I'm I missing a step or could my wiring be wrong.

tittiamo68

2 years ago

Check the I2C address of the display, mine is 0x27, replace this value with yours. To find your 'I suggest you read "http://playground.arduino.cc/Main/I2cScanner".

Amprodrigues1956

7 years ago

Fiz o projecto do relógio e funcionou logo à primeira.Muitos Parabéns pelo projecto. Aguardo novidades suas.Obrigado.

tittiamo68

2 years ago

I'm happy with your result good job

Anonymous user

7 years ago

Can I create this project using Arduino UNO only?? thank you in advance

tittiamo68

2 years ago

What you need is: "Arduino uno" or similar, Real Time Clock (DS1307 or DS3231) and an LCD display. Hello

Anonymous user

7 years ago

What should I do in the code if i'll only use 3 push buttons??

tittiamo68

2 years ago

You have to change the logic of the code. My logic uses 4 buttons: set, plus and minus to adjust the time and Alarm switch to activate or deactivate the alarm

guy06210

7 years ago

Merci pour ce sketch qui fonctionne bien je l'ai modifié concernant l'écran pas en IC2 et traduit en français. Sortie sur un relais qui alimente la radio!! Encore bravo!!!!!!!!

tittiamo68

2 years ago

Merci beaucoup

cncjim

7 years ago

I cannot find a library that works for the LiquidCryatal I2C for this alarm clock. OK I am new at Arduino but have some knowledge and would like some help in finding a working Libraries for this project. I get this message (no matching function for call to 'LiquidCrystal_I2C::begin()') I have tried several libraries without success. Thanks

tittiamo68

2 years ago

Hello the error message is due to a library error. I used this, (https://github.com/tittiamo68/LiquidCrystal_I2C) and did not give me no problem.

Anonymous user

7 years ago

hi please help me i want change ds1307 by ds1302(i don't have ds1307) but I encountered some problems like these 'class DS1302' has no member named 'begin'.......(RTC.begin();)

kalle67

2 years ago

Grazie della risposta, per il set temperatura intendo che da display si possa settare a che temperatura deve lavorare il riscaldatore, quindi o 25 o 24 gradi o altro a seconda delle esigenze, insomma vorrei poter salvare dei dati a mio piacimento magari direttamente nelle eeprom, così in caso di seset o mancanza di corrente rimanessero in memoria, come dire il mio progetto dovrebbe essere un controller per acquario settabile con i 4 tasti e visualizzando sul display i dati.

kalle67

2 years ago

Ciao e scusa se ti scrivo in italiano, vorrei usare il tuo lavoro come base di partenza per un progetto di controller per acquario. Secondo te posso creare dei menu dove settare l'orario di accensione delle lampade o il set della temperatura? Me la cavo abbastanza bene con il Wiring, ma trovo ostica la creazione dei menu.

kalle67

2 years ago

Grazie ci lavoro e poi ti dico. Sei un grande!

kalle67

2 years ago

Hai ragione è una bella sfida ed è da tempo che ci lavoro..... Le variabili sono molte da considerare ad esempio ho 3 lampade a led che voglio far accendere ad orari sfalzati, devo comandare un areatore anche quello ad orari variabili. Come sensore di temperatura ho preso una sonda ad immersione 18B20. Grazie di tutto. Poi stasera ti posto il codice del progetto che ho fatto senza però il controllo dei valori mediante tasti. Ecco il mio codice: int led = 13; // the pin that the LED is attached to int riscaldatore = 6; // al relè avvio riscaldatore int ledriscaldatore = 7; // al led funzionamento riscaldatore int ledallarme = 12; // led allarme temperatura byte relelampada1 = 2; //rele lampada1 byte relelampada2 = 3; //rele lampada2 byte relelampada3 = 4; //rele lampada3 byte timeON = 18; // ora di accensione LAMPADA CENTRALE(0-23) byte timeOFF = 21; // ora di spegnimento LAMPADA CENTRALE(0-23) byte timeON1 = 16; // ora di accensione LAMPADA LATERALE1(0-23) byte timeOFF1 = 22; // ora di spegnimento LAMPADA LATERALE1(0-23) byte timeON2 = 17; // ora di accensione LAMPADA LATERALE2(0-23) byte timeOFF2 = 23; // ora di spegnimento LAMPADA LATERALE2(0-23) byte timeON10 = 12; //ora accensione retroilluminazione lcd byte timeOFF10 = 23; // ora spegnimento retroilluminazione lcd #include <Wire.h> #include <LCD.h> #include <LiquidCrystal_I2C.h> #include <OneWire.h> #include <DallasTemperature.h> #include <DS3232RTC.h> #include <Time.h> #define ONE_WIRE_BUS 8 OneWire ourWire(ONE_WIRE_BUS); DallasTemperature sensors(&ourWire); #include <dht11.h> dht11 DHT11; #define DHT11PIN 9 #define I2C_ADDR 0x27 #define BACKLIGHT_PIN 3 #define En_pin 2 #define Rw_pin 1 #define Rs_pin 0 #define D4_pin 4 #define D5_pin 5 #define D6_pin 6 #define D7_pin 7 LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin, Rs_pin, D4_pin, D5_pin, D6_pin, D7_pin); void setup() { pinMode(riscaldatore, OUTPUT); pinMode(led, OUTPUT); pinMode(ledriscaldatore, OUTPUT); pinMode(ledallarme, OUTPUT); pinMode(relelampada1, OUTPUT); pinMode(relelampada2, OUTPUT); pinMode(relelampada3, OUTPUT); { Serial.begin(9600); Serial.println("Misura la temperatura con sensore DS18B20"); Serial.println("continua la misurazione"); delay(10000); } sensors.begin(); Serial.begin(9600); Serial.println(); lcd.begin (20, 4); lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE); Wire.begin(); Serial.begin(9600); setSyncProvider(RTC.get); // the function to get the time from the RTC if(timeStatus() != timeSet) Serial.println("Unable to sync with the RTC"); else Serial.println("RTC has set the system time"); Serial.begin(9600); Serial.println("DHT11 TEST PROGRAM "); Serial.print("LIBRARY VERSION: "); Serial.println(DHT11LIB_VERSION); Serial.println(); } void loop() { if ((hour() >= timeON10) && (hour() < timeOFF10))lcd.setBacklight(HIGH) ; // attiva retroilluminazione lcd else lcd.setBacklight(LOW); // disattiva retroilluminazione lcd //lcd.setBacklight(HIGH); { if ((hour() >= timeON10) && (hour() < timeOFF10)) digitalWrite(led, HIGH) ; // attiva led on else digitalWrite(led, LOW); // disattiva led on } Serial.println(); sensors.requestTemperatures(); delay(30000); Serial.print("Temperatura = "); Serial.print(sensors.getTempCByIndex(0)); Serial.println(" gradi C"); lcd.home (); // go home lcd.print(""); if (day() < 10) { lcd.print("0"); } lcd.print((day())); lcd.print("/"); if (month() < 10) { lcd.print("0"); } lcd.print((month())); lcd.print("/"); lcd.print((year())); lcd.print(" "); lcd.print("Ore "); lcd.print((hour())); lcd.print(":"); if (minute() < 10) { lcd.print("0"); } lcd.print((minute())); lcd.setCursor ( 0, 1 ); // go to the 2nd line lcd.print("Acquario:oC "); lcd.print(sensors.getTempCByIndex(0)); lcd.setCursor ( 0, 2 ); // go to the third line lcd.print("EXT:oC "); lcd.print((float)DHT11.temperature, 2); lcd.print(" % "); lcd.print((float)DHT11.humidity, 2); lcd.setCursor ( 0, 3 ); // go to the fourth line if (sensors.getTempCByIndex(0) < 30.00) { lcd.print(" Status ok"); } else { lcd.home (); // go home lcd.print("Abbassa Temp."); } if (sensors.getTempCByIndex(0) < 25.00) { digitalWrite(riscaldatore, LOW); digitalWrite(ledriscaldatore, HIGH); } else { digitalWrite(riscaldatore, HIGH); digitalWrite(ledriscaldatore, LOW); } if (sensors.getTempCByIndex(0) > 30.00) { { digitalWrite(ledallarme, HIGH); } } else { digitalWrite(ledallarme, LOW); } digitalClockDisplay(); } void digitalClockDisplay(void) { // digital clock display of the time Serial.print(hour()); printDigits(minute()); printDigits(second()); Serial.print(' '); Serial.print(day()); Serial.print(' '); Serial.print(month()); Serial.print(' '); Serial.print(year()); Serial.println(); } void printDigits(int digits) { Serial.print(':'); if(digits < 10) Serial.print('0'); Serial.print(digits); if ((hour() >= timeON) && (hour() < timeOFF)) digitalWrite(relelampada1, LOW); // attiva relè else digitalWrite(relelampada1, HIGH); // disattiva relè if ((hour() >= timeON1) && (hour() < timeOFF1)) digitalWrite(relelampada2, LOW); // attiva relè else digitalWrite(relelampada2, HIGH); // disattiva relè if ((hour() >= timeON2) && (hour() < timeOFF2)) digitalWrite(relelampada3, LOW); // attiva relè else digitalWrite(relelampada3, HIGH); // disattiva relè Serial.println("\ "); int chk = DHT11.read(DHT11PIN); Serial.print("Read sensor: "); switch (chk) { case 0: Serial.println("OK"); break; case -1: Serial.println("Checksum error"); break; case -2: Serial.println("Time out error"); break; default: Serial.println("Unknown error"); break; } Serial.print("Humidity (%): "); Serial.println((float)DHT11.humidity, 2); Serial.print("Temperatura (oC): "); Serial.println((float)DHT11.temperature, 2); } double Fahrenheit(double celsius) { return 1.8 * celsius + 32; } //Celsius to Kelvin conversion double Kelvin(double celsius) { return celsius + 273.15; } double dewPoint(double celsius, double humidity) { double A0 = 373.15 / (273.15 + celsius); double SUM = -7.90298 * (A0 - 1); SUM += 5.02808 * log10(A0); SUM += -1.3816e-7 * (pow(10, (11.344 * (1 - 1 / A0))) - 1) ; SUM += 8.1328e-3 * (pow(10, (-3.49149 * (A0 - 1))) - 1) ; SUM += log10(1013.246); double VP = pow(10, SUM - 3) * humidity; double T = log(VP / 0.61078); // temp var return (241.88 * T) / (17.558 - T); } double dewPointFast(double celsius, double humidity) { double a = 17.271; double b = 237.7; double temp = (a * celsius) / (b + celsius) + log(humidity / 100); double Td = (b * temp) / (a - temp); return Td; }

tittiamo68

2 years ago

Ho "giocato" un po'.... Dai un occhiata a: https://github.com/tittiamo68/Acquario Non ho tempo di provarlo, ti ho messo lo schema fritzing. Se hai problemi, per non intasare la chat, scrivimi una mail. Ciao

tittiamo68

2 years ago

Per l'accensione delle lampade puoi tranquillamente usare il pin 13 che è collegato al led ed usare un relè, il problema è quanto tempo devono rimanere accese le lampade, in questo caso bisogna cambiare la logica del Void Alarm...io avevo previsto solo 1 minuto... per il set della temperatura cosa intendi ?

tittiamo68

2 years ago

Sto lavorando sul codice... Alcune domande L'acquario deve rimanere acceso un tempo fisso di ore ? e in che fascia d'orario ? che sensore per la temperatura vuoi usare ? Mi piace questa "sfida"!

tittiamo68

2 years ago

The DS1302 is not compatible with the "Wire.h" and "RTClib.h" libraries because it does not use the I2c protocol

Anonymous user

7 years ago

hello. printAllOn() and printAllOff() functions are not working,....

Anonymous user

7 years ago

How can I configure the clock to activate a servo so that it moves 90 degrees and then to zero as the alarm comes on? I need this to happen every 12 hours to help someone with their medications. Thank you.

tittiamo68

2 years ago

you have to study "https://www.arduino.cc/en/Reference/Servo"

thelegosoldier

7 years ago

Hi, as someone new to Ardiuno, would you say this is a good project for someone like me to start with?

tittiamo68

2 years ago

This is not a very difficult project, although there are many easier projects to start. You must have the basics of electronics and the programming bases of the c ++ language. Understand the I2c protocol, and know the Arduino card well. good job

raiderman

7 years ago

Good afternoon. Good project congratulations compile the program works everything but I disconnect the power supply and reconnect and it does not work it comes out as basuritas in the lcd.

tittiamo68

2 years ago

Can you send an image of the problem you described to me?

Anonymous user

7 years ago

I can't do it... to many errors :( Some HELP? C:\\Users\\user\\Desktop\\Orologi\\Alarm_Clock\\Alarm_Clock.ino: In function 'void setup()': Alarm_Clock:49: error: no matching function for call to 'LiquidCrystal_I2C::begin()' lcd.begin(); ^ C:\\Users\\user\\Desktop\\Orologi\\Alarm_Clock\\Alarm_Clock.ino:49:13: note: candidate is: In file included from C:\\Users\\user\\Desktop\\Orologi\\Alarm_Clock\\Alarm_Clock.ino:18:0: C:\\Users\\user\\Documents\\Arduino\\libraries\\LiquidCrystal_I2C1602V1/LiquidCrystal_I2C.h:58:8: note: void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t) void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS ); ^ C:\\Users\\user\\Documents\\Arduino\\libraries\\LiquidCrystal_I2C1602V1/LiquidCrystal_I2C.h:58:8: note: candidate expects 3 arguments, 0 provided exit status 1 no matching function for call to 'LiquidCrystal_I2C::begin()'

tittiamo68

2 years ago

Hi Dimitri Your problem is the "LiquidCrystal_I2C.h" library. What you have is different from what I use. Download and install this: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library Let me know. Always at your disposal. Tiziano

Jeffrey

7 years ago

can you play a .mp3 or .wav from an sd card for the alarm?

tittiamo68

2 years ago

I think you can do Try searching for "arduino music player shield", should be your case.

Anonymous user

8 years ago

Can we set multiple alarm for a single day which will remain activate through all the days of the week?

Anonymous user

2 years ago

Hey please tell me how did u improve ur skill like creating arduino library like this. Its really complex that rtc.h file. Please guide me to improve that skill any documents??

tittiamo68

2 years ago

Send me the code so I can better understand Arduino's mistakes. I sent you an email Ciao Tiziano

tittiamo68

2 years ago

You have to change the logic of reasoning… 1. Decide that buttons use to set different alarms. if((digitalRead(P2)== LOW)&&(digitalRead(P3)== LOW)) { DisplaySetHourAll1(); DisplaySetMinuteAll1(); DisplaySetHourAll2(); DisplaySetMinuteAll2(); ecc… void DisplaySetHourAll1(){… alarmHours1 void DisplaySetMinuteAll1(){… alarmMinutes1 void DisplaySetHourAll2(){… alarmHours2 void DisplaySetMinuteAll2(){… alarmMinutes2 2. Decide where to view the different alarms. void printAllOn(){…. 3. Check each alarm cycle for an alarm to sound void Alarm(){…. if ( now.hour() == alarmHours1 && now.minute() == alarmMinutes1 ){…. else if ( now.hour() == alarmHours2 && now.minute() == alarmMinutes2 ){… ecc…

tittiamo68

2 years ago

I did not try, but I think it's possible. You have to work by adding more void DisplaySetHourAll (); void DisplaySetMinuteAll (); (All1, All2 ... etc). In "void Alarm ()" add the other "if" cases. Logically, the display of the display will also change. Good work and let me know.

Anonymous user

2 years ago

i am getting a lot of errors. Arduino: 1.8.4 (Windows Store 1.8.8.0) (Windows 10), Board: "Arduino/Genuino Uno" C:\\Users\\user\\Desktop\\pill dispenser\\arduino codes\\alarm clock 3 alarms\\1_alarms\\1_alarms.ino: In function 'void setup()': 1_alarms:50: error: 'printAllOff' was not declared in this scope printAllOff(); ^ C:\\Users\\user\\Desktop\\pill dispenser\\arduino codes\\alarm clock 3 alarms\\1_alarms\\1_alarms.ino: In function 'void loop()': 1_alarms:76: error: 'DisplaySetHourAll1' was not declared in this scope DisplaySetHourAll1(); ^ 1_alarms:77: error: 'DisplaySetMinuteAll1' was not declared in this scope DisplaySetMinuteAll1(); ^ 1_alarms:88: error: 'DisplaySetHourAll2' was not declared in this scope DisplaySetHourAll2(); ^ 1_alarms:89: error: 'DisplaySetMinuteAll2' was not declared in this scope DisplaySetMinuteAll2(); ^ 1_alarms:100: error: 'DisplaySetHourAll3' was not declared in this scope DisplaySetHourAll3(); ^ 1_alarms:101: error: 'DisplaySetMinuteAll3' was not declared in this scope DisplaySetMinuteAll3(); ^ C:\\Users\\user\\Desktop\\pill dispenser\\arduino codes\\alarm clock 3 alarms\\1_alarms\\1_alarms.ino: At global scope: 1_alarms:114: error: expected unqualified-id before 'if' if (menu==0) ^ 1_alarms:119: error: expected unqualified-id before 'if' if (menu==1) ^ 1_alarms:123: error: expected unqualified-id before 'if' if (menu==2) ^ 1_alarms:127: error: expected unqualified-id before 'if' if (menu==3) ^ 1_alarms:131: error: expected unqualified-id before 'if' if (menu==4) ^ 1_alarms:135: error: expected unqualified-id before 'if' if (menu==5) ^ 1_alarms:139: error: expected unqualified-id before 'if' if (menu==6) ^ 1_alarms:145: error: expected constructor, destructor, or type conversion before '(' token delay(100); ^ 1_alarms:146: error: expected declaration before '}' token } ^ exit status 1 'printAllOff' was not declared in this scope This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

Anonymous user

2 years ago

I am having difficulties in setting several alarms... can you please help me??? and email me the codes... or help me persandk@gmail.com

Anonymous user

2 years ago

please send me code for multiple alarms in a days and week

Anonymous user

8 years ago

hello one question can this alarm be controlled by bluetooth or sopmething like that ? It is for a school project. thank you

tittiamo68

2 years ago

Surely you can do it You need a special App that simulates the push of the buttons. If you search the internet, I think you'll find what you are looking for.