PDA

View Full Version : PIR Sensor on BS2 PBASIC 2.0



lowellbert
10-02-2008, 05:49 AM
Hello there.

I am building a project that uses the PIR Sensor www.parallax.com/Store/Sensors/ObjectDetection/tabid/176/ProductID/83/List/1/Default.aspx?SortField=ProductName,ProductName (http://www.parallax.com/Store/Sensors/ObjectDetection/tabid/176/ProductID/83/List/1/Default.aspx?SortField=ProductName,ProductName)

The Sensor is going to be controlling a fan, when the sensor is triggered the fan will turn on, (basically when a person enters the room).
When the person leaves i want it to turn off.

Where i need help is writing the source code. i am still a little new at writing code and any help would be greatly appreciated

I am using
BS2
PBasic 2.0

Franklin
10-02-2008, 05:58 AM
Show us what you have or think will work and we can give you help. Or do you want someone to write your program for you? You should go out and get the latest version of the editor from the website.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

Mike Green
10-02-2008, 06:02 AM
You need to start with the various tutorials (like "What's a Microcontroller?") that you can download from Parallax. Go to their main webpage, click on the Resources tab, then select Downloads, then Stamps in Class Downloads. You'll see a list of tutorials.

Also, from Resources choose Nuts and Volts Columns which is another great resource for sample programs and all kinds of circuit diagrams. Download and look at #6 which is on controlling things like DC fans with a Stamp using an external switching transistor. If you plan to control an AC fan, you'll need a solid state relay (SSR) which behaves a lot like an LED and there are plenty of examples in "What's a Microcontroller?" and other tutorials of controlling an LED. The PIR sensor is not very different from other sensors that provide a switch closure or logic level on/off signal. Most of the code examples for using pushbuttons or other switches will work with a PIR. The modulated IR detector also works much like the PIR, just slower.

LilDi
10-02-2008, 10:06 AM
May the force be with you Mike Green!!
I went and bought a real nice home intrusion PIR unit. It blew me away for about $45.00. It was blue tooth as well. I could be all the way across the room in the kitchen, with a light ficture overhang in front of me (all the PIR could see was a very narrow view of the kitchen, and all I had to do was wave my hand and it would go off.
That, of course would spoil the best part. Exploration, knowledge, and curiosity. Explore both points of view is what Mike would say.