Let's Make Robots!

How to connect SRF05 to Picaxe 28 pin Project board

  • Sensors / input devices:

If you are a newbee, you may only have learned that the Picaxe 28 pin Project Board has some inputs and outputs.. And you may have purchesed an SRF05 (that Picaxe refers to as SRF005), and you are trying to connect the darn thing.. without resoult?

Reason is likely to be that you are connecting the output from the Picaxe to the SRF05 through the darlington on the board.

The SRF05 needs (like many other things) a Pulse-signal, not just a "power on / off". The signal therefore must come directly from the Picaxe chip.

Luckely the board has little "hidden" holes for that kind of conections. (Blue wire, the signal in to the SRF05 directly from the chip). These holes, however, are not described, simply omitted in the manual for the board. So I wonder how a newbee should ever find out, personaly I burned a SRF05 or two in my frustrated attempts to get it right :)

If you follow the illustration above, you should be able to make the below code work just fine. You will know that the SRF05 is getting a pulse-signal when the little red LED on it´s back is flashing red.


symbol trig = 3 ‘ Define output pin for Trigger pulse
symbol echo = 6 ‘ Define input pin for Echo pulse
symbol range = w1 ‘ 16 bit word variable for range

pulsout trig,2 ‘ produce 20uS trigger pulse (must be minimum of 10uS)
pulsin echo,1,range ‘ measures the range in 10uS steps
pause 10 ‘ 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 ‘ and around forever



I did not have a fresh SRF05, and so there are drilled extra holes and soldered pins on the one on the picture.

Be aware that if you also connect servo(s) to the same Picaxe chip, program execution may be bumpy with little iregular breaks when using things as the SFR05 that needs pulses. If it is important for you to have a steady program execution, or if a servo acts totally irrational, it sometimes helps to have a smal pause or turn off a servos pulse for a short time in the code:

"low 3" or "pause 10". Aparently there is no system, it is just trial and error with your particular setup.


These pages might have your interest: See what Robot Sees, 28 pin Project Board (AXE020), Picaxe for dummies




Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Hmmm... I have connected the srf-05 as in the picture, but the little red led on the srf-05 is blinking constantly as soon as i tell my motors to go any direction.  I have tried to put "low 3" before and after the "highs" and "lows" that makes my robot drive forward, but no it makes no difference.

Make one thing work at a time.

Then hook up more things.



Could you teach me how to connect an second SRF05 to the board?

Just do the same with everything.. but chose other ports (connections / pins on the board), other variables (b0, b1, wo, w1 etc) in the code.

Hi, I'm new here

Do I need to solder header pins to the sensor since there is no pins available (unlike the Ping ultrasonic range finder) and then is it possible to connect them with four female-female jumper wires to the board? I'll follow the illustration above but wanted to make sure how to physically connect the sensor to the Picaxe ouputs and the choice of connectors. It may seem obvious to you but I've actually never seen the components yet but in pictures, I just want to avoid too much soldering.

By the way, thanks for your tutorials, they are very helpful.

THere is not one right answer to how to connect stuff.

You can get all sorts of pre-made wires and pins to make snappy connections.. and you can also just solder everything on.

You have to try something, learn, find your favorite ways & tools.

(I'm still looking for mine :)

The Picaxe 28 can handle voltages from 4.6 up to 6 volts according to the manual. In the SRF05 manual it states that it runs of 5 volts. Will the SRF05 fry if I connect it to a Picaxe running on 6 volts?

From the Picaxe Manual:

Power Supply:

4.5V or 5V DC is recommended. Do not use 6V, 7.2V or 9V battery packs, these could permanently damage the chip.

I wouldn't count on it! They seem to be fairly fragile and the datasheet says 5V so I would stick to that if you can. You could try:

a) If you're using 4x 1.5V batteries you could 'tap off' from the third giving 4.5V for the SRF05 but use all four for the other bits in your circuit. I've run mine off 4.5V with no problems.

b) You could also use 2 diodes in series to drop the voltage connected to your SRF005. Each diode will drop it by about 0.6V so if you had 2 in series it would drop to about 4.8V but this is a bit inefficient.

c) Using a 'low dropout' voltage regulator. I can't think of one of hand but they are available. A 7805 will not work.

If it were me, I would tap off the 3 batteries - it's simple, will work and won't cost you anything.

Yer, me too, tapping off 3 cells. Very nice, very low tech, I like.