How can I make a self-bancing robot with mBlock?


#1

Hi,

I would like to program by mBlock (scratch) a self-balancing robot.
Any suggestions?

Regards,

Susana


#2

Hi Susanaoubina,

Do you have the mBot ranger in nervous bird firm?
You can upgrade firmware for it with mBlock and it will have the self-balancing function by controlling through Makeblock APP HD


#3

Hi,

I wanted to do with scratch, not with Arduino. I am a teacher in Spain and it will be a fantastic proyect!!!
Please, could you help me? Any suggestions?

Regards,

Susana


Auriga OnBoard GyroScope
#4

See my answer here


#5

Thanks Andreas!

It is a pity that we do not get to create the self- bancing with mBlock (scratch).

Thanks!!!


#6

But why we do not , is that says we can’t ???


#7

You might be able to do it with Scratch, but you need to upload it through USB and replace the default program. That runs much quicker.


#8

If you can read Arduino code (C/C++), the firmware file that contains the balancing code is here. Given the limitations in the mBlock code generator, it might be fairly difficult to do in Scratch, IMO.


#9

Hello,
I am afraid the link is broken. Could you please reactivate it or point us in the right direction to get the balancing code ?

Many thanks,
Bertrand


#10

New link for Auriga firmware.


#11

Hi Susana,

I am endeavouring to do just this, with limited success : that is the robot tends to self balance but ends up falling down : is it a matter of tuning, a flaw in the conception of the code, of the robot ? Dunno.

If there is a reason why it can not be done in scracth it would be great to know precisely (time basis, no interrupts used ?). I suspect the center of mass is not right either. Anyway, here is the code (see below)

I rearranged parts of the Orion based Starter Kit platform with a meGyro gyroscope. The robot and the test can be seen in my Facebook group “Atelier mobiles de robotique”. https://www.facebook.com/bertrand.cayzac.7/videos/10218129233448040/

It is to be noted that not all functions of meGyro are supported in mBlock (scracth) for instance you can not get the angular speed unless you “hack” the Arduino generated code. Hence I am only using the angle (Y). I plan to use the angular speed for the derived paramter by changing one instruction in the C code.

You will fin the code here, please not that this is NOT WORKING YET but may inspire you :slight_smile: Balance Vpid6_ok1.sb2 (77.3 KB)

Kind regards,
Bertrand