ArduinoGeneral

URM07: Can't set device address

userHead tobeedelafuente 2019-08-24 15:04:51 2244 Views6 Replies
Greetings DFRobot!

I am Tobee from Circuitrocks. I am trying to do URM07 cascade (4 sensors). The pre-requisite for this is to set the device address of the sensor. Unfortunately whenever I try to set it, the sensor does not respond. I would like to ask for help regarding the issue. Below is the code I am using to set the device address:
Code: Select all
#include <SoftwareSerial.h>

SoftwareSerial ss(2, 3);

unsigned char CMD[6] = { 0x55, 0xAA, 0xAB, 0x01, 0x55, 0x45 };
unsigned char Rx_DATA[8];
int i = 0;

void setup() {
  Serial.begin(115200);
  ss.begin(19200);
}

void loop() {
  for (i = 0; i < 6; i++) {
    ss.write(CMD[i]);
  }
  delay(150);
  i = 0;
  while (ss.available()) {
    Rx_DATA[i] = (ss.read());
    Serial.print(Rx_DATA[i]);
    i++;
    // getting no data :( LED not blinking as well
  }
}
I am following the wiki: https://wiki.dfrobot.com/URM07-UART_Ult ... U__SEN0153

Please do let me know if I missed something.

Regards,
2019-08-31 21:14:39 Hi, i'm actually the one who has the problem... I'm new to Arduino specifically UART Communication , do we have a conversion chart of the HEX values ? userHeadPic reygularbrotato.23
2019-08-27 10:23:23 Hey to calculate the checksum you add all the hex values received before the last byte (the checksum byte) and then only take the last two values of that summed number. So for example,
0x55+0xAA+0x11+0x00+0x02= 0x112 , therefore the checksum will be 12 (the last two values).
userHeadPic robert
2019-08-27 10:23:14 Hey to calculate the checksum you add all the hex values received before the last byte (the checksum byte) and then only take the last two values of that summed number. So for example,
0x55+0xAA+0x11+0x00+0x02= 0x112 , therefore the checksum will be 12 (the last two values).
userHeadPic robert
2019-08-27 09:41:57 As per the wiki:
Frame header --------- 0x55
Frame header --------- 0xAA
Device address ----- 0xAB (0xAB for the broadcast address, that is, all the common address of the module, you can use 0xAB instead of the device itself address if you are not sure the current Address)
Data length ----- 0x01
Command --------- 0x55
Set the address ----- 0x12 (need to set the device address 0x12) Checksum ------- 0x12

On the code the address I used is 0x45. Initially I tried the sample code but it still did not work. As for the checksum, how do I compute for this? Is it still: header_H+header_L+device_Addr+data_Length+get_Dis_CMD?

Regards,
userHeadPic tobeedelafuente