Google+ Followers

Monday, January 12, 2015

62. Exploring the Pi B+'s Ports VIII - Self-Levelling Platform

30,000 page views!!
All I did was re-arrange the two servos which I used in the last post, and fix the GY-521 board on top of a horizontal platform, by screwing it to a piece of plastic which I then glued to the platform.  The platform consists of a dummy CD with a plastic yoghurt pot lid on top.  A 4-core cable connects the device to the Pi and the Adafruit 16 Channel 12 Bit PWM and Servo Driver Breakout Board, through a hole in the platform.

This is the top view of the platform with the GY-521 on top.  You can see the connecting pins and the first four on the left are connected through the hole directly below.

This is the view from below the platform, one servo fixed on top of the upright pillar, and the upper one fixed to the underside (the dummy CD) of the platform.  The rotors of the two servos have been glued together so that when the lower servo's rotor rotates, (about the y-axis) the entire structure above, including the top servo, rotates.  Rotation of the platform about the x-axis is achieved by having the rotation plane of the upper servo perpendicular to that of the lower servo.

The software at this point has not been changed significantly from that in the previous post, but if you look at the video below, you'll see that the platform does correct for tilts in the x- and y- directions.  I did some tweaking to make it more sensitive and responsive.  I just wanted to put it on record at this point in case I broke something and missed the opportunity:

The software was adjusted to make the servos move correctly.  So far I have tried changing the value of τ in the expression


α = τ/(τ + Δt), 


from 500 ms to 1 second, and I have applied a factor of 1.5 to the variable slope which is used in the calculation of roll and pitch, and this seems to have improved the performance.

You may notice some jitter in the movement which I managed to reduce a little by increasing the time constant τ as I mentioned above.

And yes - you spotted it - it's a Draft Guinness widget rolling about on the top!  You may even be able to spot some of the precious liquid leaking from the widget onto the yoghurt carton lid.

However, no doubt I could find a better feedback mechanism, and if any one out there has any suggestions, I would love to hear from you.



No comments:

Post a Comment