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
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.
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.
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.
Build the Prototyping Environment
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.
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.
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
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for