Go Down

Topic: Using 3.5 mm headset for the output audio for the arduino (Read 6614 times) previous topic - next topic

ermu923

Good day! We are making a project which includes audio processing.
Our output audio will be an 8-bit 8kHz mono audio coming from PWM pin 11 of the UNO and we want to use a 3.5mm headset as an output device.
I have searched the web but I only found 8ohm speaker connected to a resistor as a suitable output device for these kinds of projects. Can we do the same with the headset? Or are there any ways to incorporate the headset as the output device?

DVDdoug

Quote
I have searched the web but I only found 8ohm speaker connected to a resistor as a suitable output device for these kinds of projects. Can we do the same with the headset?
Yes, use a resistor.    Headphones are typically 32-64 Ohms, and the minimum resistance for the Arduino is 125 Ohms  (40mA @ 5V).

You may want higher resistance or a pot (maybe 100 Ohms) in addition to the resistor in case it's too loud.

A speaker will generally be too quiet with a resistor, but with the headphone right next to your ear it may be too loud.

Quote
Our output audio will be an 8-bit 8kHz mono audio coming from PWM
That's going to be fairly low quality, but it depends on what you're trying to do.


ermu923

You may want higher resistance or a pot (maybe 100 Ohms) in addition to the resistor in case it's too loud.
What do you mean? Should I use the said 8 ohms resistor then series it with another 100 ohm resistance?

Would it make a big difference if we use only 1 resistor (Probably about 125 ohms or higher)?

That's going to be fairly low quality, but it depends on what you're trying to do.
It's alright. UNO has a fairly low flash memory (32kb) and we just want to utilize it to store as many audio files as possible.  So sound quality is not really an issue.

CrossRoads

Quote
as many audio files as possible.
Arduino memory can only store a fraction of a second.


You could make tones & stuff from a PWM pin, be a software challenge for much else.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

ermu923

Yeah we just realized that a while ago. Only stored a 2 sec recording :/

Can you suggest other ways to approach the project? We're thinking about using a SD card shield but at the moment, none of us are knowledgeable about connecting shields to our Arduino. Yeah, we're just new to the Arduino world.

DVDdoug

I suggest using regular "powered" computer speakers while you develop your software (and hardware).   These present a high impedance load (no problem for the Arduino) and they will have a volume control.

After the software is working, you can work on driving headphones.    You might want to do it the "right way" and add a headphone amplifier, but that can wait...

Quote
What do you mean? Should I use the said 8 ohms resistor then series it with another 100 ohm resistance?

Would it make a big difference if we use only 1 resistor (Probably about 125 ohms or higher)?]
Nobody said anything about an 8 Ohm resistor....    You only need one resistor in series with the headphones/speaker to limit the current. 

Resistances in series add-up.   So, the total load is the sum of the resistor and your headphones/speaker.  Higher resistance means less current and the sound will be quieter.       

Have you tried the tone() function to test the loudness?    Will you need to adjust the volume?

Don't worry about the pot unless you need it.    If you add a pot, put the pot after  the series resistor.   Look at the "volume control" on Figure 6 of this page.    The signal goes through  the current limiting resistor, then into the in   connection on the pot.    The speaker/headphone connects to the out  connection on the pot (and to ground).

Quote
Can you suggest other ways to approach the project? We're thinking about using a SD card shield but at the moment, none of us are knowledgeable about connecting shields to our Arduino. Yeah, we're just new to the Arduino world.
I can't help you with that, but I'd look for a "WAV shield or "MP3 shield".     (I have never used an audio shield either).


If you get an audio shield, check it's drive capabilities (current or impedance), since it will be driving the headphones/speakers instead of the Arduino.


Do you want to "process" sound or "play" sound?   What are you really  trying to accomplish?

ermu923

What we are really trying to accomplish is "playback" the audio stored in the Arduino's flash memory through a headset. We cant use other speakers since we want the project to be portable so our only option are the headsets.

I'm sorry if my first post was quite misleading. We processed our audio thru PC softwares like Audacity and converted in to numbers using EncodeAudio PC application, put those numbers in the sketch using PCM library and we want it to "playback" the audio once a condition specified in the code is met.

But now we're having a hard time and we are considering the use of SD card shields for it to be the storage of our audio.

Go Up