How to use URM04 v2 sensor with Arduino

Hello everyone,

As I am new at Arduino, I have been having some problems with using URM04 sensor with Arduino . I have Arduino Uno and I/O Expansion V5.0 . I'm using the code which i got from

However I can't read anything from the serial monitor. I tried different bauds (19200 and 115200 ) but still I'm reading strange letters like " Uª".

Can anyone help about using this sensor. I'm not good at programing and just I want to use it simply. I dont need to read temparature, just wanna read the distance.

Thank you Tugsan

The sample code is using your hardware serial port to talk binary to the range sensors. You can't also use the same hardware serial port to talk to the USB cable to the PC. That is why the output lines of the example are commented out:

        switch (cmdrd[num])
          case 0x11:
          case 0x12:

I suspect you are out of luck unless the "I/O Expansion V5.0" provides another RS485 serial port on a different pair of pins. You can't move the USB connection to different pins without mangling your Arduino board. You can use the NewSoftSerial library to talk to

I think there is a fundamental flaw in the example program, it only test once if there is data available … This should be tested for every byte read back; OR ; tested if there are 6 or 7 available

void serial_read()
  if(Serial.available()) <<<<<<    BETTER  use  if (Serial.available() >= 7) then the whole answer is in the buffer ...
    int sum=0;
    int i=0;
    //int j=0;
    boolean flag=true;
    while(flag)   <<<<<<<
      cmdrd[i];     <<<<


johnwasser and robtillaart thank you for helping me solve the problem. It looks like I'm not able to do it at present. I better put it away and purchase a new one until I gain some experience.

johnwasser: I'm a bit confused about serial port using, I looked at the NewSoftSerial library but could't figure it out.

robtillaart: I tried to use the code block you posted and I recieved the same letters. ( I changed only void serial_read block in orginial code. )

Could you recommend me any range finder sensor to use with Arduino. I'm thinking about getting Parallax Ping sensor

What are your opinions about this sensor? Also I'm open to recommendations.

Thank you very much. Tugsan