How to Connect a Motion Detector to a PICAXE

Written by julia chan
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Connect a Motion Detector to a PICAXE
Use ultrasonic range sensors to detect movement. (Hemera Technologies/ Images)

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.

Skill level:
Moderately Challenging

Things you 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 MoreHide


    Build the Prototyping Environment

  1. 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. 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. 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

  1. 1

    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.

  2. 2

    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.

  3. 3

    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.

Tips and warnings

  • If you have access to a PICAXE experimenter's board, then you will save time in the building of the upload circuit.
  • Observe polarity of all components to avoid damage

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.