Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

analog to digital

Status
Not open for further replies.
Roff / 3v0, I've said this before in other posts and I said it in this one. People can NOT assume things in this forum like that, the spectrum of users we get here is too wide to go off on such topic tangets until the poster clarifies their intent. The posts that were made were not actually helpful because they weren't related to anything the poster actually said only what people assumed he ment, which... were obviously incorrect. Mind you Mr CCE did come back a little harsh but he's a new user, hopefully he realizes the intentions were good.

3v0, people weren't supposed to think anything, a simple post to clarify his intent should have been asked for and waited on before all the comments were made. This happens quiet frequently here, some threads going on for dozens of posts after the original poster has already left the forum and things have gotten so far out of field the original discussion is completely lost because of all the tangents. I've taken part in a few of them myself, not a single one of them ended up with a beneficial ending. A few of them recently have resulted in the thread being locked and several users being banned.
 
Last edited:
Roff it's not really an opinion, it's a simple analytical view of the words that were actually USED in the original post.
hi all,

do U know a way I can convert sound into digital form (bits)? say..I want to convert some audio (from a microphone, for example) into a bit stream in order to transmit it??

thx
:confused:
Invoking simple plain common sense and logic the only appropriate answer to that post is use an analog to digital converter. The other replies were all based on the users opinion, mine was based on the actual words used without any extrapolation.
 
Sceadwian

Like it or not people respond differently to posts with text speak, math errors, or wrong assumptions. I do not see how it is wrong to explain this ?

I did not respond to the original post. I posted to explain to the original poster why he received the responses he did. It was wrong for the original poster to be upset with the answers he received or the people who posted them. Especially someone who put the effort in to explain basics.

I found asking defining questions of little use because others post without waiting for the answers. One or more of these posts may satisfy the original poster. The questions frequently go unanswered.

Getting the content and quantity of content correct when you start a thread is not easy. This holds to a larger degree for users we do not know.

If the original post is too short people read things into it or give simplistic useless answers. If the post is too long people skim it or skip it entirely.

EDIT: My post was a simple analytical view of the words that were actually USED in the original post.

3v0
 
Last edited:
Just to put things straight

Hi everyone,

Okay I now realise that I made a mistake myself and what I said was a bit stingy and it's true that my original post was not very helping for other posters to understand and tackle, so I apologise because I'm a decent young man and I should be aware that other people are just trying to help after all, so thank U for understanding.

Just to clarify things and put them straight.
 
CCE

Welcome to the forum. :D

In you original post you indicated you wanted to digitally transmit sound. The quality of the sound received depends on the number of bits the ADC and DAC pair use for each sample. The greater the number of bits the better the sound.
Even if you are shooting for poor voice quality sound the rest should be of interest. We may include foundation information because these posts are read by a wide audience² and foundation information is helpful to some people.
Another factor is the number of samples you take each second. Obviously the more samples you take the better the sound will be. I expect there is a working upper limit to this, ask the audio people.

So it would seem that an ADC with lots of bits and a large number of samples is that way to go. But this would create a huge amount of data for each second of sound.

You will be using radio transmission. If you use your 433MHz radio the raw data rate should be about 8-10bps max.³ It is obvious that you need to ballance the sample size (ADC bits) and the data rate to get the best sound possible. The lower the radio frequency the lower the raw data rate.

We talk about raw data rate because the actual data rate depends on the form of encoding. Some form of encoding is needed to at a minimum tell where on sample starts and ends. Encoding can also be used to correct errors and provide a bit stream that is more easily decoded.

Nigel has a good tutorial on Manchester encoding written in pic ASM. If you are interested in C or basic google.

I hope this was helpful.

² Google searches on many electronic questions result in links to this forum.
³ bps is bits per second and Bps is bytes per second.

3v0
 
About the encoding thing...

Hi everyone,

Actually that was very helpful and I've got a few things to determine:

- The first thing that I need to take care of is the number of bits of the sample; thing is, If I use the ADC of the PIC16F877A I'm ristricted to 10 bits, 'cause as you know the the conversion is stored in the ADRES register in which I'll have a binary representation ranging from 0 -> 1023.

- Another thing I want to know about is the encoding. Can I implement the codec pair as a separate circuit (outside the microcontroller) or is it mandatory to do it software-wise? I'm asking this because I've never done sound sampling before and I'm a bit confused about it.

thx in advance!:)
 
Well if you could explain exactly what you were trying to do this for we might be able to suggest the ideal number of bits for your samples, you can get away with low bit depth for many applications, but not for others, totally depending on your actual application. You can of course use an external codec, but again this depends on your actual needs which you've not yet determined, do you really need a complex codec, or can you get away with just transmiting the data raw without worrying about it. You need to flesh out your actual idea a little bit more.

There's nothing really complex about basic sound sampling. You feed the signal into an ADC and read it as fast as you need. Each sample is a single byte of data representing the voltage of the signal at that moment of time that it was sampled. That's it. There are many different formats and ways of dealing with audio data but you can always break it down to simple sampling and storing or sending the bytes to where you want them to be used.
 
Last edited:
The thing is...

Hi there,

Actually my real intention is for my senior project, as I'm trying to do a GSM simulation for my final year project. I just wanted to know that if I'm gonna do A/D conversion for sound is it gonna be like any other analog signal ?

Plus, I want to ask about the amplifier after the microphone; What is the best amp to use: Collector-Emitter, simple op-amp amplifiers,..., and what gain?Especially when I'm gonna feed it to the ADC module of the PIC16F877A?

thx in advance.
 
I'd recommend a simple opamp amplifier for the mic pre-amp, a decent low noise opamp is all you need. Gain will depend on the maximum signal you expect to get from the mic, an automatic gain control would circuit would be recommended if you expect a wide range. The main thing you need to keep in mind is typical micro controller ADC require positive voltages ONLY so you have to DC **** an AC signal above ground to read it, which I previously mentioned.

So basically you want the opamp (you'll probably need more than one) to amplify the signal to a -2.5 to 2.5 voltage signal from the mic with either a fixed/variable gain, or ideally an AGC circuit to control the level shifting, then you'll need to DC shift that -2.5 to 2.5 signal to 0-5 volts and make sure you have protection circuit so that those voltages limits are not violated.
 
What KIND of audio do you wish to sample? Low quality voice? Stereo sound?

1. No, the ADC alone is a problem. For one, the microphone needs bias and amplification. Two, you MUST meet the Nyquist Criteria for the sample rate used, which will mean an active filter to totally cutoff the signal near or above 2x the sample rate. Three, note that the sample rate of your ADC may or may not be enough to meet the Nyquist rate for the audio type you want.
2. 10-bit audio is not really high quality, but it is "listenable".
3. You will find the bandwidth required for high quality audio is VERY high.
4. Here's a biggie: you WILL have rate issues. Basically, the receiver is going to have its own system clock and the sample rate is going to be tied to that clock. So say it's running at 48k samples/sec. But due to the tx having a crystal running slightly differently, samples come IN at 48.1ksamp/sec. Ohhh.... what do we do with the extra 0.1 samples/sec? It's not much, but we can't just throw away an extra sample (or, if the tx is slower, add one out of nowhere), and eventually it'll overrun the input buffer... do we temporarily change the output rate like 1/min to speed up briefly and eat up a few extra samples? Well, that's a pretty bad solution, that'll be a glitch in the audio. Long story short, you need a dynamic resampler to do this right- and on a non-DSP PIC, this may be VERY difficult to do properly.
 
That's absolutely true....

Hi there,

Thanks man that's valuable stuff! I'll get right into it.

Thanks a lot again!:)
 
Let's see.....

Hi all,

I'd like to begin by a special thanks to all the professionals who are taking part in this thread in particular.

For starters, it is true that the output of the microphone needs to be DC shifted, amplified, and applied to an A/D converter -wether its an independant circuit or a module inside an mcu, it does not matter, so thanks to "Sceadwian" for his advice. Salutations man!

Now the other big issue. Well as I probably mensioned (if not in this thread then it's in another one) that I'm still a student and I'm learning more and more with every contribution you gentlemen make, so thanks. Now the sampling theory states that applying Nyquist criterion is the solution, but how to determine the frequency of random sound?(there's no silly question but there's a silly answer, right ?), if I'm gonna double it to obtain the sampling frequency?

- About the "dynamic resampler", what do you precisely mean? Is it just obtaining different sampling frequencies? and how?

- I've never used a DSP PIC but I guess this is the right time. What's the best PIC of this kind? 'cause I want to proceed as soon as possible.

And lastly, I'm gonna convert the sound samples to an 8-bit representation, and I'm not really aiming for a very high quality - stereo- surround sound type of thing (lol) so obtaining sound that is just audible is what I'm really going for.

Hope to get more of your valuable help gentlemen!

thx a lot in advance.;)
 
There is no such thing as random sound, you need to specifically determine the frequency range your application requires and define it concretely before you can proceed with designing a circuit, it's that simple. If you don't know what you want to record then you have no idea what sampling rate or bit depth you actually require so you have no place to even start from, and it will make a HUGE difference as to what you want to record as to how you need to approach it.

There are several question you need to answer. What sound do you want to record? A single person talking, a single tone, a range of tones, multiple people talking, low quality music, high quality music would be examples. If you could explain more thoroughly your actual intent we could supply better information and guidelines. We need at least a base example to start from.

A good base reference is the human voice. Sampling rate and bit depth sufficient enough to determine what a single person is saying can be as low as 8khz sampling rate (4khz Nyquist cutoff) and 4 bits of depth. You could go lower but intelligibility of the human voice decreases pretty dramatically with sampling rate lower than about 8khz. I wouldn't recommend anything less than 6khz for the human voice. That's juts one example, doesn't help you cause we don't know what you want to record.
 
Last edited:
More details...

Hi all,

Here's what I'm thinking about. I'm thinking about making a one-way telephone; what I mean is that I want a microphone to collect a person's voice, add an amplifier, A/D convert it, and then transmit the digital sound through RF.

The receiving side will D/A convert it, and do what is necessary to obtain the sound again. Now what I'm asking about is this stage; the "do what is necessary" stage, do I just amplify the analog signal and apply it to a small speaker? 'cause I don't think it's that simple. But as I said before, I'm not looking for high quality sound, audible and understandable sound is what I'm going for.

hope you understood what I want to say.thx for any future help gentlemen.

regards.;)
 
If you don't mind the wires, there's absolutely nothing wrong with using a simple analog amplifier through wires to a speaker. No need to get messy with the whole ADC DAC and micro controller for such a simple use.
 
Thing is....

Hi there,

No need to get messy with the whole ADC DAC and micro controller for such a simple use.

If so then how am I gonna transmit it? I have a digital RF module to use so I guess I have to get my hands dirty with the ADC-DAC-mcu business, unless you were talking about wired communication in which case I totally agree with you, absolutely.

regards.
 
So what are you still having problems understanding? Pretty much everything has been covered so far. As far as output on the receiver side goes just use a simple 1 bit DAC. Can you provide a link to the RF modules you're using? I thought you'd linked them before but can't find the post.
 
Digital Transmission.....

Hi there,

No actually everything's clear now, thx to all of your contributions and especially to "Sceadwian", I salute you man you've been very generous with your advice. I'm gonna finish up the project and tell you how it turns out, again, thx a lot.

regards.
 
Status
Not open for further replies.

Latest threads

Back
Top