Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Reading the Digital Input Ports


Best Answer TechnoGuy, 19 September 2015 - 09:10 AM

Hi.  I found documentation on that sensor here:  http://simplytronics...?title=ST-00081

 

It just says that the OUT pin goes HIGH when motion is detected and that it remains LOW when there is no motion.  I really don't think there's much more to it than that - so I don't follow what you're asking (i.e. "read the variable input values").

 

The documentation includes some demo Arduino code which just implements a wait loop & checks the pin every 200 ms.

 

On the Netduino you can do better than that by implementing code that's event-driven (i.e. InterruptPort).  A fellow named Dave Vanderwekke has a nice tutorial / code sample (which I think you could adapt to your purposes) here:

 

http://www.davevande...-to-use-buttons

 

Just substitute your sensor for the button (in his example).  You may have to make a few tweaks.

 

 

Now, if you're looking to get distance information, that's probably NOT the right sensor to be using...  There are other PIR sensors out there that return distance information as well as detecting motion/obstacles.  Check out a company called MaxBotix.  Their distance-measuring sensors have several more pins and report distance using either serial or PWM.  Here's a datasheet for one of their modules:

 

http://www.maxbotix....Z_Datasheet.pdf

 
If I've totally missed the point of your request, I apologize.  In that case, please clarify...
Go to the full post


  • Please log in to reply
2 replies to this topic

#1 rkdF250

rkdF250

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationDFW Texas

Posted 19 September 2015 - 03:00 AM

Can anyone provide me with some sample code on how to read a digital port ( D0 for example).  I found plenty of examples setting up the port using the interrupt for a High Low type event.  However what I need is to be able to read the variable input values from a IR sensor.  The sensor in question is a Parallax Wide Angle PIR Motion Sensor #28032-RT.  Any help will be greatly appreciated.

 

 



#2 TechnoGuy

TechnoGuy

    Advanced Member

  • Members
  • PipPipPip
  • 51 posts
  • LocationCanada

Posted 19 September 2015 - 09:10 AM   Best Answer

Hi.  I found documentation on that sensor here:  http://simplytronics...?title=ST-00081

 

It just says that the OUT pin goes HIGH when motion is detected and that it remains LOW when there is no motion.  I really don't think there's much more to it than that - so I don't follow what you're asking (i.e. "read the variable input values").

 

The documentation includes some demo Arduino code which just implements a wait loop & checks the pin every 200 ms.

 

On the Netduino you can do better than that by implementing code that's event-driven (i.e. InterruptPort).  A fellow named Dave Vanderwekke has a nice tutorial / code sample (which I think you could adapt to your purposes) here:

 

http://www.davevande...-to-use-buttons

 

Just substitute your sensor for the button (in his example).  You may have to make a few tweaks.

 

 

Now, if you're looking to get distance information, that's probably NOT the right sensor to be using...  There are other PIR sensors out there that return distance information as well as detecting motion/obstacles.  Check out a company called MaxBotix.  Their distance-measuring sensors have several more pins and report distance using either serial or PWM.  Here's a datasheet for one of their modules:

 

http://www.maxbotix....Z_Datasheet.pdf

 
If I've totally missed the point of your request, I apologize.  In that case, please clarify...

- Ian

 

My Current Dev Boards:

  • 3 x Netduino Plus 2
  • 1 x Netduino 3 WiFi

#3 rkdF250

rkdF250

    New Member

  • Members
  • Pip
  • 4 posts
  • LocationDFW Texas

Posted 19 September 2015 - 11:47 PM

Thanks for the information... I am definitely a newbie at this and actually got everything working an hour after posting this except for the distance measurement.  I really wanted the distance measurement as a bonus and will now look into the other sensors you recommended.  Like everything else I do, I am over engineering this thing. The Parallax sensor is working great for detecting animals and people without being tripped by other moving objects. The interrupt events is one of the main reasons I am using the netduino.   :rolleyes:    






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.