Go Back   Home > Forums > Source & Line > Digital Source

Digital Source Digital Players and Recorders: CD , SACD , Tape, Memory Card, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 25th February 2002, 04:07 PM   #1
diyAudio Member
 
Join Date: Feb 2002
Location: South Africa
Lightbulb digital filter using pic micro controller

hi there,
I was wondering if anybody knows how i could build a digital filter using a pic microcontroller. sombody sugested it to me and i need all the help i can get. i was requested to use the 16f877 and a frequency to voltage converter at the input of the pic.

Also can anyone tell me about the LM 311N ic. I am also working with a limited budget and time. This has to be completed by the end of April so components have to be readily available.
__________________
Thanks
vish
  Reply With Quote
Old 25th February 2002, 04:48 PM   #2
tiroth is offline tiroth  United States
diyAudio Member
 
Join Date: Dec 2001
Location: Pittsburgh, PA, USA
Is this a lo-fi proof-of-concept kind of thing for a class?
  Reply With Quote
Old 26th February 2002, 10:16 AM   #3
diyAudio Member
 
Join Date: Feb 2002
Location: South Africa
No, this project is actually my final year design project for electronic engineering. this is the last credit i need to obtain my diploma.
__________________
Thanks
vish
  Reply With Quote
Old 26th February 2002, 11:40 AM   #4
ih is offline ih
diyAudio Member
 
Join Date: Dec 2001
Location: Sydney, Australia
Send a message via ICQ to ih
What sort of digital filter are you trying to build? With a given input, what will the output be?

More information would be useful.

You can do FFT on the PIC to save using a frequency to voltage converter on the input (do they only work on a single frequency? if so, they're not suitable for audio). There's an app note on Microchip's site.

You can find info on the LM311 on the web. Type it into Google and have a read.

(man, if I asked these questions at uni, I'd get my *** kicked - and I'm only in second year :-) )
  Reply With Quote
Old 26th February 2002, 12:51 PM   #5
diyAudio Member
 
blu_line's Avatar
 
Join Date: Jan 2002
Location: The Netherlands
Hello,

If you want to do audio filtering (HIFI), just forget it.
Or you may want to use the PIC18 series (the DSPIC's)

Your I2S data, most probably, will enter your PIC with a WS of 44.1 KHz and a BCLK of 2.822 MHz.
This is serial, so you have to get in all 16 or 32 bits.
This does not leave much of processing i think when running a PIC at 20MHz.

At speach bandwidth (8khz) it is a different story.


Check www.piclist.com

grtz

Simon
  Reply With Quote
Old 26th February 2002, 03:27 PM   #6
diyAudio Member
 
Join Date: Feb 2002
Location: South Africa
hey guys, sorry about the post but its my first time.

The entire project is to build an audio amplifier +/- 50W RMS using MOSFETS. It must also include a digital filter using a micro-controller. I have the amplifier part of it sorted out but i am not sure how to build the filter and interface it to the amp.

the filter will have to be bandpass, the input to the filter will be 20Hz to 20kHz. the output will have to be some where around 30Hz to 17kHz. As for the DSPics, they are not yet available in my country.

The microchip specialist i spoke to told me to use the 16f877 and i should use the freq/volt. converter to interface the audio signal into the PIC. He also said that the d/a coverter on the PIC would only make it harder for me.

Is this a good idea or can i make it simpler to do.

thanks for all the help.
__________________
Thanks
vish
  Reply With Quote
Old 26th February 2002, 04:51 PM   #7
tiroth is offline tiroth  United States
diyAudio Member
 
Join Date: Dec 2001
Location: Pittsburgh, PA, USA
It seems that there are a number of straightforward ways of approaching this, none of which are likely to acheive any form of quality. I think your project definition is also extremely vague, at least for us forum readers. Is your project to be

line lvl analog -> black box -> line lvl analog -> amp

where the black box does the filtering in the digital domain? Why in the digital domain? Does your project plan specify flat phase response or some other quality which is difficult to achieve via active or passive filtering?

The most rational way of doing this digitally in the real world would be ADC -> TAS3001 -> DAC mediated by your uC. Probably not hi-fi, but fairly good quality. I doubt this meets the requirements of your project to show some signal processing work though.

Another option is to pick up a board like TI's c6000 series DSP eval boards. This has an on board codec (only 11kHz/16 bit-ugh) and there is free development software that could be used to create the signal processing routines. Or you could go with a SHARC but I am not familiar with these processors.

You are hoping to complete your senior design project in 2 months? I wish you the best of luck.
  Reply With Quote
Old 26th February 2002, 08:51 PM   #8
diyAudio Member
 
blu_line's Avatar
 
Join Date: Jan 2002
Location: The Netherlands
If i can come up with the name i will send it to you.
This company makes tine DSP's which are very suitbale for you needs.

The have 1K of program memory and i believe the assembler and download tool are for free.

Other suggestion :
try an fpga/EPLD.


grtz

Simon
  Reply With Quote
Old 26th February 2002, 10:09 PM   #9
ih is offline ih
diyAudio Member
 
Join Date: Dec 2001
Location: Sydney, Australia
Send a message via ICQ to ih
Default checking the requirements more carefully...

Quote:
The entire project is to build an audio amplifier +/- 50W RMS using MOSFETS. It must also include a digital filter using a micro-controller. I have the amplifier part of it sorted out but i am not sure how to build the filter and interface it to the amp.
+/-50W RMS? Do you mean 50W RMS, or running from supply rails of +/-50W DC? (I'm guessing the former, in which case you shouldn't have any trouble whatsoever).

Digital filter using a microcontroller - that's pretty specific. And you need pretty beefy microcontrollers if you want to achieve any sort of quality. If I were you, I'd go out and buy or order one of everything that you can get your hands on, and figure out what you're going to do with them later.

Quote:
the filter will have to be bandpass, the input to the filter will be 20Hz to 20kHz. the output will have to be some where around 30Hz to 17kHz. As for the DSPics, they are not yet available in my country.
This is pretty easy to do in analog, but a pain in digital, unless you have a lot of CPU power to throw around. Again, take a look at Microchip's website and find the application note that gives code for FFT on a PIC. There's tons more useful stuff, if you look around.

Have you ever programmed a PIC before? The architecture is somewhat different to most microcontrollers. Some people feel that they're very restrictive. (I learnt PIC assembly before any other type, so I feel that PIC is very efficient, but everything else is very flexible )

If you find that your PIC has enough power, your project sounds like it would be done by FFT'ing the input (using one of the PIC ADC channels - only 8-10 bit, though), zeroing out the frequency bands outside the desired range, and converting back to the time domain (I'm not sure if the same FFT algorithm will do that - I failed Signals and Systems, damnit!)

I seriously doubt that any non-DSPIC will have enough grunt for that, though. Or give you enough frequency bands to be useful, for that matter.

Quote:
The microchip specialist i spoke to told me to use the 16f877 and i should use the freq/volt. converter to interface the audio signal into the PIC. He also said that the d/a coverter on the PIC would only make it harder for me.
I would say that the 16F877 is rather small for this application, unless you can do the conversion to and from time domain outside the PIC. It's 20MHz, but executes instructions once every four clock cycles, so you only get 5M instructions per second. RAM is a big problem too - only 384 bytes to play with - and I would expect that you'd want a good chunk of that for the frequency data.

A frequency to voltage converter is no good if you want, say, music signals to be legible at the output. You could move the frequency threshold continuously to achieve a really dodgy fourier transform, but the F-V converter needs a certain amount of time to do its job, and the signal will change over that period. It'll sound bad, to put it simply, if it works at all.

A single sinewave would probably be OK, though.

The ADC converter on the PIC is about as simple to use as you can possibly make it. Apply analog voltage on pin X, read digital representation on memory address Y. It's what happens after that which will be the challenge.
  Reply With Quote
Old 26th February 2002, 11:06 PM   #10
Banned
 
Join Date: Feb 2002
Location: Dallas,Texas
Unhappy Digtal filter

Should you figure out what you are try to do before how you are going to do it. Do you have a block diagram or specification. I think you might be up bit creek without an algorithm.

H.H.
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FIR Digital Filter DSP neededandwanted Parts 1 9th April 2009 01:44 AM
Modular dac project with micro controller and lcd cviller Digital Source 10 2nd January 2007 07:06 PM
Micro-Cap Electronic Analog/Digital Circuit Analysis Program Franklin Swap Meet 0 24th June 2004 07:18 AM
Digital (DSP) filter magnus Digital Source 12 9th February 2003 12:17 PM


New To Site? Need Help?

All times are GMT. The time now is 05:04 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2