Here's a simple see-saw bot made from two Microbric Viper kits. You need the 2 kits to get the 2 linetrackers.
Posted on a forum at the company web page there was an interesting challenge to make a Segway from the Viper kit. The first successful entry used a neutrally-stable configuration. A bit of a cheat (and I'm NOT against cheating!), I thought.
So I created this see-saw to experiment with unstable configurations. The batteries are mounted above the CoM, and the wheels are mounted below. At each end there's a line-tracker to decide whether that end is near the mat. A button and speaker are also attached to start/stop the thing (you don't want it wiggling when you are trying to put it away!) and to make a squeak when it wants attention.
The line-trackers from Microbric have a little hole to config them. You stick your provided screwdriver in there and point the thing at a "black" surface and a "white" surface when it flashes an indicator light.
For this application I wanted the tracker to signal "1" when it was close to a reflecting surface and "0" when it was pointing at "infinity". In this h/w "infinity" is about 15 mm.
Anyway, the config is backwards from the usual linetracker setting ("1" when it sees black), but the h/w worked fine. It could detect the white activity mat (or, alternatively, brown carpet) from about 10 mm (5 mm).
Originally I had the trackers offset & under-slung to get closer to the floor. But this turned out not to be needed.
As usual, the main trickery is the s/w. A simple problem, you think? Maybe.
The s/w solves the equations of motion of a see-saw using an Euler method (i.e. the simplest
and uses the hit times from the front and back sensors to estimate the physical and geometric parameters of the little system — i.e. the speed of the motors, the local gravity (you never know when you're going to take a trip to Moon, for example, and you'd want the same s/w to work there!), and the turning moment of the mobo about the axle.
Anyway… a bit of playing around (no, it didn't work properly the first few times
and the little bot learns to balance.
Using the equations-of-motion method (Langrangian mechanics 101
allows it to act predictively, rather than reactively. Quite a difference in behaviour.
As an added bonus, I hacked the code a bit more so it also tries to stay close to its starting point. Otherwise it has a tendency to wander all over the room, bumping into things, getting stuck when in backs into a wall or a wheel gets stuck on a pencil or power-cord, and madly trying to squirm out of your hand when you try to pick it up.
Those little moters can deliver a reasonable impulse! Early versions of the s/w threatened to break off the linetrackers as it snapped the see-saw back and forward, whack…whack…whack. But it's feeling much better now.
Here are a few stills from my still-crappy hi-tech webcam. As an indication of scale, the wheels are about 5 cm in diam.
Mr Balance-bot in mid-swing:
Mr Balance-bot nearly hit bottom:
Mr Balance-bot hits bottom again (there is usually more than one way to hit bottom):

