Author Topic: Multi Effects Pedal  (Read 26149 times)

0 Members and 1 Guest are viewing this topic.

MstrKurt

Re: Multi Effects Pedal
« Reply #40 on: January 07, 2014, 12:47:16 PM »
Hey Digital Larry,
thanks for the input, I will look in to this when I'm back in the lab tomorrow :).

I managed to get a cleanish signal through the PIC today but with what sounded like slight distortion. Will see if the problem persists when I clean up the breadboard (shorten wires etc).

I also noticed the DAC has a + and - Would I need to merge the two channels so the full wave arrives at the output?.

MstrKurt

Re: Multi Effects Pedal
« Reply #41 on: January 08, 2014, 10:12:25 AM »
I'm still getting a rather distorted signal from the DAC after adding an op amp, and biasing.

The 2 DAC outputs +/- are confusing. The + pin has the positive half cycle, but no negative half and clips at around -100mv and vice verse for the -

Perhaps the DAC isn't sampling at it's maximum rate?.

EDIT: Digital Larry, what did you mean by a non inverting stage? Isn't the op amp I'm using already in Non Inverting mode?

EDIT 2: Here's an updated Circuit Diagram


ALSO: I think I'm getting attenuation after the differential amplifier somehow, shouldn't the gain be 1 since all resistor values are identical = no change to the signal in terms of amplitude?
« Last Edit: January 09, 2014, 01:21:51 AM by MstrKurt »

Digital Larry

Re: Multi Effects Pedal
« Reply #42 on: January 10, 2014, 04:07:36 PM »
Ah, yes you're correct, you ARE already using a non inverting stage.  Sorry, sometimes I look at these things really quickly and pop off with some half baked response.  So in that case I'd suggest 2.2M resistors in place of the 100ks to give you the Vcc/2 bias voltage, as 2 of these in parallel would be just over 1 Meg which is usually OK for pickup loading.
Digital Larry
Holy City Audio - home of SpinCAD Designer
http://www.holycityaudio.com

MstrKurt

Re: Multi Effects Pedal
« Reply #43 on: January 11, 2014, 05:01:00 AM »
Ok, thanks for the input Digital Larry.

While browsing over this circuit, I may have stumbled on to why I'm only getting a positive half cycle of the wave out of the DAC. I've put a Capacitor before the ADC (Labelled on the circuit as C6). Wouldn't this remove the DC biasing done beforehand?.

Also can anyone explain to my why the DAC has 2 outputs a + and a -?. I'm not able to find a good explanation of why this is there.

Digital Larry

Re: Multi Effects Pedal
« Reply #44 on: January 11, 2014, 09:33:43 AM »
You're correct that the cap removes the DC bias and since the PIC only has a single supply, it will (probably) clip any signal going below zero.

I only say "probably" because I didn't read all 88 pages of the ADC application note, and I've never used the PIC, but it seems a reasonable place to start (biasing the input).  

http://ww1.microchip.com/downloads/en/DeviceDoc/70183D.pdf

Regarding the DAC differential output, check figure 33-5 in this document:  http://ww1.microchip.com/downloads/en/DeviceDoc/70211B.pdf

Normally that would be done to reduce common mode noise getting into the buffered DAC output (post op-amp).


« Last Edit: January 11, 2014, 09:49:09 AM by Digital Larry »
Digital Larry
Holy City Audio - home of SpinCAD Designer
http://www.holycityaudio.com

slacker

Re: Multi Effects Pedal
« Reply #45 on: January 11, 2014, 09:38:33 AM »
Yes the cap C6 removes the DC biasing, you can't just remove it though. Your opamp is running on 5 Volts with the signal biased to the mid point by R3 and R4, so the signal is biased around 2.5 Volts. The PIC needs the signal to be biased around half its supply which is 3.3/2 = 1.65 Volts, if you add the thing I drew earlier between the output of the opamp and the analogue input on the PIC it will bias the signal correctly.

EDIT: posted the same time as DL.

Your output stage is wrong as well, the bottom of R10 should go to half the PIC's supply Voltage not ground. See the appnote Larry posted.
« Last Edit: January 11, 2014, 09:41:52 AM by slacker »

MstrKurt

Re: Multi Effects Pedal
« Reply #46 on: January 12, 2014, 01:04:46 PM »
Thanks once again to both of you for your input, I will look to see if I can finally get a clean signal through on Tuesday when I get access to the lab.

Does anyone know if those pocket oscilloscopes are good enough to monitor wave forms for these type of projects?

And would anyone know for a relatively cheap variable DC PSU with a built in function generator?.

Thanks!.

MstrKurt

Re: Multi Effects Pedal
« Reply #47 on: January 14, 2014, 12:58:40 PM »
Clean signal achieved :)

I biased the input correctly and removed the Diff Amp for the time being and it sounds great so far. I also managed to get distortion working by using a clipping point which doesn't sound all that bad!.

I'm working on getting delay working now by using the delay line Pottul provided but I'm struggling.

slacker

Re: Multi Effects Pedal
« Reply #48 on: January 14, 2014, 01:11:40 PM »
Excellent glad to see you're making progress.

MstrKurt

Re: Multi Effects Pedal
« Reply #49 on: January 15, 2014, 12:12:09 PM »
Would anyone know how I can make a simple delay line that gives the longest amount of delay possible for a dsPIC33FJ128GP802's internal RAM

slacker

Re: Multi Effects Pedal
« Reply #50 on: January 16, 2014, 01:39:25 PM »
Try this, there's probably better ways to do it but this works. I've tried this on a dspic33FJ64GP202 which is similar to what you're using and this is the longest delay I can make using this method, you've got twice as much RAM so you might be able to increase the length. How much delay this gives you depends on your sample rate, I'm running at 32KHz so it gives me about 90ms. This is a  circular buffer with a counter that steps through the stages writing a new sample in and reading one out, hopefully the code is pretty self explanatory.

Stick all this in your ISR or whatever you're using to run the ADC or DAC. You may need to make a few changes to make it fit what you're doing.

Code: [Select]
#define length 3000 //length of delay in samples
static unsigned int writeaddress = 0; //address to write sample to
static unsigned int readaddress; //address to read sample from
static signed int delayline[length]; //set up an array of signed ints of "length" number of samples

writeaddress++;
if(writeaddress == length)
writeaddress = 0;

readaddress = writeaddress + 1;
if(readaddress == length)
readaddress = 0;

delayline[writeaddress] = sample_in; //sample could be the output from the ADC
sample_out = delayline[readaddress]; //sampleout could go to the DAC
« Last Edit: January 16, 2014, 01:43:49 PM by slacker »

MstrKurt

Re: Multi Effects Pedal
« Reply #51 on: January 17, 2014, 07:11:39 AM »
Thank you very much, Slacker!.

Based on initial code, I think it's working however it's difficult to hear the short delay. I have tried increasing the length from 3000 to 6000 but I get this error:

build/default/production/Main.o: Link Error: Could not allocate section .nbss, size = 12008 bytes, attributes = bss near
 Link Error: Could not allocate data memory

But isn't that saying 12008 bytes are required, when I have 16384 bytes of RAM?.

EDIT: Nevermind, I fixed it by changing the memory model to "Large data".
« Last Edit: January 17, 2014, 07:15:05 AM by MstrKurt »

slacker

Re: Re: Re: Multi Effects Pedal
« Reply #52 on: January 17, 2014, 07:37:07 PM »
EDIT: Nevermind, I fixed it by changing the memory model to "Large data".

Interesting, how do you do that?

MstrKurt

Re: Multi Effects Pedal
« Reply #53 on: January 18, 2014, 03:18:21 PM »
Sorry I'm late replying,

Right click the project name>properties>C30 (Global Options)>pic30-gcc>set option categories to Memory Model>Change Data model to Large data model.

slacker

Re: Multi Effects Pedal
« Reply #54 on: January 19, 2014, 01:25:44 PM »
Thanks for that, how much extra memory did it allow you to use?

MstrKurt

Re: Multi Effects Pedal
« Reply #55 on: January 19, 2014, 03:39:12 PM »
All 16k of my chips RAM.

ElectricDruid

Re: Multi Effects Pedal
« Reply #56 on: January 20, 2014, 04:08:08 PM »
You should check out Seb Francis 4xD stuff if you're doing FX on a dsPIC. It's great work. A bit more sophisticated, but it shows what can be done with these chips. He used an external codec like you discussed initially.

http://burnit.co.uk/sdiy/index.php?page=4xd

I've used the dsPIC '802 a lot myself, but pretty much always in assembler. There's some nice DSP features (DMA, hardware circular buffers) available which really save a lot of processor time, but I'm afraid I'd have no idea how you'd implement them from C.

Good luck anyway, it looks like a cool project.

Tom

MstrKurt

Re: Multi Effects Pedal
« Reply #57 on: February 02, 2014, 02:25:21 PM »
Hi again guys, I've recently bought a 23LC1024 1Mbit RAM chip that interfaces with the dsPIC through SPI.

Have any of you any experience on getting these things to work together?.

slacker

Re:
« Reply #58 on: February 02, 2014, 03:11:18 PM »
I'm playing with the same thing at the minute and the smaller 23k256.
Pretty easy to get working, the datasheet gives good explanations of what to do.
Let me know if you need any pointers, happy to share my code if needed.

MstrKurt

Re: Multi Effects Pedal
« Reply #59 on: February 04, 2014, 04:40:21 PM »
Thanks Slacker, I will give it a try according to the datasheets soon and see if I hit a wall.

I was told today that the sample time that is able to be achieved by 16k of RAM can be increased by lowering the resolution of my ADC or lowering the sample rate?. Is there any truth to this?.