Hello, I built an electric motorcycle this past summer; and I want to use arduino to create artificial motor noise.
My throttle is a 0-5kohm potentiometer. I was thinking of wiring the arduino to those inputs in parallel to adjust the frequency of a looping sound file from a sd card or right on the arduino's ram.
Ideally I could spice the audio from a star wars landspeeder, upload it to the arudino, and have the frequency adjust when I pull on the throttle. The result would be artificial motor noise, with the sound output changing as my speed increases.
i am a complete novice to arduino, and ideas on where to start or if this is feasible?
My throttle is a 0-5kohm potentiometer.
You'll need to know the voltage coming out of the pot. Do you have a multimeter/
Ideally I could spice the audio from a star wars landspeeder, upload it to the arudino, and have the frequency adjust when I pull on the throttle.
I don't know what a landspeeder sounds like.* You can get an audio shield (which has the memory and all of the audio circuitry to play WAV or MP3 files, except you'll need to add a power amplifier to drive the speaker).
Then, you can control playback with the Arduino. Volume control should be easy, but varying pitch/frequency is not as easy... It's easy if you can vary the sample rate (i.e. 44.1kHz), but pre-made audio shields are designed to run at standard frequencies (whatever the WAV or MP3 says in it's file-header).
Normally when you vary the pitch of an audio file with a computer, it gets re-sampled and I don't think the Arduino has enough processing power for real-time re-sampling. And, normal audio shields wouldn't allow you to read the audio file and process before feeding it the DAC.
You can generate "tones" (square & rectangular waves) directly in software, and you can have full-control over the frequency, and you wouldn't need an audio shield. But, you would need a digital pot (or something) to control volume. And, you can get some "interesting' sounds by varying the pulse width and mixing two or more tones together.
The normal tone() function doesn't allow you to change the pulse width, but if you want to experiment you can start by modifying the Blink LED example to run at audio frequencies and you can change the pulse width by varying the on & off times separately.P.S.
You might get some interesting/usable sounds by simply connecting an audio amplifier to the motor drive voltage. The pitch of the electrical noise should be proportional to motor speed. ...You's need a capacitor in series to filter-out the DC (leaving just the noise) and you might need some protection circuitry to protect the amp.
* I prefer Spaceballs to Star Wars! :D :D :D
Thanks for the response, I don't have a working multimeter currently but I believe that the throttle can work with 0-5v input. However the leads I am using (it has 3) makes it function just as a variable resistor with 0-5kohms.
I am putting in a separate audio system, hopefully with a sub-woofer, so I'll just have a 3.5mm jack go from the arduino to the audio amp. Volume control will be done off the audio amp.
If the arduino isn't powerful enough maybe a rasperry pi may be feasible. Ideally I want users to have the ability to put any sound file they want, from jet engines to ferraris.