Welcome, Guest
Username: Password: Remember me

TOPIC: MEGA electrical measurements

MEGA electrical measurements 1 year 4 months ago #1449

Hi -
I have built the pedalshield MEGA...works well. For educational purposes, I am interested in having students make measurements on the board. Potential measurements include:
- effects of Low Pass Filtering
- OP AMP Gain
- PWM signals

The filtering and gain would be done using input/output measurements and forming transfer functions.

My questions for the forum are:
- Where is best location to measure input signal to board. Is this FX_In on schematic?
- Rather than guitar input, can you hook up a noise generator at input jack? Has anyone done this? I am thinking that noise would be easier than transient guitar signals for forming transfer functions
- Has anyone made these types of measurements before? What advice/guidance would you give? Did you use oscilloscope, FFT box,...??

TIA for any guidance you can provide.
The administrator has disabled public write access.

MEGA electrical measurements 1 year 4 months ago #1452

  • Ray
  • Ray's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 695
  • Thank you received: 146
  • Karma: 41
Hi,
These are the answers for your questions:
- Where is best location to measure input signal to board. Is this FX_In on schematic?
On the MEGA, the best point to measure FX_in may be on top of the input connector (the are is big and you can attach an oscilloscope probe easily):

fx_in.png


- Rather than guitar input, can you hook up a noise generator at input jack? Has anyone done this? I am thinking that noise would be easier than transient guitar signals for forming transfer functions
as far as the levels are sensible you can do it without problems, the shield is designed for guitar signals (around 200mVpp) but you can go around line levels (3Vpp) without problems (but you would need to adjust the input stage level for that with the VR1 trimmer.

We did not try a noise generator, people use smartphones with signal generator apps.
- Has anyone made these types of measurements before? What advice/guidance would you give? Did you use oscilloscope, FFT box,...??
We never try to measure the transfer function of it but it should not be difficult. I can do it if you need it. The signal is heavily attenuated over 5KHz to avoid noise (many digital guitar pedals do this "trick", there is not much info in the guitar signal over 5K and the Arduino sampling rate is not hi-fi)
The administrator has disabled public write access.

MEGA electrical measurements 1 year 4 months ago #1454

Ray-

Thanks so much. Really appreciate your guidance. Couple of follow up items:
1) I would appreciate you making some transfer function measurements. It would provide a baseline for me to compare students' measurements against. Consider making the input stage TF measurement to see op-amp gain and effects of (low pass) filtering
2) Can you provide any further information on (recommended?) smart phone apps for noise generation in the context of making TF measurements?

Thanks again for your support.
Steve
The administrator has disabled public write access.

MEGA electrical measurements 1 year 3 months ago #1465

  • Ray
  • Ray's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 695
  • Thank you received: 146
  • Karma: 41
1) I would appreciate you making some transfer function measurements. It would provide a baseline for me to compare students' measurements against. Consider making the input stage TF measurement to see op-amp gain and effects of (low pass) filtering
I did some measurements today. They are limited because if I apply maximum gain to the input signal I end up having clipping and the TF gets messed up.
This is a clean signal going through the pedalSHIELD MEGA in bypass mode:

base.png

Nothing special up there, this image is just for reference, my measurement system is band-limited as you can see the signal rolling off over 20K and below 10Hz.


Input Stage Measurements:
Measuring from the input jack to the ADC (R6-C5 junction):
Adjusting with the trimmer to have minimum gain:
inputonly_gmin.png


Adjusting with the trimmer to have more gain:
inputonly_gmax.png


I wrote more and not "maximum" because if you apply maximum gain with this trimmer you will get the signal clipped and measurement will go wrong. Guitar signals are pretty small (100-200mVpp) so they won't clip.
You can see how the signal is low-pass filtered to improve the ADC aliasing.

Complete System Measurements:
Measuring from the input jack to the output jack:
Minimum Gain:
base_gmin.png



More Gain:
base_gmax.png


You can see how the signal is low-pass filtered even more. Many digital effects remove all content over 5KHz (have a look to the Boss CE2 Analysis: www.electrosmash.com/boss-ce-2-analysis the antialiasing and reconstruction filters are around 5/6KHz)

2) Can you provide any further information on (recommended?) smart phone apps for noise generation in the context of making TF measurements?
I use ARTA and a good external sound card (EMU 0404), I think that you can use cheaper sound cards for this. There is plenty of info online or in the DIYaudio forum. Sometimes I use signal generators apps from my phone to generate the input signal, there is plenty of them. Right now I have this one: play.google.com/store/apps/details?id=radonsoft.net.signalgen but again, there is plenty of alternatives.
The administrator has disabled public write access.

MEGA electrical measurements 1 year 3 months ago #1468

Ray-

I am very grateful for the work and your reply. You are best!

Steve
The administrator has disabled public write access.
The following user(s) said Thank You: Ray

MEGA electrical measurements 1 year 3 months ago #1481

Ray-

We have been making some measurements and would like to get some additional guidance from you. Let me explain what we tried (I apologize for wordiness)...
1. Put a sine wave into input jack
2. Using a multimeter, we could observe correct frequency by putting positive lead on spring for input jack tip (FX_in) and negative lead at GND location on board (left of foot switch when viewing top-down)
3. However, we see no frequency indication when moving positive lead to A0 (ADC input) with negative lead at GND location
4. Keeping positive lead at A0 and moving negative lead to +2.5V test point does show correct frequency at A0.
5. We cannot see any frequency indication with multimeter at any location on output side. This includes output jack spring location and DIGITAL PINS 6 and 7 for Arduino board.

I should also note that board appears to working properly. We are running the spectrum analyzer sketch (BTW...very cool!) and see a discrete response on OLED screen that follows the tone frequency. Trimmer seems to be moving tone amplitude up and down appropriately. We physically hear tone when plugging output of board into an amplifier.

Would like your thoughts specifically on...
1. Why we are not able to see frequency indication at any location on output (jack, PWM pins or elsewhere?)
2. Why are we not seeing frequency indication at A0 using negative lead connected to GND test point on board and conversely, why do we see tone frequency at A0 when connecting negative lead to +2.5V test point.
3. For clarity, please identify the specific measurement locations that you used to generate the frequency response plots in your earlier post in this thread.

Really appreciate your support and thanks for taking the time to help. We purchased a number of the MEGA kits for my upcoming class this fall as the basis for a project in an electrical engineering class.

Regards,
Steve
The administrator has disabled public write access.

MEGA electrical measurements 1 year 3 months ago #1483

  • Ray
  • Ray's Avatar
  • NOW ONLINE
  • Moderator
  • Posts: 695
  • Thank you received: 146
  • Karma: 41
Hi Steve,
3. However, we see no frequency indication when moving positive lead to A0 (ADC input) with negative lead at GND location
This is because the signal at this point has 2.5V offset (so we can use the maximum span of the ADC which is 0 to 5V), multimeters on Hz function (frequency measurement) cannot measure the signal when it has offset, this is why you cannot detect it.
4. Keeping positive lead at A0 and moving negative lead to +2.5V test point does show correct frequency at A0.
By doing that you are effectively removing the 2.5V offset from the A0 signal, this is why you can now measure it correctly.

Make sure that you are loading a clean effect so the signal will "go through" the pedal (with the spectrum analyzer code, the signal does not go through the pedal)
This CLEAN code is good:
// www.Electrosmash.com/rights CC-by-NC
// Based on OpenMusicLabs previous works.
// pedalshield_mega_clean.ino reads the ADC and writes the PWMs
 
#include "U8glib.h"
U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NO_ACK);  // Display which does not send ACK
 
//defining hardware resources.
#define LED 13
#define FOOTSWITCH 12
#define TOGGLE 2
#define PUSHBUTTON_1 A5
#define PUSHBUTTON_2 A4

//defining the output PWM parameters
#define PWM_FREQ 0x00FF // pwm frequency - 31.3KHz
#define PWM_MODE 0 // Fast (1) or Phase Correct (0)
#define PWM_QTY 2 // 2 PWMs in parallel

//other variables
int input;
unsigned int ADC_low, ADC_high;
 
void setup() {
  //setup IO
  pinMode(FOOTSWITCH, INPUT_PULLUP);
  pinMode(TOGGLE, INPUT_PULLUP); 
  pinMode(PUSHBUTTON_1, INPUT_PULLUP);
  pinMode(PUSHBUTTON_2, INPUT_PULLUP);
  pinMode(LED, OUTPUT);
  pinMode(6, OUTPUT); //PWM0 as output
  pinMode(7, OUTPUT); //PWM1 as output
 
  // setup ADC
  ADMUX = 0x60; // left adjust, adc0, internal vcc
  ADCSRA = 0xe5; // turn on adc, ck/32, auto trigger
  ADCSRB = 0x00; //free running mode
  DIDR0 = 0x01; // turn off digital inputs for adc0
 
  // setup PWM
  TCCR4A = (((PWM_QTY - 1) << 5) | 0x80 | (PWM_MODE << 1)); //
  TCCR4B = ((PWM_MODE << 3) | 0x11); // ck/1
  TIMSK4 = 0x20; // interrupt on capture interrupt
  ICR4H = (PWM_FREQ >> 8);
  ICR4L = (PWM_FREQ & 0xff);
  DDRB |= ((PWM_QTY << 1) | 0x02); // turn on outputs
  sei(); // turn on interrupts - not really necessary with arduino
  }
 
void loop() 
{
  //Turn on the LED and write the OLED if the effect is ON.
  if (digitalRead(FOOTSWITCH)) 
  {
  digitalWrite(LED, HIGH); //light the LED
    u8g.firstPage(); 
 do {
   u8g.setFont(u8g_font_helvR12r);
   u8g.drawStr( 0, 25, " CLEAN EFFECT ");    
  } while( u8g.nextPage() );
  }
    else  
  {  
    digitalWrite(LED, LOW); // switch-off the LED
    u8g.firstPage(); 
    do {
        u8g.setFont(u8g_font_helvR24r);
        u8g.drawStr( 0, 30, "EFFECT");    
        u8g.drawStr( 0, 60, "   OFF ");   
        } while( u8g.nextPage() );
  }
}
 
ISR(TIMER4_CAPT_vect) 
{
  // get ADC data
  ADC_low = ADCL; // you need to fetch the low byte first
  ADC_high = ADCH;
  //construct the input sumple summing the ADC low and high byte.
  input = ((ADC_high << 8) | ADC_low) + 0x8000; // make a signed 16b value
 
//// No Digital Signal Processing beacuse is a CLEAN effect ////
 
  //write the PWM signal
  OCR4AL = ((input + 0x8000) >> 8); // convert to unsigned, send out high byte
  OCR4BL = input; // send out low byte
 
}
1. Why we are not able to see frequency indication at any location on output (jack, PWM pins or elsewhere?)
you should be able to see it, as I said make sure that you load a clean effect and additionally use the sinewave generator to make sure that the output stage works fine (more details here: www.electrosmash.com/forum/pedalshield-m...lshield-mega?lang=en)
2. Why are we not seeing frequency indication at A0 using negative lead connected to GND test point on board and conversely, why do we see tone frequency at A0 when connecting negative lead to +2.5V test point.
As I said before the multimenter does not detect when the signal has offset, I have replicated it here. Using an oscilloscope I can see the signal though.
3. For clarity, please identify the specific measurement locations that you used to generate the frequency response plots in your earlier post in this thread.
I used the output Jack, negative to ground (or the ring of the connector) and positive to the tip of the output jack.

If you have any other question, let me know!
Last Edit: 1 year 3 months ago by Ray.
The administrator has disabled public write access.
Time to create page: 0.149 seconds
Powered by Kunena Forum
Joomla SEF URLs by Artio