LinkitONE Motion Sensor

by ssarthak598 in Circuits > Arduino

634 Views, 9 Favorites, 0 Comments

LinkitONE Motion Sensor

IMG_0857.JPG

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...

What Do You Need?

IMG_0853.JPG

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)

Assembling the Parts

IMG_0854.JPG
IMG_0855.JPG

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!

Updating Board's Firmware

images.jpg

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.

Writing Some Code

Capture.PNG

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.

Testing It Out!

Capture.PNG

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.

Final Touches

IMG_0858 (1).JPG
pir-human-body-motion-sensor-switch-for-lighting-500x500.jpg

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