Arduino + PIR + ATX Power Supply + LED Light Strips

I think this should work, but wanted to get some input from the forum. I want to control about 180W of LED strip lighting that will be powered by a reclaimed 280W ATX power supply. My plan was to power the arduino using the standby voltage of the power supply. The Arduino would have a PIR that would sense motion and the sketch would respond to the motion detection by closing the control wire on the power supply essentially acting like a switch.

For this particular power supply, I would need the control wire to stay closed while the lights need to be on. Once motion is no longer detected by the PIR, I would like a pre-programmed timer to start counting down. Once this timer counts down, the control wire would be opened, effectively turning off the power supply and the lights.

This counter would need to be reset every time the PIR detected any motion.

Does this idea make sense? The only hurdle I can see from the planning stage is figuring out how to get the PIR to continuosly detect motion and reset the arduino's timer so the lights stay on while I am working in my workshop. Thanks for any input. I will be using a leonardo.

I can't comment on whether your power supply is adequate or appropriate for the lighting you envision (I'll leave that for someone else), but in broad strokes your plan is feasible.

Many PIR modules have settings that affect retrigger and duration, etc. You would need to read up on the sensor or module you are using.

I would put the have my PIR feed into the Aduino. Just a data feed. The Arduino handles the thinking. Arduino reads that the PIR sees something and switches a latching relay to activate the lights. Arduino can decide that once the lights go on they are on for two minutes or some set time no matter what the PIR says. After that the Arduino can periodically read the PIR and make another decision about what to do. Maybe 5 consecutive PIR readings 10 seconds apart indicating no motion and it turns the relay off. Maybe Arduino sounds a tone or blinks an LED prior to light shut off to double check whether you are still there and that it isn't the case that the PIR is stupid and doesn't see you because you haven't moved. Maybe if you wave your arms so the PIR generates a signal it gives you another 2 minutes before it starts polling the PIR again. All sorts of logic options.

A latching relay that wouldn't need to stay energized to keep the lights on would seem a good choice.

Doable.

Latching relay needs current pulses in 2 directions, one to latch, one to unlatch.
I'd just go with a Logic Level, Low Rds, Low Gate capacitance N-channel MOSFET to connect the LED string - signal to Gnd, while + connects to +12V.
PIR can trigger Arduino, arduino can turn on th strip(s) and start the timer when the PIR goes inactive.

I went with a relay because for some reason I was thinking AC power source. Duh.

Duck Duck Go tells me that is a DC compter type power supply. Yep, you could probably switch that direct with a MOSFET.

Hi, if you are using the ATX supply and the PIR and Arduino are powered by the standby supply, all you need to do is to get the PIR to output to the already powered up Arduino, the Arduino turns rest of power supply on.
This signal from the PIR also resets and starts a timer in the Arduino sketch,.
Each time the PIR is triggered by a body the timer resets, if the timer is not reset then it times out after say 10minutes, the sketch switches the rest of the supply off.

No complicated latching relays needed. [soapbox] Yuk I hate them. [/soapbox]

[soapbox] As for using ATX supply, I have seen very very few applications for the supplies except for powering computers, yet they are cheap. WHY?????
From ATX supplies I have seen, some regulate the high current 3.3V and or 5V rail, but not the 12V rails.
The supply although having "full regulation" is basically designed for almost constant load.
Worth a try because they are cheap, but I personally would leave them in a computer to filter the living room dust out of the air.
[/soapbox]

Tom...... :slight_smile:

TomGeorge:
No complicated latching relays needed. [soapbox] Yuk I hate them. [/soapbox]

[soapbox]Why would you hate them? Pulse on, pulse off, doesn't stay energized, not anymore complicated than a regular relay, what's not to like?[/soapbox]

http://www.seeedstudio.com/depot/Grove-2Coil-Latching-Relay-p-1446.html
http://www.ebay.com/itm/Latching-Bistable-Relay-module-5V-Relay-board-for-AVR-PIC-Arduino-from-EU-/171178593872
http://www.arduinoeverything.com/archives/138

I wanted to post back here with what I just tested as a working sketch for what I am trying to achieve.

I will update the blog in the sketch comments with pictures of the project.

Thanks for the guidance in getting this started. If you see anything that needs to be corrected or cleaned up, please let me know.

// Uses a PIR sensor to detect movement and if movement is detected close ledPin.

// This sketch is being used to operate the control wire of an ATX power supply.
// My ATX PS is currently driving 11 LED light strips (~19W each) via the 12V rail.

// When motion is detected, the arduino will close the ledPin which is connected to the control wire on the PS.
// The sketch will pause for 3 minutes after it sets the ledPin to close.
// After 3 minutes the sketch will continue to poll the inputPin every 3 seconds.
// If the inputPin is read as low, motion has been detected and the loop begins again.
// The PS will not turn off until there have been two minutes of no motion detected.
// This will effectively give a minimum 5 minutes of light when motion is initially detected.
// The lights will remain on until there have been 2 minutes of polling with no motion detected.
// more info here: http://www.wifi-secured.com
// email me at harrijs at gmail.com
// based upon:
// PIR sensor to detect movement by John Park


 
int ledPin = 13;                   // choose the pin for the control wire
int inputPin = 2;                      // choose the input pin (for PIR sensor)
int val = 1;                           // variable for reading the pin status
int count = 0;                         // counter for our timing

void setup() {
  pinMode(ledPin, OUTPUT);         // declare LED as output
  pinMode(inputPin, INPUT);            // declare sensor as input
  Serial.begin(9600);
}

void loop(){
  Serial.println("Loop Started");      // uncomment for debug information
  val = digitalRead(inputPin);         // read input value
  Serial.println(val);                 // uncomment for debug information
  Serial.println(count);               // uncomment for debug information
  if (val == HIGH) {                   // check if the input is HIGH
   digitalWrite(ledPin, LOW);    // turn ATX PS ON via control wire
    Serial.println("Lights On");
    delay(180000);                     // wait three (180000 ms) minutes before looking for additional motion
    count = 0;                         // reset counter for our timing
  }
      else {
        delay(3000);                   // set our delay time to 3 seconds
        count = count + 1;             // increment counter by one
      }
      while (count > 40) {             // counter will have to wait 2 minutes (3 seconds x 40 iterations = 120 seconds)
        digitalWrite(ledPin, HIGH); // turn LED OFF
        Serial.println("Lights Out");
        count = 0;                     // reset counter for our timing
      }
}

More information is needed about what voltage and current the leds need.
ATX power supplies only directly regulate the 5V rail, and the 3.3 and 12V rails are indirectly regulated,
but need a load on the 5V rail for any regulation to work at all.
Because the supply is rated at 280W doesnt mean it can supply 280W on a single rail.
The power rating is the sum of all the rails added together in the typical proportion that a computer motherboard needs.
If you want to use just one of the supply voltages, and not the others and want the one voltage regulated, you will have to modify
the supply and change the values of the sense resistors that control the PWM to the primary switcher.
Unless you have had previous experiance at doing this , I wouldnt use an ATX supply.

[soapbox]Why would you hate them? Pulse on, pulse off, doesn't stay energized, not anymore complicated than a regular relay, what's not to like?[/soapbox]

[soapbox]
Hi, the reason I don't like latching relays is because:

  1. They are mechanically latching, extra complexity in a simple device.
  2. No way, except with extra circuitry and I/O port to see what state they are in.
  3. Because it is a mechanical memory, turning the power supply off and the on, the relay stays in its toggled state, hence you need procedure 2) to check on power up the relay state.
  4. A Latching relay, SET output HIGH, RESET output LOW. WE ARE PROGRAMMERS, program the latching relay in software.
    [/soapbox]

Back to subject, as I said before regulation and ATX supplies, be careful, as echoed in previous post.

Tom...... :slight_smile:

Could you elaborate more on the regulation issue in using an ATX supply? I don't have enough experience to understand what the problem could be. Currently i am using a single 12V lead from the power supply and have each of the LED strips connected to it in series. Each strip consumes 18W. The arduino is being powered from the 5V standby on the PS. The only thing I am doing is turning the supply on with the control wire and then off again. What is the problem with an unregulated rail supplying the power to these LEDs? Thanks again for the help.

Bump for the night crew.

Theres nothing wrong if you dont need a regulated supply.
The 12V rail will vary depending on what load you connect to it, It will be low , ie less than 12V , and its not easy to know how much power it will supply before you cook the diode bridge for that rail.
If you keep the total power demand well below the supply maximum rating, say half its rating, it will work OK.