Welcome to Robot Rebels, an online robot maker community.

Register today to post your projects, ask questions, share knowledge and meet like-minded people from around the world.

The Community

Author Topic: Four Motor Leg Module  (Read 2993 times)


  • Member
  • ****
  • B
  • Posts: 20
Four Motor Leg Module
« on: December 28, 2016, 10:51:10 AM »
This ongoing exploration into alternative servo designs follows on from the Quaternion Mimic.  That showed one MPU 6050 mounted horizontally could control three motors using the DMP output.

Test Rig C has four motors controlled by two MPU 6050 breakout boards mounted vertically to the upper and lower limbs of a simple robot leg.  Fusion code is required to use raw accelerometer and gyro outputs because the x, y and z axes have to be changed.

Test Rig C.jpg
*Test Rig C.jpg (41.04 kB . 431x768 - viewed 280 times)

IMU Issues

Changing the orientation of the GY-521breakout board highlights the asymmetry of the 6050 chip.  It can be used for deriving pitch and roll but the upper quadrants show a sign reversal that will defeat the atan2 function.  Bespoke code is required to sort out the value and sign of the acceleration vector components.

I did try out the GY-45 breakout board carrying the Freescale MMA8451Q chip.  This is very symmetrical and very easy to use as it provides values through all the quadrants.  For a simple tilt detector (eg switching portrait to landscape mode in a tablet or smartphone) it works fine.  Rattle it around in this application and the gravity vector is swamped by other movements so it is useless.

So reluctantly back to the 6050 for the gyro functions (which are pretty solid).  If only there was a readily available breakout board with both chips!!  Swinging the board around on the arm of a 55g servo makes it easy to see which are the relevant gyro outputs for the changed axes.  Fusion code based on Starlino’s Guide mixes the ‘static’ accelerometer positions with the moving gyro rotations to arrive at a good guess at where things really are.

Continually troubled by random locking up of the 6050, I studied that problem in greater detail.  The findings are in the ‘sick MPU’ tutorial.  Once the failure mode is detected as a bit stream pattern, the chip is power cycled to reset it.  Unless using the chip in an electrically noisy environment you will probably never notice anything.

Geared Motor Issues

At first glance, there seem to be hundreds of cheap motor/gearboxes available on eBay.  It turns out there are many variations on very few themes.  The yellow motor design is a masterpiece of plastics engineering and only costs around a pound.  The armature magnetic detent is reflected at the output shaft as a 6 degree ‘cogging’.  Graphing the PID output to MPU-reported position shows a ramp to staircase waveform. 

The lower limb is not under load so can shake around and the ‘cogging’ will be noticeable.  There is a PVA foam friction disc to help.  Previously I have used a coil spring to keep the joints biased but this time it is done with a bit of code to hold a minimum motor current.

The demo shows the leg kicking a ball and attempting the yoga ‘tree pose’.  The femur swivel should take place at the hip but in the test rig it takes place at the knee so it doesn’t look quite right.  The swivel angle is measured as the lower limb roll but this can only be used as a PID feedback in certain positions.  The motor is turned off when the leg geometry is inconclusive.


Yaw was previously discounted as not useful in this application.  Similarly, the derived femur swivel used here is not a rugged solution.  The longer cable path to the lower limb IMU is screened but that chip is still very susceptible to continuing noise at re-start.  It can be detected and the motors stopped but future designs may be a hybrid of techniques.

Powering each MPU from a Nano output pin has resulted in a higher pin count than originally expected and that will curtail the features of the next module.  It may be some time before I can see how a quadruped with self-balancing legs would perform in practice.


  • Member
  • ****
  • D
  • Posts: 1
Re: Four Motor Leg Module
« Reply #1 on: November 04, 2018, 05:15:49 PM »
Realise this is an old project but just found this one while browsing. As you may know I am obsessed with the BO- series of plastic motors due to their strength and relative cost and have been working on many ways to make them contrallable.
   I love the complexity of that little leg and wonder if you did much more with that project afterwards?

 The fact you able to make complex controlled movements without having to rely on servos to do all the cool stuff is really cool. At the very least you have a pretty kickass animatronic. Actually looks very similar to my very first robot leg project where I was trying to use printed paper optical encoder to controll the angle of the legs. Was very messy! :


  • Member
  • ****
  • B
  • Posts: 20
Re: Four Motor Leg Module
« Reply #2 on: January 09, 2019, 04:55:14 PM »
Sorry I missed your message hence being late in replying

I have done a lot of work with the MPU and found various funny issues. Pitch and roll are easy to work out against gravity but yaw is in quite the wrong plane.  The MPU-6050 tries to guess the yaw from the pitch and roll so can mess up when not used in a drone or boat. In the tutorials I tried a Quarternion Mimic and you can see the motion like water going down a plug hole when it messes up. The real problem is that these sensors only work in a hemisphere and for general leg control there can be a sudden reversal of vectors.

Again in the tutorials I showed a DIY Yellow Servo using a cermet pot. For me the plastic gears could not deliver enough torque but could be usable for a smaller project.  Yes, your legs do look very similar - very smart.

I have been stripping MG996R servos and using the 260:1 metal gearbox with a Nano in control of motor positioning. Much stronger but a real hassle to get legs walking without stumbling.


* Search

* Recent Topics

Servo Calibrator by Bajdi
[May 24, 2019, 04:01:10 AM]

MKS Gen L 1.0 by Bappi
[May 21, 2019, 07:22:54 PM]

ESP32 "Life is Life" 64x32 flexible P4 RGB LED by jinx
[May 18, 2019, 11:19:44 AM]

Warco HV-4" Rotary Table by jinx
[May 08, 2019, 03:12:58 PM]

Warco WM14 milling machine by jinx
[April 28, 2019, 09:41:40 AM]

MKS GEN L Servo Issue by Reywas
[April 22, 2019, 09:10:08 PM]

Meowth Abandoned by Nemesis
[April 11, 2019, 11:08:00 AM]

Bench Power: Help a rebel out by jinx
[April 03, 2019, 04:20:10 AM]

Just a short intro... by MEgg
[March 18, 2019, 05:49:28 PM]

Yes I am alive! by jinx
[March 10, 2019, 04:38:53 AM]

CZ-1 2.0: problems, calibration and printing, part2 by MEgg
[February 26, 2019, 03:35:15 PM]

Hi, Mushroom glue here. by nschreiber0813
[February 25, 2019, 02:09:13 PM]

Arduino IK by BaldwinK
[February 25, 2019, 05:54:44 AM]

Raspberry Pi / Python eBook - free for the next 11 hours! by MEgg
[February 24, 2019, 09:49:43 AM]

Fun Fact by Impala
[February 13, 2019, 11:05:01 PM]

* Recent Posts

Re: Servo Calibrator by Bajdi
[May 24, 2019, 04:01:10 AM]

Re: Servo Calibrator by jinx
[May 22, 2019, 02:28:13 AM]

Re: MKS Gen L 1.0 by Bappi
[May 21, 2019, 07:22:54 PM]

Re: MKS Gen L 1.0 by jinx
[May 21, 2019, 03:27:08 PM]

Re: MKS Gen L 1.0 by Bappi
[May 21, 2019, 03:11:45 PM]

Servo Calibrator by BaldwinK
[May 21, 2019, 10:20:42 AM]

Re: MKS Gen L 1.0 by jinx
[May 21, 2019, 05:09:27 AM]

Re: MKS Gen L 1.0 by Bappi
[May 21, 2019, 03:34:54 AM]

Re: MKS Gen L 1.0 by jinx
[May 21, 2019, 02:28:17 AM]

Re: MKS Gen L 1.0 by Bappi
[May 20, 2019, 07:11:31 PM]

Re: MKS Gen L 1.0 by jinx
[May 20, 2019, 03:16:02 PM]

Re: MKS Gen L 1.0 by Bappi
[May 20, 2019, 02:53:00 PM]

Re: MKS Gen L 1.0 by jinx
[May 20, 2019, 03:31:49 AM]

Re: MKS Gen L 1.0 by Bappi
[May 19, 2019, 07:16:21 PM]

Re: MKS Gen L 1.0 by Bappi
[May 19, 2019, 04:04:47 PM]