Bug in read encoder postion block


For my crawler robot I need to be able to read the encoder positions see https://www.youtube.com/watch?v=o_vBP2nVpDY&feature=youtu.be

When ever I try to read the encoder position or speed it just causes the motor to run flat out and it never turn from reading. see here for demo of problem https://www.youtube.com/watch?v=3BJU_6usfx0&feature=youtu.be


Hi OutoftheBOTS,
Actually I can’t understand you as the two blocks here you used for different motors.
Only three blocks for Ranger onboard encoder motor.



Ok so I need to do some very common basic robot motor control.

  1. set motors to spin at a regulated speed. I can achieve this with this block.

  2. read the current encoder position of the of the motors in degrees. Which block can achieve this??? As I use this in order to ensure on going synchronization of both motor for driving my robot legs.

Here is a couple of blocks I created that can control unregulated motor power and read encoder position in Degrees https://github.com/OutOfTheBots/Makeblock_extenstions/blob/master/motor.mext

Here is the Ardunio code it came from including some code for also reading encoder rotation speed in RPM see https://github.com/OutOfTheBots/Makeblock_extenstions/tree/master/Encoder

Also which motor is this block designed for ???


Hi OutoftheBOTS,
Sorry for the mistake, I just have confirmed with our product manager and the block for enhanced encoder motor can also be used with encoder motor on board and I have test it.
I send you the test video, please check your inbox.
By the way, the enhanced encoder motor means this one.


The 7 secs of video you email me doesn’t show me anything except a number coming up on the a screen. I can’t see the code that generated the number on the screen or see a motor turn or see how the motor is connected. It doesn’t tell me anything.

The link you posted me for the enhanced encoder motor is the 180-smart-encoder-motor which is a serial controlled motor the same as the smart servo and won’t plug into the motor ports of the Augira but rather the serial servo port.

see cut from the page in your link

This is where a serial protocol motor will be plugged into.

Now repeating from above the simple task that I want to be able to do with standard mblock is : set the motors at a regulated speed (RPM) then be able top read the encoder positions. Can you please post the needed blocks to achieve this.


Hi OutoftheBOTS,
The code I use in the video is this one and the motor is 180 optical encoder motor which is packaged in Ranger.
The video I want to tell you the blocks for enhanced encoder motor can also be used to Ranger motor.

For the 180 smart encoder motor, yes it can’t be connected to Ranger.
I just post the link for you as you have asked which motor the enhanced encoder motor designed for.
Hope I have explained it clearly.


@tech_support you keep contradicting yourself.

First a very very simple question are all the following block designed for the 180 Optical Encoder Motor here in mackblock docs http://docs.makeblock.com/diy-platform/en/electronic-modules/motors/180-optical-encoder-motor.html or are they designed for the 180 Smart Encoder Motor here in makeblock docs http://docs.makeblock.com/diy-platform/en/electronic-modules/motors/180-smart-encoder-motor.html as they are totally different motors.

Second I will ask the same question for the third time. I want to do a very simple thing set the motors to turn at a regulated RPM then read the position of the encoders. As far as I can tell the 2 following blocks are the needed blocks but if you try to use them in the same program it causes the motors to go crazy as there is a bug in them.


Hi OutoftheBOTS,
I must apologize for mistake.
I said the enhanced encoder motor driver block is designed for 180 smart encoder motor and you can’t use it to 108 optical encoder motor.
I was wrong.
I have confirmed with the product manager, yes the enhanced encoder motor driver block is designed for 180 smart encoder motor but you still can use it to control the 180 optical encoder motor.
That is why I send you the test video.
In the video, I use the enhanced encoder motor driver block to control the 180 optical encoder motor.


Ok again the simple task that I want to be able to do is set the motors to a regulated motor speed then read the encoder positions of the motors.

Please do you understand the difference in the following blocks
The first 2 blocks set an unregulated power (just sets the duty cycle)
The third block sets a regulated speed (uses a feed back loop from encoders to adjust the duty cycle to maintain a correct speed)

Again what I need to do is set a regulated speed then read the position of the encoders


Hi OutoftheBOTS,
You will get the difference by check the Arduino code.



Again for the 5th time I will ask the same question

It is super basic robot task. I want to make the motors spin at a regulated speed then read the encoder positions.


Hi OutoftheBOTS,
That’s my bad.
Yes your request is to make the motors spin at a regulated speed then read the encoder positions.
Now the problem is that the blocks special for 180 optical encoder motor on Ranger doesn’t have the block to read encoder positions. If use the two kinds blocks together the motor will work abnormal.
I will feedback the request to our engineers to confirm if we can add a block for 180 optical encoder motor to read angle so you can use it.
Will inform you once I got the news.


Thank you for understanding the problem :slight_smile:

Now the solution is very easy. First all the needed functions are already available in the makeblock github here https://github.com/Makeblock-official/Makeblock-Libraries/blob/master/src/MeEncoderOnBoard.cpp

The encoder position can be read by this function it just needs to wrapped up into a block

long MeEncoderOnBoard::getPulsePos(void)
return encode_structure.pulsePos;


reading the current speed is here

float MeEncoderOnBoard::getCurrentSpeed(void)
return encode_structure.currentSpeed;


This would also be a very useful function to wrap up in a block because it allows the user to zero the encoder.

void MeEncoderOnBoard::setPulsePos(long pulsePos)
encode_structure.pulsePos = pulsePos;


The bug that makeblock needs to fix is that it has 2 sets of conflicting blocks to drive the onboard motors. I set needs to be removed then there won’t be a bug


Hi OutoftheBOTS,
Here is the reply from engineer.
For the four request that you mentioned.
1)Reading the encoder position. Yes we will add.
2)Reading the current speed. Yes we will add.
3)Zero the encoder. Sorry we can’t do that because of some special reason.
4)Remove the blocks for smart encoder motor from the Maker’s Platform extension for Ranger. Yes we will remove it.
The requirements have been added to the schedule and we will update it as soon as we can.
Thanks for your suggestion.


Thanks a lot for this great solution :slight_smile:

I look forward to the release date of the updates.

Yes I understand that zero the encoder can cause other problems and is much more complex to add


Thanks for your understand.


The blocks being removed don’t control the Smart encoder motor but rather control the onboard motors in slot 1 or slot2 and cause conflictions.

Smart encoder motors plug into the serial port the same as smart servo as they use a serial protocol the same as the smart servo.

I have been unable to find the functions for controlling smart encoder motor on the make block github and assume they are yet to be added. I did find the smart servo functions and am unsure if they will also drive the smart encoder motor. https://github.com/Makeblock-official/Makeblock-Libraries/blob/master/src/MeSmartServo.cpp