Let's Make Robots!

start here robot ultrasonic sensor

Newbie here

Hi every one i have been member for a while now and have finally collected all the parts needed to complete fritz start here robot.

Every thing is the same apart from im using a 28x2 picaxe instead of the 28x1 picaxe,also using the ultrasonic sensor pictured below (in attachments instead of the SRF05.

i have followed the walk  through on http://letsmakerobots.com/node/66  for the SRF05 sensor and translated the wires to my sensor as followed:

wire             srf05                mine

black           ground 0v         gnd

blue             trigger input      trigger

yellow          echo output      echo

red               5v supply          vcc

i also used the basic program from   http://letsmakerobots.com/node/66 and nothin happens????????

here is the spec for the sensor:


  • The modules includes ultrasonic transmitters, receiver and control circuit
  • Its stable performance and high ranging accuracy make it a popular module in electronic market
  • There are 5 pins out of the module, VCC, Trig, Echo, GND and OUT
  • Best performance in 30 degrees angle
  • Electronic brick compatible interface
  • Dual transducer
  • Arduino library ready


  • Voltage: DC 5V
  • Current: 15mA
  • Ultrasonic Frequency: 40K Hz
  • Maximal Range: 400cm / 13 feet
  • Minimal Range: 3cm
  • Resolution: 1cm
  • Trigger Pulse Width: 10μs
  • Dimension (L x W x H): Approx. 44 x 20 x 18 mm

i am hoping some one can point me in the right direction.

link to seller as requested


sensor.jpg29.07 KB
2.JPG1.38 MB
1.JPG1.43 MB
3.JPG1.27 MB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi chris,

thanks for all the earlier info on  the ultrasonic sensor, bytes (0-255) etc i understood all that thanks

right as for the motors

Am i correct in thinking :

Parallel - twice the current, same voltage as for one motor (so you need larger capacity cells).
Series - Twice the voltage (twice as many cells) same current draw as one motor

Yep, that's about the size of it.

If you have two identical motors in series, and you put 6V across them, they only get 3V each and the same current passes through both. If you place them in parallel, each gets 6V, and the current for each will be determined by the resistance of the motor. Ideally, each motor in parallel will draw the same (separate but equal) current. In practice, the motors will differ slightly, so one may draw a bit more than the other.

I don't know what batteries you are using. You can separate out V1 and V2 on the Picaxe board so you can use a higher voltage battery pack for the motors on V2, and not fry your electronics on V1. Keep in mind that the motor driver on the board drops about 1.5V itself. So if you are only giving it 4.5V (3xAA alkaline batteries) you are down to 3V for your motors already. If you split that across your motors in series, what will happen?

I think you may have made some homework for yourself --and this is a good thing.

I am not going to answer the question here, but I will point you in the right direction.

The questions is, "Should my motors be in series or parallel?" --I am not saying you have it wrong or right here

The answer came from a guy way back in history. --Do a seach for Ohm's law, he know's exactly how to hook up your motors.

 i had noticed that all the start here robots have only 2 motors  conected to the A and B ports, and i noticed that theres not enough ports for more motors.

so i connected them in series, so two motors run to gether of the A port (Right side of robot) and 2 run together of the B port (Left side of robot)  when turning to miss objects it turns nicely on the spot even on carpet an in garden on gravel.

have had no problems with this set up,but as you all know i am new to all thiswould this cause any problems with the picaxe or with the power used? 

Motors used are 200:1 geared

Looks like JAX and CtC have got you steered towards a solution on your sensor.

I have a question for you on another topic. I see your robot has four motors. The Picaxe board can drive two motors. How are you connecting your motors?

All the numbers I quoted above --the 0-255 thing and the 0-65,535 thing. These numbers pertain to the picaxe. Other chips allow for even bigger numbers, numbers with decimals and negitive numbers --some/all of these things can affect the "range" of values you can work with.

Yes indeed. It seems to be working.

b2 and w1...

In terms of robot brains and code and computers and the like, you got yourself some bytes. A byte is made up of 8 bits, each of which can be either on or off. With these 8 bits, the maximum number of combinations you can make is 256. Therefore, a byte can contain (be) a number between 0 and 255. In the picaxe world, bytes are b0, b1, b2 etc. ---Now, if you need a bigger number, you can move up to a word. A word is made up of (2) bytes and thus, 16 bits. Same rule applies --the number that the word contains (is) can be as large as the number of different combinations that you can make with the bits. It works out to 0-65,535.

To cut to the chase, W0 or "word variable, number zero" is made from b0 and b1 ("byte variable, number zero and byte variable number one").  When you are looking at your debug window, ALL of the picaxe variables are being shown. You can see both the word variable --where you are storing the sonar range, but ALSO you can see the 2 byte variables that that word is "made" from.

With what you are doing now, I would pay no attention to the byte values shown in the debug window --do however, note their existance --in the future you will need to learn how to work with them.


One more thing to note is where the "debug" command is within your code. If the debug is after the pulsin but BEFORE the *10/58 stuff, the debug window will show the raw range data. If the "debug" command comes AFTER the *10/58 stuff, you will see the range after its conversion --the debug window will show your range in inches or CM or whatever you are converting to. --This is assuming that your aftermarket sonar sensor is spitting out numbers that are close to the SRF05's numbers. I would assume they are pretty close but do some testing with the debug window, a book or something for a "target" and a tape-measure.

Did I confuse you at all?


hi chris,

as you stated i changed trig to B.3 echo to C.6

now in the debug window  i get readings in the b2 on the left hand side an  readings in the w1 boxs on the right hand side which both go up an down when i move hand infront of the sensor?

would this be correct chris 


Don't quote me on this but I think you need to define what port you are using. If you look at the pinout of the x2's, you will notice that the pins are numbered but each "bank" of pins gets a letter too. Check the pinouts, check the lables, you may need to add these letters to your code.

Instead of trig = 3 it might be trig = B.3 or C.3

Instead of echo = 6 it might be echo = B.6 or C.6

Note that we are using a decimal here. These are NOT B1 as in byte-one, it is B-point-one, which declares a pin.


I have no idea if this is going to make a difference --It is worth a shot though.

i have now replace the connector that jax and chris have both noticed,with female to female conectors

jax this is the program from the fritz walk through iv been using,when run i get the debug window start up an i get slight twitch on the servo. after this nothing but the debuy counting upwards, in the very right hand conner next to the debug word.???????

could the problem be ccaused as im using a 28x2 picaxe  in stead of the 28x1 ?? as i have noticed on there data sheets that they have different pin name  (please bare in mine if this is stupid comment i am very new to all this lol)

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