Escornabot Makech is a good option to introduce yourself to robotics. This robot does not require welding any component, it is plug-and-play.
This is an all-in-one open source/hardware project to enjoy the practical programming, electronics, and robotics experience.
MakechMakech is a version of Escornabot, which implements different ways to program it using the Arduino, MakeCode, and Circuit Python platforms.
Thanks to this, different programming languages can be taught.
Having all the integrated circuits eliminates the need to wire, minimizing electronics errors, thanks to this makes it a tool dedicated to teaching mobile robot programming that helps to continue developing logic for problem-solving.
Building our first robot to avoid obstaclesThe Student will use the online platform “Microsoft MakeCode” to create a program that allows the “Escornabot Makech” to traverse a maze by himself, detecting walls using the HC-SR04 supersonic sensor.
The HC-SR04 sensorThis component is very popular for projects that involve detecting solid objects. It uses an ultrasonic transmitter, which works by detecting a pulse on the Trigger pin of at least 10us, it sends a signal of 10KHz and detects the feedback signal of any object. If this exists there’s going to be a pulse on the Echo pin and the duration of the pulse will be used to determine the proximity of such object to the transmitter.
Test distance = ( Pulse duration on Echo * Speed of Sound ) / 2
The detection range is from 2 to 400 cm with a precision of 3mm.
Is important to note that this module needs 5V to work, so if we were to connect it to a 3.3V pin the output signal would be incorrect.
Stepper MotorsStepper Motors are a special type of motor that works by receiving electric pulses on their control inputs, this allows the motor to maintain a high precision whilst turning, taking little steps; hence the name.
To make the motor turn we need to polarize the coils one by one in order for us to turn.
The “Escornabot Makech” bootloader allows us to program in a variety of different languages and platforms; one of them is Microsoft’s MakeCode, an online IDE that requires only a web browser to be installed.
First enter: https://maker.makecode.com
If you see this warning don’t worry, we still can save our progress. Click on Continue.
Once on the main page click “New Project” to start:
In the section named “Boards” select electroniccats-escornabot:
This is going to be our work area:
To the left we can find the board simulator:
In the middle, the different block types we can use to program:
To the right is the area where we’re going to be placing our blocks, and beneath are options for saving and downloading our code:
As you can see there are two options on the upper bar: Blocks and Javascript. For this practice will stick to “Blocks”.
First, let's set some initial variables to track the control inside the program. This needs to be done in the initial cycle, by dragging the block “on start” into the diagram.
To define variables, go to “Variables” > Make a variable
Here we need to create four variables, “space” to save the minimum between the robot and the maze’s walls, “delay” for adjusting the sleep time between each motor step and to negate the bounce of the buttons; lastly we define “half turn” and “turn”, these ones are essential for making a half turn and a full turn.
Once defined we should see more blocks appear in the same section. To change the values we use the “set” block; to initialize the values we can drag two blocks inside the “on start” loop:
The variable space is set to 5, the minimum amount of centimeters before the robot changes direction. The delay is also set to 5 because we are going to be using 5 ms steps through the program. Doing test we discovered that “half turn” needs to be set to 170 in order to have the robot do a half turn, and for a full turn we just set “turn” to double “half turn”:
For each direction the robot can move, we’ll use a different function block, this will make the code easy to understand and change later. First we start by creating the functions: “Right”, “Backwards”, “Forwards” and “Left” as we did with the variables previously:
We start with the function “Forward”:
To control the motor’s driver pins we need to stack 8 “digital write pin” blocks for the pins D2 to D9, the pins D2 to D5 will have the task of controlling the right wheel, whilst the pins D6 to D9 will control the right wheel. Notice how for each wheel we set to high two pins at the same time, we do this in pairs to get better torque on the motors:
After each motor step, a small pause is needed so that the motor can move. We take a “pause” block from the “Loops” section and we insert it next to previous blocks of the function:
Inside the “Pause” block we drag a “delay” block with milliseconds already defined for use.
Moving to the next part, we simply move the pins with a high state (as you can see in the pictures) to go back to the first part, remembering that this function is going to repeat indefinitely (unless the user presses a different button).
The steps we take in this function are exactly the same, the only thing is that we invert the cycle, so our starting point is the end point of the previous function, and the last is the first of the “Forward” function.
Concerning a change in the robot’s direction what we need to do is to combine the movement of one wheel going forward and the other going backwards, this will make the robot turn on its own axis in the smallest space available. Because of this the “Left” function works with two cycles, first the pins D2 to D5 (to control the left wheel) are placed first in the step of function “Forward” and changed the order of that function. After that the pins D6 to D9 (to control the right wheel) are placed like the first ones in the “Backward” function and move like in that loop.
Now we need to declare a function that can do measurements with the ultrasonic sensor, we know that the sensor will return the distance in centimeters and because they are easy to access the pins SDA and SCL are the ones we’re going to be using to interface with the Trigger and Echo pins of the sensor:
A 10µs is send to the trigger pin to activate the sonar.
With the “pulse in” block we measure the pulse size of the sensor, from this we calculate the distance of the object in front of the robot.
Finally the function returns the probe distance:
With all of our functions defined we proceed to the next step in the program, we drag the “forever” block beneath the “start” block, the “forever” block is going to be the main loop of our program.
Jumping to the main loop, we’ll start by making the robot move forward, we do this by turning on the led Forward.
We call the function to move the robot “Forward”, because is at the start of the program and not inside a condition block this is going to be the default behaviour in case the robot doesn’t find any obstacles.
We call the function “Distance” to get the distance of the closest object in relation to the robot. If the object is not far enough the program now needs to decide the new direction is going to take, take notice that because this is a while loop the condition is put to the test at the end of the loop, in case it needs to repeat.
In case the sensor detects an object, the robot will try to continue its course by turning to the left. To indicate this the Forward leds needs to be turn off and the Left led is now needed to be turn on.
It's time to test the code in our Escornabot Makech.










_3u05Tpwasz.png?auto=compress%2Cformat&w=40&h=40&fit=fillmax&bg=fff&dpr=2)
Comments