Pages

Nov 23, 2006

Binaural Spike

I’ve had a lot of fun with Spike throughout the year and thought it would be neat to give Spike the ability to not only respond to loud noises, but also move (and if necessary, turn) towards the loudest noise.

I’m pretty fond of using pairs of sensors to give robots more sophisticated behaviour. For example, a soccer robot with two light sensors can keep track of where a ball is (and to which side it has been lost) much more effectively than a soccer robot with one light sensor.

The Roman philosopher Epictetus is usually credited for the saying, 'we have two ears and one mouth so that we can listen twice as much as we speak.' Maybe in the case of a Spike with two sound sensors this should be, 'we have two sound sensors and one stinger so that we can listen twice as much as we strike!'

I started writing a program for Binaural Spike using a subsumption architecture idea in NXT-G, but found working with nested loops and switches (and global variables to pass data between MyBlocks!) much too frustrating. I gave up and switched to RobotC – and found it much easier…

Admittedly, the program is far more complicated than it needs to be, and doesn’t quite work 100% of the time. (By comparison, with a just a little help, my 5-year old son made a pretty decent program for Binaural Spike using NXT-G in about 10 minutes that works fine.)

One of the biggest problems I had was with the sensitivity of the sound sensors. If the threshold is set too low, then Spike ends up responding to the sound of his own motors. If the threshold is too high, then both sound sensors respond to the noise and Spike goes forward rather than turning. One part of the solution must be to shield the sound sensors more effectively, so I’d love to hear from anyone who has a clever way of doing this.

Rob

PS: If you’re expecting to program Spike using the USB cable, I’ve found that it’s a lot easier to get to the USB port if you reverse the direction of the NXT compared to the direction indicated in LEGO’s building plans.

7 comments:

Max
said...

Hey Rob,

If you want your version of Spike to react on sound coming from different directions, you'll need to place the sound sensors in different directions as well. Try placing one sensor on the far front of Spike, and the other one on Spike's back. Make sure the sound sensors are facing away from each other.

Then, you can make a simple program that compares the sound levels of Sound Sensor 01 to the sound levels of Sound Sensor 02 and depending on which sensor is receiving highest volume of sound, Spike will either do a 180 degree turn or stay in place.

This can be even more fun if you'd have 4 sound sensors so you could place one at each angle to give your robot even better directional hearing.

Max, I think having the sensors pointing forward and back would make it easier to discriminate between them, but I'd much rather have a behaviour that would allow Spike to zero in on a sound source... so that he can attack it! As a teacher, I can think of many occasions where that would've been handy... (-:

It would be fun to work with more sound sensors, but I've only got access to two at present.

Maniac, I like the idea of simply having Spike disregard the sound sensors while he's moving. I was so obsessed with having Spike move smoothly towards the target, that I completly overlooked this possibility... d'oh!

Incidentally, my RobotC program for Binaural Spike is now available from...http://www.brickshelf.com/cgi-bin/gallery.cgi?f=217058

You can use a telescope limiter (blocks that form a tunnel around the mic) to get better directionality or better yet put a shield between the mics to cut sound from either angle to increase the difference between L/R sounds until it faces forward.

You could use Styro or something to isolate the motors but i like the ON/OFF change in behavior.A little more complexity could allow the mics to CHANGE threshold when the motors are on or off. Thus it could still track a little bit when motors are running. You could even make the threshold a mathematical relation to the strength of the 2 motors (a low power motor has a lesser threshold and better accuracy while a higher motor power would blind it self more but only as much as needed)

That would of course only be needed if motor speeds varried. You could use trial and error to perfect a program which turns MORE or faster when the difference between the sensors are the larger.

Books

Subscribe To

Follow by Email

ADULTS/PARENTS: We remove any inappropriate comments/postings as fast as possible. The LEGO® MINDSTORMS® NXT system is for all ages, but it is our goal to provide a blog that is useful to the youngest of tinkerers.

LEGO, MINDSTORMS, RCX, and NXT are registered trademarks of The LEGO Group.