0

Line Robot - Hardware 1

1. Arduino setup

This procedure uses Arduino monitor. If You installed Visual Studio Code, use its monitor. The actions are the same.

Open MRMS_ESP32.ino (or main.cpp in Visual Studio Code) and Make sure that setup() function looks like this:

void setup() {
	robot = new RobotLine((char*)"My robot"); // RobotLine, RobotMaze, RobotMin, RobotSoccer, or Your custom robot. "My robot" is Bluetooth name.
	robot->run();
}
. Notice "RobotLine" part. It must be "RobotLine", not "RobotMaze" or some other choice.

2. Power on

Connect battery and turn on power supply by sliding its switch. ML-R 8x8 bicolor display, CAN Bus,UART, 4 switches (mrm-8x8a) should count. Now, after power-on, connect it with USB cable to Your computer. Mind the order! Always first power-on, USB later. Connecting with USB cable a powered-off robot will result in incomplete system startup and the robot will not work as expected.

Start MRM_ESP32.ino and open Arduino monitor. Program displays all the predefined commands. Your list will be different as only menu entries for found devices are displayed and You have only a few of them. You can use the commands to check Your devices and send other commands to Your robot.

3. List devices

Type "can" as in the last picture, in the input box above the displayed text, and hit "Send" button. The result will be a list of all the CAN Bus devices in Your robot. Again, Your list may be different.

Each name consists of the device type (like "Lidar2m") and a postfix (like "-0"), which You can consider as device's address. When being started for the first time, each device usually has address 0 assigned. If You have 2 or more of the same kind, like MRMS LIDAR 2m VL53L0X, CAN Bus (mrm-lid-can-b), each should get its unique address, so that the program can distinguish them. Depending on firmware version, the devices can negotiate the addresses and reassign unique ones, like in the picture left, where You have:
  • Lidar2m-0
  • Lidar2m-1
  • Lidar2m-2


Every device has it own enumeration, so devices "Lidar2m-0" and "RefArr-0" are not considered the same, despite both having postfix "-0".

4. Manual address

Due to older firmware or some other problem, reassignation process may not complete. In this case You will get an incomplete list, like:
  • Lidar2m-0
  • Lidar2m-1
or some devices will be repeated:
  • Lidar2m-0
  • Lidar2m-0
  • Lidar2m-1
In that case, You can manually change the addresses, using "idc" command. First either disconnect CAN Bus cable, or power cable (if the device has a separate power cable), from all the devices but one and issue command "idc". You can leave all the devices of other kinds connected, but only one lidar should be present. The result will be similar to this the picture on the left. Your list will be much shorter as You disconnected all the lidars except one.
In this example, we will change address 3 to 4. So, after "Enter board [1-11]:", at the bottom of the screen, choose ordinal number of Your device. In our case it is "6. Lidar4m-3". Therefore, enter "6" and click "Send".

Be quick enough, otherwise timeout will occur and You will have to issue "idc" one more time. The program will accept 6, write a short confirmation next to Your input and display a new line "Enter new board id [0..7]:".
Enter the desired new address, in our case 4, in the input box, and hit "Send".
Send "can" command again to check the result.

Be careful not to change the address to the one that already exists. For example, if You have:
  • Lidar2m-0
  • Lidar2m-1
, do not change 1 to 0! The result will be 2 devices with the same address and You may be forced to disconnect the cable from one of them in order to change address back to a different one. Note also that a list of devices:
  • Lidar2m-0
doesn't necessary mean that You have only one lidar, but there could be many of them using the same address: 0.
Continue reassigning all the device until Your list looks, for standard configuration, like on the left, meaning that You have, respectively:

5. Motors

Test the motors using command "mot". Do not enter any value after 2 additional prompts. The program will choose default values after brief pauses. Each motor should be rotating in one direction and then in another. Use "x" to stop the test.

6. Reflective sensor

To test reflective sensors, first enter "ref" command to enter submenu for reflective sensors. This step is optional as You can enter the next command, "anr", in the main menu, too, but this way You can see all the available commands.

So, type now "anr". You will get 9 columns, for 9 transistors that form MRMS reflectance sensors 9x, CAN, analog, I2C (mrm-ref-can). Even if You use some other sensor, like MRMS reflectance sensors 8x, CAN, analog, I2C (mrm-ref-can8) (8 transistors), You will get again 9 columns. However, only the columns that have corresponding transistors will have meaningful values. The unused ones will have, depending on firmware, either 0 (newer versions), or some arbitrary number.