I can't find a specific topic covering the following.. I get my 3W LED to light up with the activation of the motion sensor using code provided. What I don't understand is that the LED sometimes light up without ANY movement in front of the motion sensor? It runs smooth from the pc's USB power supply, but once I connect it to a powerbank (the culprit?) it lights up when it shouldn't..
How is the sensor wired up? Is the input floating when it is not HIGH?
It may be better if you had pinMode (SENSOR_PIN, INPUT_PULLUP) and then a sensor that made the line LOW when there was something sensed, but that depends on your sensor, which you have not described.
Thanks for the quick response. It's the PIR sensor, 2m-7m range (not the tiny variant). I think the issue was the powerbank. I even connected my two lithium batteries (18650 × 2) I'm using for the 1st time and there is no false alarm anymore. Only last week I learned how a bad powersupply (car battery) can screw with its systems.. the Arduino/sensor "world" seems to be very alike in that way. I should really do an Arduino course, I'm just not sure which one.. I'll check the forums on that topic.