Self balancing robot code for mBot Ultimate


#1

Back at it again with the self balancing robot. My previous code didn’t work and now I can’t open the file as i seems to have been corrupted. Can y’all maybe help me with this?


#2

Going to my last resort. Hope I’m not bothering, @Best_codes


#3

Hi @AAA, I’ll try to test with my Ranger if I can later this week and see what I can come up with. :slight_smile: Good luck!

Did you add any extensions or switch between devices or the web editor?


#4

Nope. Though, we’re using Ultimate 2.0 and my robotics teacher said that we should like make it so it also follows a line. @Best_codes


#5

@AAA Yikes! Not sure what I can do for a balancing robot with Ultimate. Maybe @CommandeR knows something about that. Anyway, I’ll see what I can do later this week. Good luck!


#6

So @AAA , you are using Ultimate 2 not Ranger as the post title implies - I think that your robotics teacher is expecting too much - I know, I was one myself !

I wasn’t sure what to expect with this model. Makeblock simply describe it as a “Self-Balancing Robot driven by two encoder motors which can move back and forth on its own”. This is another amusing (and rather intriguing) ‘oddball’ type of model in a category rather similar perhaps to the “Robotic Ant”. There is a simple ‘Blockly’ control programme for it as part of the Makeblock app, but the model doesn’t appear to need it to work by default. Sadly, and most important perhaps, is there is no way of seeing how it works and there is, as usual, very little clear guidance to go on - there are some demonstrations of it working on YouTube - a particularly good one shows it carrying a cup of coffee.

You build the model and assemble it as instructed and it just works; and you are amused that it can (after a bit of fiddling perhaps) balance - but that is all that it does; and for a user wanting to learn from this experience there is no explanation of how it does that. The Ultimate’s MegaPi board has (I think) the self-balancing code built into its Firmware. Self-balancing is very hard and well-nigh impossible to achieve using your own mBlock coding & might just be possible if you are very good at coding in Arduino C.

As part of my tests, I removed the ‘cute’ but totally unnecessary ultrasonic module and replaced the two recommended 0412-092 Beams with the longest beams in the Ultimate kit (the 0412-220 ones) positioning them centrally so that they would act as protective arms if the robot tipped either forwards or backwards - I also thought that these might also help with the robot’s balance (in the manner of a tightrope-walkers balance pole). The model did now actually feel as though the weight was more evenly spread than it did before. You can see a picture of my subtle modifications below (yes, it is balancing perfectly):

Also do refer to my earlier post below:

Good luck.


#7

:smiley: Sorry about the title, @CommandeR. I fixed that. :slight_smile: Your post is very interesting. Thanks for sharing.


#8

@CommandeR I’ll try this out when school comes rolling back in next week. I’m pretty familiar with Arduino C since that’s what I was introduced to first when I joined a robotics training program back during quarantine. I noticed that it shares some similarities with Python so I think I’ll be alright with a bit of tweaking.


#9

@AAA Great! Be sure to let everyone know how it turns out.


#10

Couldn’t make it work sadly but now my teacher changed it. It’s now like the follow me robot where it balances but follows you using an ultrasonic sensor. @Best_codes @CommandeR


#11

@AAA Yikes! That sounds hard. If I ever find a way, I’ll let you know.


#12

@Best_codes
@CommandeR

I just finished re-assembling the robot since one of my classmates sabotaged me (it’s a race to who can assemble the robot first) and I tried to connect the bot to the makeblock app via Bluetooth (the mobile app)

Uhm… the tires are doing this for some reason as seen in the video in the link I attached. When it leans forward or backwards, the wheels like make the robot fall.

Help…?


#13

Well, since I don’t have one of these, it’s up to @CommandeR and makeblock support (support@makeblock.com) if you choose to contact them. :frowning:
Sorry, and good luck.


#14

Remember to refresh the Firmware before you start.

The symptoms that you show in your useful videos give the impression of poor battery power. The batteries must be in tip-top shape to drive this model - see attached sheets:


#15

Yahallo got it to balance but now our teacher is persistent on doing either line following or the follow-me bot with the balancing:(


#16

:grimacing: It’s awesome that you got it to balance… But it sounds like maybe your teacher is expecting too much of you. :frowning: @AAA