Emulating rusty joints

Hi!

I want to make a robot out of cardboard, and then I think it would be cool if I could make it sound like it has rusty joints. In other words I want to be able to have the robot play a sound of a joint squeaking whenever it moves its joints. I don't know if or how this would be possible. I am really new to arduino, so I am really just guessing about how the logic works.

I have thought a lot about how I can best detect the movement of the joints. Proximity sensor? Motion sensor? Probably a flex sensor maybe? But there's some problems. I don't want to play sounds from every little movement, only when the joint actually moves like at least a centimeter (So it wouldnt be superannoying to listen to squeaking all the time). So I guess I could program it to just play a sound when the sensor detects movement over 1 cm. Then I wouldn't get any sound for the first cm of movement, but I don't see any way of fixing this.

And then, of course I want to sound to stop every time the joint stops moving. So this means the arduino couldn't just play a sound file everytime it detects movement, but it would also have to stop playing it whenever it no longer detects any movement. Might be possible, but it would also maybe sound bad, because the sound should preferably have a little fade when it stops, and not just instantly disappear. This might also be possible? I don't know.

I guess the real problem is doing this in real time? Because the sounds should come when the joints move, but I don't see how I can let the arduino know fast enough to play the sound. So it might just seem lagging and weird and not work at all.

If anyone have any theories as to how I might solve this, if it's at all possible, what sensors I might need, or if I could solve the problem a whole different way, I would really appreaciate it. Thanks!

Fun idea. What commands the robot to move? Another Arduino? Intercept the commands there to generate the squeaks.

An MP3 shield may be able to do it, if it responds to commands fast enough. But you only need tiny tiny samples of sound. It may be possible to do in the Arduino with no external storage. 0.5 seconds of squeak sound can be repeated and even if the repetition is noticeable, that adds to the effect: "squika-squika-squika..."

I would start with a Teensy and a Prop Shield. That has the audio amplifier on board and a lot of software audio tools that the regular Arduinos don't have.

Ah, thanks for the suggestion. I realize I left out a very important piece of information in my post. It's actually supposed to be a robot puppet. So what I want is for something to sense when I myself move the joints. That's why I will need some sort of sensor to generate the signal for the command. Interesting idea just going with short soundclips because it doesnt really matter if it's noticable, yes.

If I'm not mistaken, I might be able to get close to what I want with a flex sensor, and give the arduino a command that says that when the sensor changes how much it is flexed, it will play a 0.5 second squeak?
Maybe if I experiment with that idea I might get a result that sounds ok.

Any more thoughts on the matter will be appreaciated!

Rotational sensing has lots of options. You can spend $hundreds or only a few bucks, depending on what you need. So here's a bit of a decision tree to select a sensor. You have told me enough about the project that I can answer all these questions...

Is anyone going to get hurt if it malfunctions? (NO)

Do you need absolute position? Do you need to know where your robot arm is pointing after a power outage? (NO)

Do you need a "home position" so that you can determine absolute position after doing a "homing movement"? (NO)

Does it move more than 360 degrees? (NO)

How fast? (0.1-10 RPM)

Do you need to know the direction it's moving, when it moves? (NO)

Do you need to know the speed? (MAYBE NOT)

Are there big magnets nearby? (NO)

Is it in a dirty environment? Will optical sensors get covered in dust? (A LITTLE)

Any other packaging/sizing considerations? (CARDBOARD)

Now, I'm imagining that the cardboard joints are mostly flat. Like 2 pieces of cardboard box with a pin or nail making the pivot. My suggestion below is not going to work if the hinge is a single piece of cardboard that just bends along a line.

The [QRE1113 optical sensor available from Sparkfun[/ur] and other vendors is a simple way of seeing if something close to the sensor is moving. Cut a little "window" in one of the cardboard pieces so you can see the other one through the hole. Grab a marker or paintbrush and draw a line or dot on the other piece. Move it a little and draw another line. Keep going until you have alternating dark and light lines all the way around the normal rotation arc. The darkness and lightness are important - use white or silver paint if the cardboard is dark.

Now hot-glue the tiny PCB into the window so the sensor is looking at the lines which are sliding above the window. It can't tell which way it's moving but it will let the Arduino "see" that there's a change when each line slides past. Now just play the noise once for each change.

](SparkFun Line Sensor Breakout - QRE1113 (Analog) - ROB-09453 - SparkFun Electronics)