Hobbies And Interests
Home  >> Science & Nature >> Science

How to Connect a Motion Detector to a PICAXE

For many micro-controller applications, the ability to detect movement can be a key feature in the operation of the system and the coordination of outputs. You can detect movement through a variety of methods, the simplest of which is to use simple tactile switches; however, this method requires moving objects to physically touch the sensor. Remote sensing may be a better approach, more suitable for a wider range of situations. To accommodate this, the PICAXE company produces an ultrasonic range sensor which you can easily interface with a variety of PICAXE microprocessors.

Things You'll Need

  • Electronics breadboard &jumper leads
  • Soldering iron &solder
  • SRF005 ultrasonic range sensor
  • 08 series PICAXE microprocessor &standard upload circuit components
  • Computer with PICAXE BASIC software
  • Data connection lead
Show More

Instructions

  1. Build the Prototyping Environment

    • 1

      Solder the supplied connection pins to the SRF005 ultrasonic range sensor. The connection pins are a five pin jumper and fit into the five holes in the sensor's circuit board. This allows you to breadboard the sensor without making any further permanent connections.

    • 2

      Build the standard PICAXE upload circuit on your breadboard. Consult your PICAXE documentation for details of how to do this. Ensure that you add the smoothing capacitor for the most reliable operation.

    • 3

      Connect the range sensor via jumper leads to your PICAXE 08 series micro-controller. There are four connections on the range sensor: positive and negative power, echo output and trigger input. Connect the echo output to a PICAXE input pin and the trigger input to a PICAXE output pin.

    Testing Operation

    • 4

      Program the PICAXE BASIC software with the sample code from the SRF005 datasheet. Upload this code to the PICAXE microprocessor on your breadboard using the data connection cable.

    • 5

      Connect a power supply to your circuit and test the operation of your sensor. You should be able to check the values of the variables by looking at the debug mode of the BASIC software.

    • 6

      Modify the code to suit your application. The range sensor is very accurate and can detect the width of a broom handle at a distance of three meters, so basic motion sensing is not a problem. Experiment with code and look for support in the PICAXE online forums to fine tune the operation of your circuit to your exact needs.


https://www.htfbw.com © Hobbies And Interests