Monday, March 16, 2015

Kaleidoscope Part Deux

I have a habit of not leaving well enough alone. After I posted my last entry, I decided to improve upon the kaleidoscope code.

Primarily I wanted to make the effect more responsive. The ping sensor is a bit of an odd beast. You get lots of false positives. This is due to the way it works - sound waves bounce of of objects and then return to the sensor. So stray noises or even a previous "ping" that bounced off of something can interfere with the readings. Getting timings right is crucial. You want to leave enough room between successive readings. You also want to average out the readings to ensure stray results get filtered out.

From my trial-and-error approach, it seems like a buffer size of 15 readings and a sleep of 0.05 seconds after a reading works best. Your mileage may vary.

I also didn't like that I couldn't show a video of the effect last time. So I tried filming during the day when there was lots of natural light. This way there would be less contrast and hopefully we'd get to see the colors coming through Robie's eyes. I think it worked out pretty well:


The updated code is available here:
https://github.com/meatheadmike/kaleidoscope_ping_sensor_demo

No comments:

Post a Comment