Prop Sigma ADC
average joe
Posts: 795
Hey guys, I've been reading a lot of material on the propeller and sigma ADC. I understand the theory of operation fairly well and doubt that I will be able to make it work for my purpose. This does not deter me from trying though. I believe my main issue will be the fact I'm using the 40 pin dip. I already have a propRPM v1.0, which I love by the way.
I am sorry for beating a dead horse but most of the threads I have read concerning sigma ADC are fairly old.
What I need: To measure the amplitude of an AC signal, with fair resolution. *I think 8 bit should work*
More info: The ac signal will be the output from my guitar.
I imagine I will need a bit of gain before the ADC to bring voltage within range.
My main question is: Am I wasting my time trying to make this work? Are there any tips, tricks or advice from the community? If this will NOT work, what ADC chip would you recommend?
I have already built my circuit from the microphone to vga source *omitting the mic and 10k pullup resistor* on pins 25 and 26. Since I do not have a vga out, I can't test with this source code.
I am still unclear how to transform the sigma ADC pulse train into a useable value. Furthermore, I am questioning how to turn this usable value into an amplitude. I am fairly new to the propeller so this is all a bit confusing.
I am sorry for beating a dead horse but most of the threads I have read concerning sigma ADC are fairly old.
What I need: To measure the amplitude of an AC signal, with fair resolution. *I think 8 bit should work*
More info: The ac signal will be the output from my guitar.
I imagine I will need a bit of gain before the ADC to bring voltage within range.
My main question is: Am I wasting my time trying to make this work? Are there any tips, tricks or advice from the community? If this will NOT work, what ADC chip would you recommend?
I have already built my circuit from the microphone to vga source *omitting the mic and 10k pullup resistor* on pins 25 and 26. Since I do not have a vga out, I can't test with this source code.
I am still unclear how to transform the sigma ADC pulse train into a useable value. Furthermore, I am questioning how to turn this usable value into an amplitude. I am fairly new to the propeller so this is all a bit confusing.
Comments
http://www.parallaxsemiconductor.com/an008
-Phil
-Phil
2. Counter not programmed to provide feedback or providing feedback to the wrong pin.
3. Feedback pin not set via DIRA to be an output.
4. Too high a value of the feedback resistor for the input impedance or signal level.
-Phil
mov dira,#1<<SDF
to this:
mov dira,SigmaFBDir
and added:
SigmaFBDir long $0400_0000
because I was using pin 26 as the feedback pin.
I discovered this after I switched the feedback pin to pin 4 and changed the mov instruction back. I knew I shouldn't have been tinkering around in assembly yet, lol. Baseline now reads 140-145, much better. I still need to figure out how to turn this into a useful amplitude value.
2. Increase the feedback resistance.
3. Increase the integration time.
-Phil
The ADC object is just the first piece of code for this project. I believe the range I'm currently sampling should be sufficient. What I was referring to when I said I still need to turn the sample into a usable value was something like :
sample := AdcSample - 142
|| sample
to return the amplitude of the signal. 142 is the approximate offset. I would like to do this part in the ASM code for the ADC if possible.
I keep looking at AN008, in particular the calibration code. I am considering using a multiplexer on the front end of the prop, with the prop generating a reference signal for calibration. A similar circuit is shown in figure 7 of AN008. I should have a schematic in the next couple days.
Pin1 Ground
Pin2 ADC IN
Pin3 Calibration out
Pin4 Input Select
Pin5 Calibration Select
mov out_sample,asm_sample
subs out_sample,#offset
abs out_sample,out_sample
wrlong out_sample,par
Offset is set in the CON block. Things are slow going due to my unfamiliarity with the propeller.
The challenge now is to implement an envelope generator triggered by the amplitude of the guitar in. I'm still working out the theory of operation for this method or methods. I am considering using the counters to do this.
As for your latest example code, calling a method (being equivalent to GOSUB) from within itself may eventually eat all you stack space and make your program fall over in interesting ways. If you're lucky it will return from the call and continue processing after the method call which doesn't seem to be what you want. You could restructure your method or simply return from it and have the original call run in an endless loop, e.g. The return will exit the method and return to the repeat loop, then call the method again. One last thing, you should use =< for comparisons instead of <= (assignment). HTH
It would help a lot if you describe what you want to do.
I guess you want trigger an envelope generator from the guitar signal. But what does this envelope modulate?
I think first you need to extract the envelope of the guitar signal, to get a useful signal to trigger your envelope generator.
Then when this "guitar envelope" is over a trigger level the attack of your generator is startet, and when it's under the sustain level it goes to release.
What you have in your code does not do that: This tests a bit (or several bits) of the current ADC sample, I dont see how this can be a trigger criteria.
The same for the GateMask.
I would code an Envelope generator as a state machine, something like this pseudo code: This is called in a loop and generates one "sample" of the envelope.
Andy
Ariba
I apologize for being so obscure. You are correct about triggering the envelope generator from my guitar. I am using a modified version of Beau's generic ADC object. I added this code before writing out the long to prepare my "trigger" and "gate" values. The masks are then used to chose either amplitude *for trigger* or average *for gate*. Please note in the load section *which converts the times in milliseconds, into clocks per step* the selected gate value is shifted left 16 bits to match the average output from the ADC. I did this to limit the number of hub writes for the ADC *since it already passed a long back to the hub*
The envelope will be output to a Spi DAC *specifically AD7303, which generates a 0-5v control signal. This control signal will be fed into VCA, more specifically an Alesis MicroLimiter that has been hacked to receive a 0-5v CV. I actually need to generate TWO envelopes, programed independently *please don't ask why, lol*. They will both receive the same AdcSample, but will each get their own Trigger, Gate, Attack, Decay, Sustain and Release values. I'm still working out how to call these methods. Also, thanks for the state machine example. This should prove very helpful when re-writing in Pasm.
A big thank you to everyone who has contributed. You guys have been a huge help as always. I will update this thread as I continue my work. I expect progress to be slow right now for several reasons. First, the new semester started yesterday. Second, I'm about to have a son any day Thanks again!
Joe
I re-wrote Beau's ADC driver to accept 4 - 8bit "levels" *Trigger and Gate, A and B* and store them into a single long. The address of this long is passed into assembly. The assembly program samples the input, then removes dc offset and returns absolute value.*Amplitude* Then it adds the amplitude into a running average and divides by 2. This is where things get a little tricky. The assembly program should read the levels, one byte at a time and then compare this with the amplitude and average. *Triggers compared with peak, Gate compared with average* It modifies Trigger and Gate pins accordingly. I used 4 - rdbyte instructions instead of 1 rdlong instruction because the long would need masking and shifting. Not sure which is more efficient.
I'm not sure if anyone else can use this for something? I plan on posting this object to OBEX when finished. Any suggestions before posting? Any suggestions period?
I have several more objects to work on before I can test my project in full. Next is a modification of SPI driver needed to run my DAC. Then ADSR methods done in ASM as well as UI done in Spin. I will keep you guys updated as I continue.
I will be hooking up the sigma-delta adc to a 4558 op amp driven from dual 15v rails. The op-amp is configured as a voltage follower to buffer an audio signal from a previous stage. I think I need a resistor between the op-amp output and input cap to protect the prop against voltage spikes during power on, etc. I'm a little unsure how to figure for this resistor.
-Phil
He's doing it right. It's a unity-gain buffer amp.
-Phil
I am working on low-level drivers right now. I want to get the screen working first, then touch, sd card after that. The final integration should be painless. I'm drawing up schematics later this week.
I made changed to accommodate the new display.
I need a value for R1. X. Or how to figure it. My thought is it's not entirely necessary, but. IF something happens and the signal input gets driven to either rail, or other faults, I don't wanna burn a prop pin. ?
-Phil
If the equation/s have a name I can look it up. Thanks.