Problem with SRF005 on 14M2

Wasserflo

Member
Hi all,
I have here some 8M2 and 14M2.
I tried to measure the distance on a 8M2 with a SRF005 and it works great with this code:

Code:
symbol trig = C.1             ; Define pin for Trigger & Echo (All M2, X2 parts)
symbol echo = C.2
symbol range = w1             ; 16 bit word variable for range

main:    pulsout trig,2             ; produce 20uS trigger pulse (must be minimum of 10uS)
    pulsin echo,1,range         ; measures the range in 10uS steps
    pause 20            ; recharge period after ranging completes

    ; now convert range to cm (divide by 5.8) or inches (divide by 14.8)
    ; as picaxe cannot use 5.8, multiply by 10 then divide by 58 instead

    let range = range * 10 / 58    ; multiply by 10 then divide by 58
    debug range            ; display range via debug command
    goto main
But when I try to use it on a 14M2 I get no results.
I also tried to use the pins B.1 and B.2 on the 14M2 but it also doesn't help.
Anyone knows what I'm doing wrong here?

Cheers
Florian
 

AllyCat

Senior Member
Hi,
I also tried to use the pins B.1 and B.2 on the 14M2 but it also doesn't help.
Welcome to the forum. Yes that's what I would have expected the solution to be. But did you try changing the Program symbol lines to:
Code:
symbol trig = b.1             ; Define pin for Trigger & Echo (All M2, X2 parts)
symbol echo = b.2
and using the two pins on the same side of the PICaxe as the Serial Output and GND pins? Then you should be able to plug in either an 08M2 or a 14M2 and both should work without any other changes (because the pins on the 08M2 may be named as port B or port C). There are "subtle" differences between the pins on the 08M2 and 14M2 chips, but I wouldn't expect them to affect the issue here. What type of prototype/breadboard are you using?

Cheers, Alan.
 

Technical

Technical Support
Staff member
Make sure you are connecting directly to the PICAXE pin and not via a buffered output on a project board.
 

Wasserflo

Member
I'm using the prototype board from the german Make magazine.
They are selling a special Make for the Picaxe.
But I have also tried to use it inside a 'normal' breadboard, without buffering anything.
Still nothing.
I have also made sure with a blink program that I'm in fact using the correct ports.
And a Servo motor is working as expected on the same PINs.
I will also ask the guys from the Make magazine if they have any idea here.
 

AllyCat

Senior Member
Hi,

A photo of the PCB could be helpful; is it for 14+ pins PICaxe M2 chips, and have an IC socket?

Have you confirmed that with the program changed to Port B and the SRF005 connected to port pins 2 and 1 (Legs 5/11 and 6/12 on 08/14M2) then the program works with an 08M2 plugged in, but not with a 14M2?

Cheers, Alan.
 

Technical

Technical Support
Staff member
Is it an original SRF005 or a chinese clone like HY-SRF05?

If it is the low quality clone version using single pin mode may be better

 

Wasserflo

Member
I have attached now two pictures from the PCB.
As already said, 8M2 is working (with c.1/c.2 in the code)
14M2 is not working (with b.1 / b.2 in the code)
I have also tried a hc004.
It's working with the 8M2, but not with the 14M2.
I have also tried to put it direct on a breadboard without the PCB.
Also not working.

Any ideas?
 

Attachments

premelec

Senior Member
In the second picture the 2 upper right wires do not appear to be connected to the PICAXE... which is strange considering that one is the 08M2 unit... perhaps a clear picture set... anyhow likely some hardware problem...
 

neiltechspec

Senior Member
That must be wrong connections, the IO pins your using are on opposite sides of the chips.
C.1 & C.2 on the left on 14M2, B.1 & B.2 on the right on 08M2.
They cannot be on the same connections on whatever PCB that is.

Neil.
 

Wasserflo

Member
Hi Neil,
I can't follow you.
The pic's inside the editor and the manual says, that the C.1 on the 8M2 and the B.1 on the 14M2 are at the same location.
I have also attached a pic from the PCB.
The white numbers shows what is printed on the board and the black numbers how they have connected the ports for 8M2 and 14M2.
So I don't think this is a hardware problem.
And as I mentioned before, I have tested the PINs with some LEDs and with Servo motor. And both are working on these PINs.
But technical wrote here earlier
Is it an original SRF005 or a chinese clone like HY-SRF05?
It's in fact a cheap clone.
So maybe I should try a new one.
 

Attachments

neiltechspec

Senior Member
No idea what that pcb is, but certainly doesn't follow the chip pinouts.

I suggest you look at PICAXE Manual 1 for the pinouts & buzz them out with a meter.

You could put a LED (with appropriate resistor) onto the trigger output C.1 (or B.1) and see it it gives a brief flash.

Neil.
 
Last edited:

AllyCat

Senior Member
Hi,
I have also attached a pic from the PCB.
The white numbers shows what is printed on the board and the black numbers how they have connected the ports for 8M2 and 14M2.
We really need to see how the tracks are run on that PCB, but the pin arrangement does seem very "strange". Assuming that the PICaxe's Pin 1 is always at the top-right (NE) of the board, then all the port.pin names appear to be "twisted" or mirrored, which would make the track layout very complex. Is the view shown from the "components" or the "solder" side of the PCB?

Maybe that board has been arranged to be "compatible" with an Arduino Nano pinout, but the tracks would need to be very narrow and run parallel for long distances, so there is a risk of "crosstalk" between the pins. Since you appear to have a regular solderless breadboad, I would be tempted to try your "SRF005" and the PICaxe 08M2 and then the 14M2 connected directly into the solderless breadboard.

Cheers, Alan.
 

Wasserflo

Member
Got today a new US-100 (similar to the SRF004) and it works great with the 8M2 and the 14M2
Don't know what the problem is with the China clone SRF004 and SRF005.
 
Top