Balancebot with other gyrosensor

Hi there,

Is it possible to make a balance bot with a Grove gyrosensor instead of a EV3 gyrosensor?


Welcome to the forums @k2403902! :smiley: It probably is, the deciding factor would be on how fast and accurate the sensor is. It probably would work though, I mean after all what is it there for?

Thank you!

I am thinking of a MPU-6050 Accelerometer & Gyro.
There are projects online with it but the building instructions are incomplete.
Is the Dexter balancebot custimizable? For instance to make it work with a different frame?
That way I dont need to buy Lego mindstorms.


Hi Kay,

The BrickPi3 BalanceBot python program requires a gyro sensor that reports Degrees Per Second of rotation (1 DPS resolution is sufficient) with at least a 60Hz update rate.

If you don’t want to buy Lego Mindstorms pieces, then perhaps BrickPi is not for you. While the BrickPi could be used without Lego Mindstorms components, it is designed specifically to be used with Lego Mindstorms as an NXT/EV3 brick alternative with some huge benefits.

If you are interested in building the BrickPi3 BalanceBot without Lego parts, while it is probably possible, using Lego parts significantly simplifies the design. The motors need to have quadrature encoders (the NXT and EV3 motors have the encoders built in), the gyro sensor needs software support (there are already drivers for the EV3 and HiTechnic gyros), and there needs to be a way to remote control the robot (the EV3 IR remote and receiver work well for this).

To build robots without Lego pieces, you should check out the GoPiGo, GrovePi, and PivotPi. However, for this specific application (with the hardware requirements), perhaps the BrickPi3 would be ideal, even if you aren’t planning to use Lego components. The BrickPi3 motor outputs (pins 1 and 2) are rated for up to 1A continuous, and are powered from the battery voltage (which should be 9v to 12v). The motor ports supply 5v for encoders (Gnd on pin 3, 5v on pin 4), and have the two encoder input lines (pins 5 and 6). An I2C gyro sensor could be connected to the Grove I2C port of the BrickPi3.

If you want to hack together a BrickPi3 balance bot without Lego pieces, that sounds very interesting! Please share when you have it working!

Thanks for the response Matt,

Do you think the current balancebot python program is suitable for different types of motors and gyrosensor?


With some modifications, yes the python program could be used with different (non-Lego) motors and sensors. The program requires 1 degree precision from the motor encoders, and values from a gyro sensor normalized as DPS (Degrees Per Second).

Hi Matt,

Sounds awesome! Can your expertise shine some light on this partlist in combination with the program and brickpi.

Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout - BNO055

Adafruit DC & Stepper Motor HAT for Raspberry Pi - Mini Kit

Small Reduction Stepper Motor - 5VDC 32-Step 1/16 Gearing


The BalanceBot program is designed for DC motors with quadrature encoders. I won’t say that it’s impossible to use stepper motors for a balance bot, but that’s certainly not what the program is designed for. You’re welcome to try using those stepper motors (assuming you can find wheels that will work with them), but it certainly won’t be a plug-n-play solution.

Regarding that IMU, if you can find python drivers for it, it should work. You will need to do a little hardware hacking to connect it.

Why not use Lego components? If you want to avoid buying a full EV3 set, you can find individual pieces or lots on eBay or Bricklink. The EV3 motors and sensors can be purchased individually directly from Lego, but you’ll need to build a frame and you’ll need EV3 or NXT cables to connect the motors and sensors to the BrickPi3.

1 Like

I did a ;little research into setting up a similar system for robotics myself. At some point I probably will as it opens up a few more door for super accurate and high torque motor control as well as being a super interesting learning project for me.

Just 1 point for you is that the little stepper motor your looking at there doesn’t need the motor controller hat as it comes with it’s own controller board and plugs directly into the GPIO pins. This little stepper motor is a super crap stepper motor. Most stepper motors are 200 steps but this one is only 32 steps then small plastic gears to gear it down. This means a few things first the little plastic gear won’t take much force or use to strip the teeth off them, second the reduction gear of 1/16 means the turning speed will be super slow as stepper motors already tend to be slower motors than DC motors and then it is beng geared down by 1/16, third the 32 step instead of the 200 step will reduce your fine control and lower your torque.

Reading on the net m,any people are recycling stepper motors from old printers or any other old computer controlled devices that have moving parts that require high precision movement.

If Adafruit is your favorite place to shop maybe have a look at this higher performance stepper motor.

Thanks for your post, learning alot here. Good tip for the parts, will proably will do that.

But just to get all bases covered:
What difference will the size of the wheels make in this program when using a DC quadrature encoded motor?
How does the program react to the size of the frame a how to adjust it for custom heights?

@Shane thank you for your information on steppers. Now I know better!
Did you make your project work?


@k2403902 I always make my projects work but it is always a case of continuing to work on them to improve them and make them work better. The stepper motors would have worked much better for my Rubik’s Cube solving robot that I built with my son because of the need to change speed rapidly and accurately but ATM I am working on a fast moving robot using computer vision, surprisingly the motor control is being a much harder and more complex part to max out than the computer vision. The more that I research into motor control the more I am appreciating using the BrickPi where someone else has already done most of the motor control work for me.