Electronic – Arduino – How to reduce the noise in the circuit

arduinonoise

I have a fairly simple circuit consisting of an arduino an accelerometer and an amplifier. I am collecting data from the accelerometer using I2C and playing some sounds through a switching amplifier (this).
The problem is I am getting a constant noise in the background. I am 90% sure it is because of the I2C connection between the accelerometer and the arduino.

Circuit

I am using an inductor of 10mH and cap 100nF
The amplifier is connected across the capacitor and is receiving power from arduino 5 volt supply. (I didn't draw it here). Also, I am not using external pull-up resistors with the accelerometer because apparently I don't need to when working with adxl 345

How can I reduce this noise? Where is it coming from?

Edit :-

My code has if else statements that play sounds if the accelerometer value is above a threshold. I think the noise has something to do with the fact that I am polling the accelerometer all the time.

Best Answer

I speculate that you're getting electromagnetic compatibility conductive coupling of noise through the power lines. I'm assuming you've already followed the best practice of making sure there is a a 1 microfarad (1 uF) capacitor or 0.1 uF cap connected to each power pin of each chip, with the other leg of that capacitor connected to GND.

If I were you, I would run a quick test something like this:

  • Put some sort of buffer or inverter between the Arduino and the LC filter.
  • Keep the GND connected between all the sections.
  • Disconnect the +5V line between each section.
  • Borrow 3 separate 5V power supplies to indepently power each section. (perhaps a independent mains-powered "USB recharger" wall-wart for each section +5V_a, +5V_b, and +5V_c).
  • Also get 3 big capacitors -- 100 uF or 220 uF or larger capacitor -- and put one in each section across the local +5V power supply and the common GND. (These will likely be electrolytic capacitors, because they are adequate for this job and cost far less than other ways of getting at least 100 uF).

    .      +5V_a              +5V_b    +5V_c
    .      |                  |        |
    . Accelerometer==(I2C)==Arduino--inverter--(LC filter)--speaker
    .      |                  |        |            |
    . GND--+------------------+--------+------------+-----------GND
    

To make sure I haven't accidentally connected the +5V lines together, I might spread them apart across my workbench, so I can visually see that it is obvious that the only connection between sections is the GND and the signal lines.

(I'd probably use a 74HC132 Schmitt NAND Gate or a 74HC253 or 74AC253 4:1 mux wired up as an inverter or buffer, because I have them in my stockpile of highly useful chips; but pretty much any 74xxx chip you happen to have on hand would work fine for this test).

Does this setup eliminate the noise you hear?

  • If this setup eliminates the noise: Great, we know the noise came through the power lines, and we know one way to fix it. Take a photo of the known-working arrangement, and then try to "optimize" by running off only 2 power supplies or 1 power supply. It should rapidly become clear exactly which section(s) is the source of the noise and which section is the victim of the noise, and you can use standard noise-reduction techniques (series resistor on output pin; LC filters, RC filters, pi filters, ferrite beads, etc. between one chip's power and another chip's power; etc.) to reduce the noise at its source and reduce the amount of noise that leaks from the source to the target.

  • If this setup does not eliminate the noise: there must be some other source of noise. Perhaps there is a bad interaction between the software that plays the sounds and the software that reads and writes the I2C bus? If you make a separate temporary test sketch that never talks to the accelerometer but always unconditionally plays sounds, do you still hear the noise? What's the shortest sketch you can make that exhibits the problem?