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.

Six channel A/D conversion plus USB

Status
Not open for further replies.

Larkland

New Member
Hello all.

I would like to be able to sample six channels of audio and send the audio to a computer via USB.

The audio does not have to be of pristine quality, but "stops and starts" would be a problem. The data should be regularly sampled.

I'm not experienced with PICs. From searching around it seems that most PICs would have multiplexed A/D, with only one A/D converter, of which the channel has to be selected before sampling. So that means that, say, 8000 times a second I have to change the A/D channel and sample a value, plus I have to send the data down the USB line.

From what I've read, I have a serious problem in terms of speed, and would guess that standard PIC chips would not manage this. I'd also have trouble, I would guess, with the total data throughput with USB.

I'm aware that I will have to have some analogue filtering ahead of sampling to prevent aliasing.l

Can anyone advise? Is such an application feasible with PICs?

If not, to what degree would I have to reduce the number of inputs before it's likely to work?
 
We would be sampling the output of a hex guitar pickup. Not yet sure on the required sampling rate and bit width, but at a wild guess, 8Khz @ 12 bit would be fine. In terms of USB bandwidth, 6x 8Khz @ 12 bit is less bandwidth than one mono 48Khz 16 bit channel. And USB audio can handle many 48Khz 16bit channels.

I'd presume that I'd need to sample the a/d values in an interrupt running @8Khz, and put the values in a ring buffer ready for output. So I'd need to be able to sample the six values in the time of a single interrupt

I could just buy an interface, yes. But the whole point of the exercise is to build it using a PIC. E.g. similar to how it wasn't necessary to design the edrum mentioned elsewhere in this forum as the designer could have just bought some electronic drums. The project, if we start it, would also be to design very simple hardware that pretty well unskilled people could build. I see things like this:

**broken link removed**

and hope that it would be possible to add a/d to that without much more in circuitry, though with the small output from guitar pickups, I'm guessing some amplification may be necessary before sampling.

I have access to a development board with a dsPIC30f3011 in it. I suppose I could use that to see if the interrupt can run fast enough even if nothing is connected to the inputs.
 
We would be sampling the output of a hex guitar pickup. Not yet sure on the required sampling rate and bit width, but at a wild guess, 8Khz @ 12 bit would be fine. In terms of USB bandwidth, 6x 8Khz @ 12 bit is less bandwidth than one mono 48Khz 16 bit channel. And USB audio can handle many 48Khz 16bit channels.

Well PIC's are usually 10 bit A2D, which would be plenty for a guitar anyway.

As for USB's audio capabilities, USB audio cards are usually only two channel, with higher numbers of channels moving to Firewire instead.

and hope that it would be possible to add a/d to that without much more in circuitry, though with the small output from guitar pickups, I'm guessing some amplification may be necessary before sampling.

Yes, you will have to amplify the outputs, but it's absolutely critical that you don't EVER clip the A2D - it gives seriously horrible distortion.
 
My "in my head" design includes a small gain pot for each channel. I don't want to add a clipping LED for each channel ahead of the a/d as that's even more "stuff" to go in the electronics. If I can give away, say, 2 bits resolution, then I can do "virtual" clipping detection computer side by describing anything over n-2 bits as clipping.

Looking at these pages: 40 MIPS DSC - CPU Speed - 16-bit Microcontrollers and Digital Signal Controllers

I note that devices typically have 500ksps, I presume "kilosamples per second". So, even if the switching reduces the speed to 1/10th of the maximum speed, that would still be feasible. There are also some chips, such as the dsPIC33FJ256GP710, which say:

2-A/D
32 x 12-bit @ 500 (ksps)

I presume that means that the chip has two independent A/Ds with 16 way multiplexing each. But the detailed specs say something about 2, 4, or 8 simultaneous samples. Not sure what this means.

But, no USB on this chip.

Oh, none of the USB chips have fast (>=500ksps) sampling @ 12 bit or more. Only at 50ksps, which is more marginal.

I suppose another way to set levels would be to have a software scope on the computer side and for the user to spot clipping manually.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top