Finding solution to Power on/off PC with Arduino

Hey everyone,

I'm new to the Arduino scene, so please excuse any ignorance on my part. :slight_smile:

I'l looking for solution for turn on/off my office PC. So I need everyday 7.00 am PC will on and after 11.00 pm turn off and after 5 minutes disconnect main power connection to save electricity.

So I draw a diagram to make this automate by Arduino (with my knowledge), so its working as following.

  1. R1 Relay close to supply power to extension cord at 6.59am. This relay need keep close whole day to supply power to extension.

  2. After 1 min R3 Relay just close and open to power on PC.

  3. Generally Arduino running by battery power supply so it need to recharge itself everyday so R2 will close for 2 hours (Eg. 02.00 am to 04.pm) them it open again.

  4. At 11.00 pm R3 again just close and open to power off PC, There is option in Ubuntu to power off PC by pressing power button.

  5. Then at 11.15 pm R1 relay will open again to disconnect main power supply with PC.

So I need to circulate this system every.

If anyone could give me some codes and or general direction on where to begin on something like this I'd appreciate it. Thanks!!

Nayna.

Some questions for you

Do you know how to turn a pin HIGH and LOW ?
Do you understand how to use millis() for timing ?
How accurate must the timing be ?
Which examples in the IDE have you worked through ?
How experienced are you at dealing with mains voltages ?

Using an RTC (Real Time Clock) would make the program very simple.

Hay UKHeliBob,

Thanks for your quick reply.

Yes I know how to turn a pin HIGH and LOW

No I don't have much knowledge about millis() for timing ?

The Arduino clock module can be provide accurate I believe. but I don't no coding to communicate with it.

Below example I used make circulate the duty.

// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
delay(2000);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(12, HIGH);
delay(100);
digitalWrite(12, LOW);
delay(3000);

digitalWrite(13, HIGH);
delay(5000);
digitalWrite(13, LOW);
delay(6000);
}

I have some knowledge about mains voltage.

I like to know about RTC please.

Nayna.

Whichever RTC you buy should come with a library to drive it. Make sure you can download and install the library before you buy the device.

There will usually be one simple example which sets the clock the first time you run it. (RTC will come with a battery, which keeps the clock running without external power but that battery is not installed.) Then you can switch to the other examples in the library to actually use the RTC.

Hi,

Do you really need an Arduino to do this?

Most PC's these days have a function in the BIOS to automatically turn the PC on at a certain time, and you could handle the auto shutdown with some sort of script...

Hay wired67,

Yes BIOS has a feature to power on PC with specific time. I tried it many times but it don't working with my PC :confused: .

Nayna.

MorganS:
Whichever RTC you buy should come with a library to drive it. Make sure you can download and install the library before you buy the device.

There will usually be one simple example which sets the clock the first time you run it. (RTC will come with a battery, which keeps the clock running without external power but that battery is not installed.) Then you can switch to the other examples in the library to actually use the RTC.

MorganS:
Whichever RTC you buy should come with a library to drive it. Make sure you can download and install the library before you buy the device.

There will usually be one simple example which sets the clock the first time you run it. (RTC will come with a battery, which keeps the clock running without external power but that battery is not installed.) Then you can switch to the other examples in the library to actually use the RTC.

MorganS:
Whichever RTC you buy should come with a library to drive it. Make sure you can download and install the library before you buy the device.

There will usually be one simple example which sets the clock the first time you run it. (RTC will come with a battery, which keeps the clock running without external power but that battery is not installed.) Then you can switch to the other examples in the library to actually use the RTC.

Hay MorganS,

Is there any tutorial about working with RTC please share with me.

Tahanks,
Nayna.

Try this

Thank you UKHeliBob,

While searching on forum I found following thread [ Do action at certain time using RTC - Programming Questions - Arduino Forum ] something bit similar to my project. But the problem is how can I get the circuit diagram of this project to customize my one.

Do you have any idea?

Nayna.

Why do you need the circuit diagram of the other project ?
The RTC will allow you to test what the time is each time through loop(). When the time that you are interested in occurs run the code to take the appropriate actions. The other thread that you linked to uses the TimeAlarms library but you don't really need it for what you are doing.

In your original post you set out what should happen and at what time. You know how to turn a pin HIGH or LOW to turn a realy on or off. At the right time set the pins you choose to control the relays HIGH or LOW as required.

nayna:
Hay wired67,

Yes BIOS has a feature to power on PC with specific time. I tried it many times but it don't working with my PC :confused: .

Nayna.

Ok, ignore me then. I just wanted to make sure you weren't going though all the trouble when there was a potentially easier solution, but it sounds like you have everything under control.

UKHeliBob:
Why do you need the circuit diagram of the other project ?
The RTC will allow you to test what the time is each time through loop(). When the time that you are interested in occurs run the code to take the appropriate actions. The other thread that you linked to uses the TimeAlarms library but you don't really need it for what you are doing.

In your original post you set out what should happen and at what time. You know how to turn a pin HIGH or LOW to turn a realy on or off. At the right time set the pins you choose to control the relays HIGH or LOW as required.

Hay UKHeliBob,

Your point is correct, I know I already have some knowledge about basic flow, accept knowing about Rtc works. Now I'm studying about Rtc, looks like can be manage my self.

Thanks,
Nayna