Using Raspberry Pi to drive motion sensor and turn on LED

Byamber

Using Raspberry Pi to drive motion sensor and turn on LED

Objective:

In this project, we will use a Raspberry drive motion sensor and LED. When motion is detected, motion sensor will send signal to Raspberry Pi GPIO port and then turn on LED. We will use C and wiringPi libary to handle GPIO signals.

Circuit Graph:

motion_pi

Software Installation:

1)Install git core(if you have already installed git core, please skip this step). Please run following shell command in Pi terminal:

sudo apt-get install git-core

sudo apt-get update

sudo apt-get upgrade

2)Install wiringPi libary(if you have installed wiringPi, please skip this step). Please run following command in Pi terminal:

git clone git://git.drogon.net/wiringPi

cd wiringPi

./build

3)Download/compile blink.c and run the program as following:

wget –no-check-certificate http://osoyoo.com/blink.c

gcc -Wall -o blink blink.c -lwiringPi./blink
Result as following:When you use your hand to block photoresistor light, the LED will turn on.

About the Author

amber administrator

You must be logged in to post a comment