Page:123

## ADC NOISE SOFTWARE SOLUTION! 6 years 11 months ago #199

 maykef OFFLINE New Member Posts: 11 Thank you received: 4 Karma: 2 I finally found a simple way to remove noise from of Arduino ADC, using a recursive low-pass filter. See the code: int y0, y1, x0, x1, d0 = 0, d1 = 0; // filter variables /* Use these equations to calculate the filter coefficients: decay= e^(-1/n) n is the number of samples that produce an equivalent time to discharge a capacitor. I use 7. b0=1-decay a1=decay y = x*b0 + delay*a1 delay=y */ x0 = in_ADC0; y0 = ((x0*15)/100) + ((d0*85)/100); d0=y0; x1 = in_ADC1; y1 = ((x1*15)/100) + ((d1*85)/100); d1=y1; The administrator has disabled public write access. The following user(s) said Thank You: caleborion, shanemikel

## ADC NOISE SOFTWARE SOLUTION! 6 years 11 months ago #203

 shanemikel OFFLINE New Member Posts: 17 Thank you received: 5 Karma: 1 Could you please elaborate a little here. For instance, I don't see where x comes from before you get to y=x*b0+delay*a1 . Also, you're using decay and delay (but where did delay come from?). I can't tell if that is code or pseudocode decay=e^(-1/n) is that e to the power of (-1/n) or binary arithmetic? If you could attatch a copy of a working sketch with this in it it would be easier for me to follow. The administrator has disabled public write access.

## ADC NOISE SOFTWARE SOLUTION! 6 years 11 months ago #204

 Ray OFFLINE Moderator Posts: 702 Thank you received: 152 Karma: 44 Thanks for your contribution ,I will try to code some examples and make some recordings during this week, Cheers! Last Edit: 6 years 11 months ago by Ray. The administrator has disabled public write access.

## ADC NOISE SOFTWARE SOLUTION! 6 years 11 months ago #206

 maykef OFFLINE New Member Posts: 11 Thank you received: 4 Karma: 2 X = CURRENT INPUT Y = CURRENT OUTPUT DECAY = PARAMETER TO CALCULATE COEFFICIENTS DELAY = PREVIOUS INPUT The administrator has disabled public write access.

## ADC NOISE SOFTWARE SOLUTION! 6 years 11 months ago #207

 maykef OFFLINE New Member Posts: 11 Thank you received: 4 Karma: 2 Tip: This filter will make the signal a little more bass, so you have to test values for n, or add more gain on distortion effects. The administrator has disabled public write access.

## ADC NOISE SOFTWARE SOLUTION! 6 years 11 months ago #208

 maykef OFFLINE New Member Posts: 11 Thank you received: 4 Karma: 2 You will use these formulas to calculate the coefficients before you put them on the code e = 2,71828183 It'S LIKE pi = 3,1415 The administrator has disabled public write access.

## ADC NOISE SOFTWARE SOLUTION! 6 years 11 months ago #211

 Ray OFFLINE Moderator Posts: 702 Thank you received: 152 Karma: 44 ... no progress here, I have tried to roughly code the idea but I cannot feel the difference on the background hiss:// Licensed under a Creative Commons Attribution 3.0 Unported License. // Based on rcarduino.blogspot.com previous work. // www.electrosmash.com/pedalshield     int in_ADC0, in_ADC1; //variables for 2 ADCs values (ADC0, ADC1) int POT0, POT1, POT2, out_DAC0, out_DAC1; //variables for 3 pots (ADC8, ADC9, ADC10) int LED = 3; int FOOTSWITCH = 7; int TOGGLE = 2; double x_0=0, y_0=0,d_0=0;   void setup() { //ADC Configuration ADC->ADC_MR |= 0x80; // DAC in free running mode. ADC->ADC_CR=2; // Starts ADC conversion. ADC->ADC_CHER=0x1CC0; // Enable ADC channels 0 and 1.   //DAC Configuration analogWrite(DAC0,0); // Enables DAC0 analogWrite(DAC1,0); // Enables DAC0 }   void loop() { //Read the ADCs while((ADC->ADC_ISR & 0x1CC0)!=0x1CC0);// wait for ADC 0, 1, 8, 9, 10 conversion complete. in_ADC0=ADC->ADC_CDR[7]; // read data from ADC0 in_ADC1=ADC->ADC_CDR[6]; // read data from ADC1 POT0=ADC->ADC_CDR[10]; // read data from ADC8 POT1=ADC->ADC_CDR[11]; // read data from ADC9 POT2=ADC->ADC_CDR[12]; // read data from ADC10   //Add volume feature with POT2 out_DAC0=map(in_ADC0,0,4095,1,POT2); out_DAC1=map(in_ADC1,0,4095,1,POT2);   x_0 = in_ADC0; y_0 = ((x_0*15)/100) + ((d_0*85)/100); d_0 = y_0;   //Write the DACs dacc_set_channel_selection(DACC_INTERFACE, 0); //select DAC channel 0 dacc_write_conversion_data(DACC_INTERFACE, y_0);//write on DAC dacc_set_channel_selection(DACC_INTERFACE, 1); //select DAC channel 1 // dacc_write_conversion_data(DACC_INTERFACE, out_DAC1);//write on DAC } This is an asynchronous volume/booster example (clean.ino) with the noise removal idea, I have tried also a sampled approach (implemented into clean_sampled.ino) but again nothing better The administrator has disabled public write access.