Is it possible to use only RTC DS3231 module and Relay module without arduino? I wanted to turn on the light on specific time using the rtc internal alarm feature to trigger a relay which will then turn on the lamp.
I can do this with the help of arduino, programming the arduino to check the rtc time, then trigger the relay. But now I just want to use rtc alarm to trigger relay without arduino, is it possible? how is the schematic look like? I am newbie and still learning the electronics.
Thanks.
I don't think this is possible because after the RTC alarm triggers, you have to reset the alarm or it won't occur again. The only way to do that is to use I2C to clear the alarm bit in the control register.
Pete
Can use one of the 8-pin Attiny chips to run a small program to interface with the RTC chip.
el_supremo:
I don't think this is possible because after the RTC alarm triggers, you have to reset the alarm or it won't occur again. The only way to do that is to use I2C to clear the alarm bit in the control register.
Pete
Thanks pete, so not possible, it will only happens once... rtc module is not programmable.
CrossRoads:
ATTinys
Components - Active / Integrated Circuits / Microcontrollers / ATMEL ATtiny - dipmicro electronics
This is interesting... but i don't have knowledge to combine with rtc. What I want to achieve actually to fit those tiny rtc board and relay into small box, with additional arduino mini it is too big to fit into the box together.
How about a Promini board? They're quite small
You'll need to connect an FTDI Basic (or use the Rx/Tx pins from your Uno) to program it.
CrossRoads:
How about a Promini board? They're quite small
PRO MINI ATMEGA168 5V 16M Arduino Nano Compatible - dipmicro electronics
You'll need to connect an FTDI Basic (or use the Rx/Tx pins from your Uno) to program it.
ah... yes... i will try this promini. hope it will fit the box. thanks a lot.
it will only happens once... rtc module is not programmable
I don't understand what you mean here. The RTC module can be programmed to generate an alarm which will occur repeatedly. For example, you can set an alarm to trigger every minute and wire up the SQW output of the RTC so that this alarm causes an interrupt. However, when the alarm triggers it sets a bit in the control register and it will not cause another alarm until that bit has been cleared. This is why you need the arduino (or other microcontroller) to send an I2C message to the RTC which clears that bit in the control register. Then another alarm can occur.
But if you only want the alarm to trigger once and never again, that is a different matter. You could wire the RTC to the relay (which might require a bit of other hardware - transistor perhaps) so that when the RTC sets the alarm bit, that triggers the relay.
Pete
el_supremo:
I don't understand what you mean here. The RTC module can be programmed to generate an alarm which will occur repeatedly. For example, you can set an alarm to trigger every minute and wire up the SQW output of the RTC so that this alarm causes an interrupt. However, when the alarm triggers it sets a bit in the control register and it will not cause another alarm until that bit has been cleared. This is why you need the arduino (or other microcontroller) to send an I2C message to the RTC which clears that bit in the control register. Then another alarm can occur.
But if you only want the alarm to trigger once and never again, that is a different matter. You could wire the RTC to the relay (which might require a bit of other hardware - transistor perhaps) so that when the RTC sets the alarm bit, that triggers the relay.
Pete
What I want is to turn on the lamp between time 1800 - 0600, other than that range the lamp off. if the relay have no power (voltage failure) the lamp will turn off (no power), when the power restored back rtc must trigger relay if the time between 18-06 to turn on the lamp. Can I do this with only rtc and relay (and other supported component perhaps transistor, resistor, etc)? The whole hardware must fit in small box (3x3x4cm)
If the power stays on for several days, presumably you want the lamp to go off at 0600, back on at 1800 and then off again at 0600 the following day etc.
In which case, you have to use the Arduino (promini or whatever) to reset the alarm so that it will trigger again.
You also might need to use two alarms. One at 0600 and one at 1800. Although the DS3231 has two alarms, I don't know whether you can set one for 0600 and the other for 1800.
I also haven't tried to set the RTC to use am/pm and then use only Alarm1 to match hour=6, minutes=0, seconds=0. If it works, it would make it fire at 6am and 6pm. This, of course, wouldn't be much use if you wanted to change the on/off schedule to, say, 1700 on and 0800 off.
If those aren't possible you could set Alarm1 to go off when minutes and seconds are zero. This would give you an alarm each hour and you'd just have to keep track of the current hour and then check whether it is 6 or 18.
Pete
P.S.
when the power restored back rtc must trigger relay if the time between 18-06 to turn on the lamp
This requirement means that you must use a microcontroller of some sort. The RTC doesn't, on its own, produce a signal that will do this.
Pete
el_supremo:
If the power stays on for several days, presumably you want the lamp to go off at 0600, back on at 1800 and then off again at 0600 the following day etc.
In which case, you have to use the Arduino (promini or whatever) to reset the alarm so that it will trigger again.
You also might need to use two alarms. One at 0600 and one at 1800. Although the DS3231 has two alarms, I don't know whether you can set one for 0600 and the other for 1800.
I also haven't tried to set the RTC to use am/pm and then use only Alarm1 to match hour=6, minutes=0, seconds=0. If it works, it would make it fire at 6am and 6pm. This, of course, wouldn't be much use if you wanted to change the on/off schedule to, say, 1700 on and 0800 off.
If those aren't possible you could set Alarm1 to go off when minutes and seconds are zero. This would give you an alarm each hour and you'd just have to keep track of the current hour and then check whether it is 6 or 18.
Pete
I actuallly successfully do this using arduino uno, and not using RTC's alarm feature. Here is my sketch to do this LampScheduler by benny_0924
Then I need to pack it all in small box, since my RTC module have 2 alarms I am thinking to get rid of arduino and use the alarm to trigger relay. Just like the method you mentioned here one alarm to turn on, one to turn off. I am OK with hardcoded the time to 06 and 18.
After reading your response and CrossRoad's response, it is obviously I need a controller. I will look at the arduino pro mini as recommended by CrossRoad.