After doing a lot of searching for information on the HY-SRF05 ultrasonic distance sensor (the Chinese HC-SR05 clone available on eBay) and how to use it, I thought I'd post here with the information that I collected. Maybe it will be of use to someone in the future.
Attached is the Chinese datasheet for the module, which I translated as best I could into English. The datasheet is split into two parts so that it will fit within this forum's file size limits. The module's circuit schematic (with a few annotations about the major components) will follow in a subsequent post.
The code that I used for this module is as follows (08M2 at 4MHz) (PULSIN):
The ULTRA and PULSOUT commands have been shown to work also. Those would look like this:
The first code block above is what I tried first, based on an example I found elsewhere; it worked, so I used it.
My circuit uses a single PICAXE pin to send the trigger pulse and read the reply. I wired the module's TRIG pin to C.1, then also tied the ECHO pin to C.1 through a 1.8kΩ resistor (as suggested in other threads here). This worked perfectly as an emulation of the genuine HC-SR05's single-pin mode.
Attached is the Chinese datasheet for the module, which I translated as best I could into English. The datasheet is split into two parts so that it will fit within this forum's file size limits. The module's circuit schematic (with a few annotations about the major components) will follow in a subsequent post.
The code that I used for this module is as follows (08M2 at 4MHz) (PULSIN):
Code:
symbol DistSensor = C.1
symbol Distance = w0
high DistSensor
pulsin DistSensor,1,Distance
Code:
symbol DistSensor = C.1
symbol Distance = w0
ultra DistSensor,Distance
Code:
symbol DistSensor = C.1
symbol Distance = w0
pulsout DistSensor,1
pulsin DistSensor,1,Distance
My circuit uses a single PICAXE pin to send the trigger pulse and read the reply. I wired the module's TRIG pin to C.1, then also tied the ECHO pin to C.1 through a 1.8kΩ resistor (as suggested in other threads here). This worked perfectly as an emulation of the genuine HC-SR05's single-pin mode.
Attachments
-
812.8 KB Views: 16
-
597.3 KB Views: 14