Ds 3231 based home automation.

The project is on a breadboard. And I'm a noobie man, I've never dealt with all the schematics...
It's just a nano, 3 push buttons the DS 3231 and a 16x2 lcd that I'm concerned with right now. It's real simple. Running it off a 5V 1 A supply which is enough for this rig. If I can turn this on and off, I can then connect it to the circuit with all the relays and sensors which is the one I used the 2:5 A supply for. I am not working on the board with all the relays and stuff right now. I'm trying to keep it real simple to test out if the DS 3231 is capable of what I want it to do.

It's just a nano, 3 push buttons the DS 3231 and a 16x2 lcd that I'm concerned with right now. It's real simple.

So draw what you have created using a pencil and paper, photograph it and attach it to a post

Frankly, if you can confuse the Vin pin with the 5V pin then anything is possible so please help us to help you

Thank you for your concern. Will do that.

Okay, I've done that in Fritzing. I could'nt find the DS 3231 module so I couldn't add that there. Let's just assume that there's an RTC there and let's work with that. Also this is my first time so if I've missed something I'm sorry. This circuit is just my setup to test the RTC so it has been real simple.

At least is there a way to turn off the 5V supply to all the peripherals, the LCD, the RTC and the switches and put the arduino to low power mode? The low power mode is something that I have done before but I need to find a way to turn off the other devices connected to the arduino because when I'm using it in the final setup, that's what I want to do. A PIR sensor, IR receiver or a voice control module have no use at night so I wish to turn them off but keep the arduino running in low power mode. Is that possible? I would like to hear other alternatives too.

Here's how to get an image into a post

Those switches aren’t switching anything: they’re just connecting a pin to ground through a 220R. But that might be just your unfamiliarity with how to draw a circuit.

If those are pull downs, they should be connected as shown here, and be 10k not 220R:

But I thought there were some relays in the mix somewhere?

I'm sorry that I've confused some people. This is my first time so I'm really not familiar with this. Those switches are pulled up through the pull up resistors in the microcontroller. That's the INPUT_PULLUP ones. Those are just current limiting resistors.

About the relays, this is just a rig to test the DS 3231 and not the complete circuit of the automation setup. I need help with this first. I will be able to manage the other. Again, this is not the one with the voice module, relays and pir sensors. Coming to the part that I actually want to test, I want to see if there's some way I can shut it down and power it up with respect to 2 alarms in the DS 3231. If that sounds too much, I would love to hear any other alternatives.

Now, why I want to do this is because the sensors just have nothing to process at night (talking about what I want to implement in the other board). So if I can find a way to do it in this 'mini project' I will be able to do that in the final project.

I've got the power problem sorted out all thanks to you guys, because when I measures the current draw, it was clear so that's solved.

Now we need to see your code please but see Read this before posting a programming question before you post it and follow the recommendations

There's a function in my code called shutDownHandler() which deals with the process of shutting it down. That's what I need help with. Is it fine if I post that function only or do you need the whole code because the code is not my problem currently.

A complete program please. Otherwise we cannot see how and where variables are declared for one thing

I still don't think there is a problem with the code. I apologise if the code is really messy, I do't mean to confuse anyone. Also I have reused some char arrays at different places.

Oops... My code is about 500 lines it exceeds the 9000 characters limit. Should I post it in parts?

Well to be clear, the code is just for the diagram that I have posted above

I too doubt that the problem is with the code, but it could be

You can attach it to a post rather than posting it in sections

My feelings have still not changed, ie you do not need to power off the Arduino as long as you use suitable hardware

Yup, attached that. Actually you have a point. I don't need to power the arduino down, I just need to run it in low power mode until morning. Then the INTCN pin can be attached as an interrupt. I have also desoldered the pullup resistor bank from the RTC and done all of that following on another thread on this forum. Although if im powering the arduino and the RTC from the same source, I don't think that was really necessary.

Having put the arduino to sleep, I want to switch off the 5V supply to the LCD and switches (and following this, the sensors and relays later on in the final circuit). I just want a way to power them down WITHOUT powering down the arduino like a relay across their inputs and this is what I'm having trouble figuring out. In the code setup, there's a pinMode for pin called PCI which is not 'PCI' but just a pin i used to test this out, but ended up failing so commented that out.

Now, if I do this, the INTCN is pulled up to the CR2032 battery, so high would be ~3V according to the module. Can the Arduino detect that as a HIGH signal. Again I know that the INTCN will go LOW to signify the alarm going off but i just needed this clarification.

If I suddenly lower the load ie.put the arduino to sleep and turn off the lcd,sensors and stuff, can the power supply handle the change from 2.5 A to a few micro amps in a matter of seconds or do I need any backup power source like a battery or like a capacitor in parallel to the supply ?

Also, hope the code is clear. I'm sorry again if its real messed up beacuse i wrote it in a hurry tryna just get the RTC working.

I don't know how many times I have to say this, but if the project is powered from the mains then you don't need to power it down or even put it into low power.. Even if you do put it to sleep then the power supply will still be working, won't it

Yea sure, can you help me shut down the relays and sensors to prevent any false triggering. Just asking for the final setup. If you’ve used pir sensors, then you will know better than me about the two modes of sensor trigger once and trigger until motion is being detected, I don’t want the lights to switch on at night so I can have the sensor and the relays turned off right. I’m using it for my bedroom currently.