Sparkfun PIR motion sensor
#1
Posted 03 January 2011 - 02:55 PM
Connection diagram by Jorge-EE :
RingTonePlayer by Hari + OZ-Solutions
And heres complete code Motion_Sensor.zip 69.98KB 209 downloads
Enjoy!
Vincent
#2
Posted 11 September 2012 - 11:06 PM
I just got PIR motion sensor from sparkfun and decided to give it a try right away. so heres result
Connection diagram by Jorge-EE :
RingTonePlayer by Hari + OZ-Solutions
And heres complete code Motion_Sensor.zip 69.98KB 209 downloads
Enjoy!
Vincent
Good day,
I see VincentA is using a resistor, same as the arduino example below:
http://bildr.org/2011/06/pir_arduino/
But I can't get it to work with my N+, can someone please tell me how to wire it correcly? Can I use any of the 14 digital inputs?
Thanks in advance
#3
Posted 12 September 2012 - 01:26 AM
#4
Posted 12 September 2012 - 02:05 AM
#5
Posted 12 September 2012 - 05:28 AM
If you take the time to look at the Code in the ZIP file that VincentA so nicely attached you will see he is using GPIO_PIN_A0.
My wiring is the same as VincentA is suggesting and I am using the code provided in the zip file but I just realized I am using a 10 ohms resistor instead of a 10,000 (10K) ohms resistor, so that pretty much is the problem but still I got a question, VincentA is using an analog port wether the Arduino example provided above uses digital por # 2, why is that? And one last question. Can I use any of the 3 GND pins for the brown wire (1 from the digital side and 2 from the Analog side) ?
#6
Posted 12 September 2012 - 08:42 AM
I use a different sensor, but have an event driven class I use. Should work the same.
using System; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; namespace MyApp.HardwareUtility { public delegate void PIRTriggeredEventHandler(bool triggered, DateTime time); public class PIRSensor { private InterruptPort _sensor; public event PIRTriggeredEventHandler SensorTriggered; /// <summary> /// Initializes a new instance of the <see cref="PIRSensor"/> class. /// </summary> /// <param name="portId">The port id.</param> public PIRSensor(Cpu.Pin portId) { _sensor = new InterruptPort( portId, false, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth); _sensor.OnInterrupt += new NativeEventHandler( (data1, data2, time) => { OnSensorTriggered(data1, data2, time); } ); } /// <summary> /// Called when [PIR triggered]. /// </summary> /// <param name="data1">The data1.</param> /// <param name="data2">The data2.</param> /// <param name="time">The time.</param> protected void OnSensorTriggered(uint data1, uint data2, DateTime time) { var evt = SensorTriggered; if (evt != null) evt.Invoke(data2 == 1, time); } } }
Then I use this code in my program:
PIRSensor pir = new PIRSensor(Pins.GPIO_PIN_D4); Thread.Sleep(2000); //Warmup Time pir.SensorTriggered += new PIRTriggeredEventHandler(pir_TriggeredEvent); static void pir_TriggeredEvent(bool triggered, DateTime time) { Debug.Print("PIR: Triggered"); }
#7
Posted 12 September 2012 - 02:49 PM
Thanks for your response. I am going to try out your code but one question though, are you using the 10K Ohms resistor as suggested in the example? I was using a 10 Ohms instead of a 10K Ohms, I am going to get a 10K today to try it out but the question is, do you think I burned my sensor using the wrong resistor?
This is the hardware I got:
https://www.sparkfun.com/products/8630
#8
Posted 12 September 2012 - 04:47 PM
Hi Dave,
Thanks for your response. I am going to try out your code but one question though, are you using the 10K Ohms resistor as suggested in the example? I was using a 10 Ohms instead of a 10K Ohms, I am going to get a 10K today to try it out but the question is, do you think I burned my sensor using the wrong resistor?
This is the hardware I got:
https://www.sparkfun.com/products/8630
I am not as it is built in to the sensor I am using. It depends on the sensor you are using. The sparkfun one does need the pullup resistor or the levels won't change.
#9
Posted 12 September 2012 - 07:27 PM
I am not as it is built in to the sensor I am using. It depends on the sensor you are using. The sparkfun one does need the pullup resistor or the levels won't change.
Got it, I'll keep you posted of my findings.
#10
Posted 13 September 2012 - 06:23 PM
Got it, I'll keep you posted of my findings.
Hi Dave,
I tried the Sparkfun PIR Motion Sensor - SEN-08630 with a 10K Ohms resistor but I am not getting any readings. Do you think I have fried the sensor somehow when mistakenly I was using the 10 Ohms resistor instead? By the way, the resistor goes from 5V+ (Pin 1) to Alarm (Pin 3).
https://www.sparkfun.com/products/8630
http://www.sparkfun....imity/SE-10.pdf
http://bildr.org/2011/06/pir_arduino/
#11
Posted 13 September 2012 - 07:01 PM
Hi Dave,
I tried the Sparkfun PIR Motion Sensor - SEN-08630 with a 10K Ohms resistor but I am not getting any readings. Do you think I have fried the sensor somehow when mistakenly I was using the 10 Ohms resistor instead? By the way, the resistor goes from 5V+ (Pin 1) to Alarm (Pin 3).
https://www.sparkfun.com/products/8630
http://www.sparkfun....imity/SE-10.pdf
http://bildr.org/2011/06/pir_arduino/
Do you have a multi-meter to measure the voltage? You should be able to simply test from GND to the ALARM wire. You should see it switching between 5 and 0 volts when triggered.
#12
Posted 13 September 2012 - 11:48 PM
Do you have a multi-meter to measure the voltage? You should be able to simply test from GND to the ALARM wire. You should see it switching between 5 and 0 volts when triggered.
Thanks for the suggestion Dave, I will try that tonight. So I guess if I don't see any fluctuation, then the sensor is either bad or fried, right?
#13
Posted 14 September 2012 - 04:59 AM
#14
Posted 14 September 2012 - 07:15 AM
#15
Posted 14 September 2012 - 07:40 PM
Try to disconnect the sensor from the 5v and measure the 5v --> GND Again on the Netduino+ just to be sure the board is ok.
That's what I did. I unplugged the sensor and I read no power at all, well .0L which I think means open or infinite.
I think it is giving some power because I can read From GND to ALARMS there are 2.8v constantly. From GND to 5V+, there are 2.1v constantly. Coincidentaly 2.8v+2.1v = 5volts. There is gotta be something in the board that triggers the power to go on or off, very strange huh?
#16
Posted 14 September 2012 - 11:51 PM
That's what I did. I unplugged the sensor and I read no power at all, well .0L which I think means open or infinite.
Giuliano,
Most multi meters that I have use 0L would mean overload or over ranged, does your meter have auto scaling? If not check that the meter is not in a milli volt range.
Most meters would indicate a voltage (in milli volt range) when not connected just from RF radiation.
Check your meter against a none source such as a AA battery, make sure you use a DC scale not AC. It should read about 1.5 vdc.
As far as the netduino you can hook a wire from the 3.3 volt header to the input pin that would be connected to the alarm. Then move the wire from the 3.3 volt header to ground. If program senses the change the netduino should be good.
Good luck,
Chuck
#17
Posted 15 September 2012 - 01:31 AM
Giuliano,
Most multi meters that I have use 0L would mean overload or over ranged, does your meter have auto scaling? If not check that the meter is not in a milli volt range.
Most meters would indicate a voltage (in milli volt range) when not connected just from RF radiation.
Check your meter against a none source such as a AA battery, make sure you use a DC scale not AC. It should read about 1.5 vdc.
As far as the netduino you can hook a wire from the 3.3 volt header to the input pin that would be connected to the alarm. Then move the wire from the 3.3 volt header to ground. If program senses the change the netduino should be good.
Good luck,
Chuck
Hi Chuck,
You're a genius.
I got a Craftsman professional multimeter but I does't automatically auto scale. I change the scale manually and now it reads 4.8V in the 5V pin and 3.3 in the 3.3 pin. That said, seems like my sensor is not good anymore. Placing another order in sparkfun.com
Thanks.
#18
Posted 18 September 2012 - 03:18 AM
Question, does this PIR sensor works even in low light conditions?
https://www.sparkfun.com/products/8630
#19
Posted 18 September 2012 - 07:51 AM
#20
Posted 27 September 2012 - 02:15 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users