Hello guys!
Im working on a small project where I control 1 meter of WS2812S LED strip with a Pir sensor.
They are both working in each their own circuits, and when I try them together, they work fine if the DC5V+ from the LED IS NOT connected to the 5 volt on Arduino.
When I have both connected to the 5volt, the Pir sensor dosen't work, and when I disconnect the LED DC5V+ wire it works.
I think this is because the PIR sensor requires so much power so it can't share with the LED, but is this a problem i can fix by using transisters or other components? Or do i need to connect a second power supply?
What are you using as a power supply?
If you're using USB or the onboard regulator, that is not capable of supplying enough current for the LED strip - you need a larger 5v supply.
yes right now am I using the USB, but my strips have worked fine with that for testing. But it's not my LED strip which dosen't work but my PIR sensor.. But you think that supplying my LED strip with an external power supply should make my PIR sensor work?
To give proper advise you have to post the facts.
Which WS2812S LED strip (there are many). How many LEDs (length).
USB power is <500mA. That means TEN 60mA LEDs are able to trip the fuse.
A PIR sensor runs on fumes (<100uA).
Post your code (inside code tags).
Leo..
Sure.
The LED RGB strip is a: WS2812S 60-LED / M. DC5V, 14,4W/M, IP20.
I dont know exactly which PIR sensor model im using, but i looks like the one on the image
As i mentioned before my Pir sensor is working in the following code when my LED strip is NOT connected to the 5V USB onboard. When i connect the strip the Pir stops working, but the LED works fine.
this is my code:
int pirPin = 8;
int ledPin = 13;
int calibrationTime = 10;
unsigned long previousMillis = 0;
const long interval = 500;
int speedValue = 20;
const long pause = 2000;
boolean lockLow;
void setup(){
Serial.begin(9600);
pinMode (ledPin,OUTPUT);
pinMode(pirPin,INPUT);
Serial.print("calibrating sensor ");
for(int i = 0; i < calibrationTime; i++){
Serial.print(".");
delay(1000);
}
Serial.println(" done");
Serial.println("SENSOR ACTIVE");
delay(50);
}
void loop(){
pirSensor();
}
void pirSensor(){
unsigned long currentMillis = millis();
if(digitalRead(pirPin) == LOW){
lockLow = true;
if(currentMillis - previousMillis >= interval){
previousMillis = currentMillis;
speedValue--;
speedValue = constrain(speedValue,0,20);
}
}
else if(currentMillis - previousMillis >= pause){
lockLow = false; }
if(!lockLow){
if(currentMillis - previousMillis >= interval){
previousMillis = currentMillis;
speedValue += 2 ;
speedValue = constrain(speedValue,0,20);
}
}
Serial.println(speedValue);
}
How does it "stop working"? What is the symptom?
Frankly, I have no idea how it isn't tripping the polyfuse and reseting the moment you (try to) turn the lights on, if it's only power is the Arduino usb...
When the PIR sensor detects movements the "speedValue" is decreased. When I connect the LED to the 5V the PIR stops reacting to movement.. however the LED is working as it should.
Is it a PIR sensor with two trim pots.
Did you adjust the "time" fully anti-clockwise.
And left the "sensitivity" in the center position.
Even if you have the "time" pot fully anti-clockwise, it can take ~five seconds for the PIR to reset.
Fully clockwise might be ~seven minutes.
You did not tell us how long your LED strip is.
More than 10 LEDs could be dangerous for your USB port.
Leo..
The PIR sensor has no trim pots. I attached a photo of it. As mentioned, the PIR sensor works as it should when the LED is NOT connected to 5V.
And as i wrote previously I'm using a one meter long LED strip, which has 60 LEDS pr. Meter.
torekndsen:
The LED RGB strip is a: WS2812S 60-LED / M. DC5V, 14,4W/M, IP20.
So im using 60 LED's. thx for the warning.
torekndsen:
The LED RGB strip is a: WS2812S 60-LED / M. DC5V, 14,4W/M, IP20.
torekndsen:
And as i wrote previously I'm using a one meter long LED strip, which has 60 LEDS pr. Meter.
I think I missed the 1meter part...
1meter of strip could use upto 3Amp (the 14.4watt part).
USB tops at 2.5watt.
Your 5volt supply might be drooping, and the sensor might not like that.
Measure the 5volt pin.
Leo..
Your code has no code to drive the LED strip. If you just connect the strip to 5V then you could get any number of LEDs coming on. This is too much for your power supply, use an external one.