I am just start to play around with the new Arduino Tone library, when I realize that I have no sound transducer laying around here. Than I remember an old hack that someone did with the Asuro robot (many thanks to ArexxHank and stochri). Making sound with the DC motors. So I grab one of my actual robots, the Ardubot and began to port the sound function to my current setup. Mixed together with the examples from the Tone library and here is the result.
How it works:
The trick is quite simple and should be work with every robot that uses a normal H-Bridge as motor driver. PWM is not needed here, just the direction pins to move the motors forward and backward. If you use PWM for your H-bridge, you can additionally control the amplitude of the generated sound. You need to switch the motors between forward and backward with the desired frequency. The motor will not start running, just begin beeping at this frequency. The frequency range is not as wide than a speaker, but it's ok.
Oh yes, the good old Oh yes, the good old computer stone age. I think a lot of hacks for this old machines may work with actual robot hardware. Worth to look at it, before these knowledge is lost forever in the deap space of the WWW.
Oh, I just got to think of this; I actually controlled a servo and a motor on same "channel" on bernhard The Cuplifter.
The servo did not mind if the signal was just on or off, and the motor did not mind if it was getting a small pulse. It may have made a sound though, I cannot remember, and they always makes all sorts of noise.
Point is; You might be able to drive AND play, if you just let the state be ON after last PWM. if you do it on both motors it could be stereo and harmonies, while driving around. Awsome!
I don’t know if this will work, to drive AND play. Should give it a try.
Just working on a stereo version, but without success at the moment. I remember another sound effect with the motors of the Asuro. When you hold your hand above it it begins to make sound like a steam locomotive. But I don’t have the sourcecode for this, only a hex file.
Another alternative is to Another alternative is to drive the motors with PWM, that way you can adjust the PWM frequency to change the pitch of the sound, and change the PWM duty cycle to change the motor’s speed. As long as the PWM duty cycle never reaches 0% or 100% the sound will still work. In the special case where you don’t want the motors to move at all when a sound is made you can use an alternative routine like the one you already have that alternates the drive direction.
Hi, I’d like to try this project but the Zip file link is down. Would you be able to send this infomation and code to me to [email protected]? I see the code is listed but I’m new to Arduino so I’m unsure as to what it will take to complete tis code.