Your first MARK Robot



Build a robot that works all the time, detecting if there are objects in front of it and dodging them to follow its path.


You will need the following parts to assemble the robot:

  1. 1 x Brain
  2. 2 x Basic Modules
  3. 1 x 2 Pattern Modules
  4. 2 x Motor Actuators
  5. 2 x Wheels
  6. 1 x Omniwheel
  7. 1 x Distance Sensor
  8. 3 x RJ25 Cables
  9. 7 x M5 x 15 mm Screws

Assembly sequence


Image: Component parts

Separate all parts to assemble the robot

step 01


Image: Motors

  1.  You must place the axle on the wheel pressing until it stops,
    (the axes have a notch that you must match in the plastic part)

  2.  Then adjust the screws starting with the one with the notch, in this way the wheel will remain fixed.

  3. In the motor enclosure you will find two patterns to connect building modules. For this configuration we will use the one under the wheel.
    Place one of the basic modules with the conical side (where the screw goes) looking at the wheel and in this configuration we will use it rotated 22.5 ° counterclockwise to the floor plane, so that the motors remain vertical.

  4.  Now you must use 1 screw to secure the building module and the wheel, there is a hole where you can guide it to the piece. Then adjust it to become fixed.

  5. You must repeat the process with the second motor and place both motor to the brain as shown in image 5 using 15 mm M5 screws.
    The basic module will be turned 22.5 ° counterclockwise to the floor plane as you can see in the image.

Step 02


Image: Omniwheel

  1.  Place the omnidirectional wheel coupling on the vertical rail.

  2. You can position the wheel at different heights, making use of the coupling piece (it has 2 fixing pieces that you can use in any of the patterns of the construction system), raising the omnidirectional wheel of the floor from 47 mm to 97 mm (50 mm in total).
    Using 1 M5 15mm screw, place the coupling as high as possible, this will leave the brain parallel to the floor.
  3.  At the same time you can combine it with other modules to adjust it to other types of projects … In this first guide we will use the simplest method to start.

Step 03


Image: Distance sensor

  1. Place a 2 pattern module to the sensor. We will use the conical part of the module to secure the sensor with 1 M5 15 mm screw.
  2. Then place the assembly on the brain and secure it with 1 M5 15 mm screw (in this case the screw will enter the hexagonal area of ​​the module)

Step 04


Image: Cables

  1. Connect the motors in the MA and MB ports, then the distance sensor in port A0.
    (You will find all the ports named in the brain).

Step 05


Image: Robot assembled

Congratulations !, you have finished the assembly of the dodger configuration.

Now let’s program it…



 To begin, we will use the MARK Robots extension for the mBlock software.

If you have not installed it yet, you can watch the following video:

All set !!

 It’s time to program the object dodger.

To program, we must think about how to give orders for the robot and we must think about how it can behave in different situations.


Our goal will be to make the robot move constantly and change direction when it finds an object at a distance of 20 cm, to start with.

Then we can deduce that it is an action that is going to repeat infinitely, measuring distances less than 20 cm all the time in front of the sensor. The robot will be in constant motion using 2 motors and if the value of the sensor is less than 20 cm then it will rotate to avoid the obstacle.

This already gives us a good idea of ​​how to assemble the code:

Step 01

We will start with the MARK block. We will use it at the beginning of each robot.

You can find it on the label.

Robots – MARK Extension – MARK

Enables communication with the Arduino board and ensures that the outputs and inputs correspond to the MARK Shield.

Step 02

Now … we mentioned that our robot would infinitely repeat an action.

For this we will use the “forever” block of the “Control” palette (you can find it in the left part of the mBlock).

Control – Forever

It is a container where we will place a sequence of blocks, and once they reach their end, will be repeated “forever”.

paso 03

As our actions depend on whether the distance sensor registers measurements greater or less than 20 cm, we will start programming it with the conditional “If – Then – Else”

You will find it on the label

Control – “If – Then – Else”

The block will verify if a condition is true or false, and then continue with the orders depending on these two situations.

Step 04

Several blocks have the following symbol.

 This means that it expect us to enter an operation.

You can find them in the “operators” section with blocks that have the same shape.

In our case we need a sensor measurement that is smaller than a fixed distance, therefore our block will be the following:

Operators – Less than

Step 05

Our objective is to verify if the distance sensor finds measurements less than 20 cm, then, after “less than” we enter 20 in the text field (the sensor is configured to measure centimeters by default).

To the left of the “less than” we need the measurement of the distance sensor, for this we will use the block “distance” and you can place it in the space of the operator “less than”.

Robots – MARK Extension – Distance

The blocks are joined from the left, not from where you clicked, in case it is difficult for you to place the block in your container.

Step 06

Now we will tell the robot what to do in each situation:

If there is nothing less than 20 cm, then the robot should move forward.

For this we will use the “start moving” block.

Robots – MARK Extension – Start moving

The block moves both motors backwards or forwards, using the speed that we enter.
The speed is a value from 0 to 255.

We will start by saying that the robot moves forward, at a speed of 100.

If the sensor finds something less than 20 cm, the robot should turn and then resume the march.

So first we will tell you to turn, for that we will use the block “start turning”.

Robots – MARK Extension – Start turning

 The block makes the wheels move in synchrony to make a turn, we can define where it will be: left “or” right “. Finally we must tell what speed we want to turn, to start use 90.

step 07

 Let’s try the robot …

You must connect to MARK using the USB port.

Now in the software we must tell the program what board and communication port we are using on the computer.
In the boards menu / select Arduino UNO.

 Now in connect / serial port, select the port that appears there.

(Usually you will see only 1, if it is the only device you have connected to the computer).

COM + “port number”

It only remains to press “upload Arduino” and wait for the software confirmation.

step 08

Now disconnect the USB cable and turn on the robot with the power button.

What can you see?

Analyze how it works?

step 09

 Let’s think how to improve MARK’s behavior …

The robot does not always start the same way, and we are always measuring a distance of <20 cm. When turning, that distance in front of an object will change, so the robot starts to march again. That is why we need to keep turning until the distance is a little bit bigger and make sure that we will not return to a situation of <20 cm right away.

We could also do that once the object is detected, before turning, the robot backs up a bit to avoid hitting the object (in the design of your robots, you will notice that depending on how you assemble them, the behaviors will be different)

step 10

We will make the changes based on the observations of step 09.

We will use “start moving” to tell the robot to move “back” at 100 speed.

Then we will use what we learned and we will give the action a waiting time of 0.2 seconds, so we will make sure that it will travel some distance.

You will find the “Wait” block on the label:

Control – “Wait”

step 11

Finally we will use the block “Wait until” on the label:

Control – “Wait until”

 Unlike “wait seconds”, this block will wait until a condition is achieved. In our case we want you to wait until the distance sensor registers a safe measure to advance. Let’s try with “greater than” 40 cm …

Operators – Greater than

Use at the other end of the operator, we will continue to use the same distance sensor measurements.

step 12

It’s ready…. let’s test the robot …

You must connect to MARK using the USB port and press the “upload to Arduino” button again.

Congratulations !!

Your first MARK !!!

In this example we used several tools to make the robot adapt to our needs and get the result we expected.

We have used basic concepts of logic and mathematics and have put them into practice.

Back to home

Skip to toolbar