Robot Projects => Stationary => Topic started by: BaldwinK on December 28, 2016, 10:51:10 AM

Title: Four Motor Leg Module
Post by: BaldwinK 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 301 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.
Title: Re: Four Motor Leg Module
Post by: DWRobotics 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! :
Title: Re: Four Motor Leg Module
Post by: BaldwinK 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.