Trying to connect a motion sensor to the spark

I need to buy a motion sensor to control LEDs and i duno which sensor would be compatible with the spark
these are my list of options I’d appreciate it if some one share their opinion

Thank you

I’m not sure if there’s a big operational difference between those. Personally, I just bought the cheapest I could find on aliexpress, was like $10 for 10 of them… They seem to work just fine. eBay has a bunch of those things as well.

so any of them will work on the spark with no problem ?!

If you look at the description, you’ll notice that all they do is switch a logical state. They go from HIGH -> LOW or LOW -> HIGH upon detected motion. You can easily check for this using digitalRead, or by using an interrupt. So yeah, you should be good with any of those. Like I said, Ebay has quite a few of them as well, for a much lower price. Worthwhile checking out, if you don’t mind the increased delivery time.

Yeah, like @Moors7 said, you can just buy a bunch of them cheap on eBay, and they should work fine. That’s what I did. You can get them much cheaper than those that you linked to. And yes, I’ve actually tried one with a Spark, and it worked fine.

Here’s some sample code:

 * Connected sensor
 * Spark.publish() + PIR motion sensor = awesome
 * Thanks to Adafruit for the reference and inspiration

int inputPin = D3;              // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
int val = LOW;                  // variable for reading the pin status
int calibrateTime = 10000;      // wait for the thingy to calibrate

void setup() {
  pinMode(inputPin, INPUT);     // declare sensor as input

void loop(){
  if (calibrated()) {

bool calibrated() {
  return millis() - calibrateTime > 0;

void readTheSensor() {
  val = digitalRead(inputPin);

void reportTheData() {
  if (val == HIGH) {
    if (pirState == LOW) {
      // we have just turned on
      Serial.println("Motion detected!");
      // We only want to print on the output change, not state
      pirState = HIGH;
  } else {
    if (pirState == HIGH) {
      // we have just turned of
      Serial.println("Motion ended!");
      // We only want to print on the output change, not state
      pirState = LOW;

The PIR should have a couple of pots that you can adjust with a small screwdriver to change the motion sensitivity and the delay after a trigger before the PIR will allow a new state change.