Introduction: LinkitONE Motion Sensor

About: I build products which solve real world problems.

Ever wanted to build something cool with electronics? Want to make your own security alarm where you are notified when motion is detected? Got a LinkitONE board? Then you are at the right place!

Here i'll show you how to make a simple motion sensor, (I use PIR sensor) which sends a message to your computer via serial that a motion is detected.

Let's begin...

Step 1: What Do You Need?

1) LinkitONE Board

2) PIR Motion Sensor

3) micro-USB cable (for programming board)

4) Battery pack

5) Some jumpers

6) A breadboard (you can do this project without it)

Step 2: Assembling the Parts

Here i'll show you how to assemble your sensors with the board.

First, take your sensor, you'll see 3 pins in it-

1) GND

2) DATA

3) VCC

Connect your sensor to a breadboard and then connect the GND pin to GND pin of your linkit, VCC to 5V, and DATA pin to A0 pin.

Finally connect everything and lets move on to the next step!

Step 3: Updating Board's Firmware

If your board's firmware is old, you'll need to update it to use it properly, so download the latest firmware updater from the Mediatek's website.

To update the Board's Firmware, open the "firmware updater" software that you installed in the last part in the previous step. Once open, Make sure that the switches on the board are in the right position for updating firmware; MS for the MS--UART, USB for the USB--Battery switch, and SPI for the SPI--SD switch. Plug your board into your computer, then click "Download". It will now begin downloading and installing the latest firmware for your board.

Step 4: Writing Some Code

The code is really simple here! There's nothing much!

We're just reading the value coming to A0 pin, if the sensor returns motion, we are sending "Motion Detected" message to the computer.

CODE:

------------

int Sensor_Pin = A0;

void setup()

{ Serial.begin(9600);

}

void loop(){

int SensorReading = digitalRead(Sensor_Pin);

if(SensorReading == 1)

{


Serial.println("Motion Detected!!!");

}

delay(250);

}

------------

Okay, so now burn this code to your board.

Step 5: Testing It Out!

Now test your device!

Just burn the code on your board from the previous step and then start! Open the serial monitor on the modem port of your Linkit. Carefully observe your readings. They update every 1/4 seconds. You can even plot a graph using opensource tools available online such as plotty or ubidots.

Step 6: Final Touches

Congrats! You've built your own motion detector!

You can also place it on your laptop and check your motion :D

Now make a motion detection box!

Just place it in your switchboard just as shown in the image! You'll have a lot of fun with it sensing motion.

Now make a dog monitor :P