0
\$\begingroup\$

I am working on an embedded systems project using an Arduino Uno, and I wanted to convert my project over to a breadboard using the ATMega328-PU IC with the bootloader. Initially, this worked flawlessly, and I was satisfied with the results.

However, I wanted to incorporate ADC analysis into my project. So first I made sure that the project ran smoothly off of the Arduino Uno, which it did. When I loaded the code to the IC, however, I noticed that all of my read-in ADC values had dropped by ~20%. I measured the voltage at the pin using an o-scope, and the readings from the scope were accurate to what I expected, so I was not inclined to believe that it was a voltage problem. Besides, all other features of my project appear to be working perfectly fine - it is ONLY the ADC that is spitting back undesired results. I am even trying to feed it a DC voltage to avoid any oscillation, and it is still giving me 20% less than the applied value. From reading online, I know it is a common problem, so to be clear, my IC and the applied source do share a common ground.

I am currently a college student, doing this project for fun, so I asked one of my professors for advice, and he suggested decoupling my breadboard VCC and GND rails using a 0.1uF capacitor. So, I tried this, but it showed absolutely no improvement.

Later today I can make a block diagram of my project, if that would be helpful. But in the meantime, I will briefly describe it:

As stated, the project uses the ATMega328-PU, and I have applied a 16MHz oscillator to the clock pins, which are respectively in series with 22pF capacitors that go to ground. The Rx/Tx pins are used to communicate with an HC-05 bluetooth module (paired to a smartphone, controlled by an app). A digital pin is assigned to an LED in series with a resistor. A 9V battery powers the project by first passing through a 5V voltage regulator that feeds the 5V output to the VCC rails and the ground to the GND rails. The unregulated battery supply is passed through a voltage divider to drop it by 5/9. This divided voltage is then passed to an analog input pin on the ATMega. Since the values were not particularly consistent, a smoothing capacitor was also placed between the analog input and ground since there is an occasional (and undesired) fluctuation in the applied analog input. I have tried to measure with and without this capacitor, but the margin of error is the same.

Since the Arduino handles the code with this circuitry just fine, I am convinced that it is not a software problem. Also, it is only when the programmed chip is placed on the breadboard that I get these false readings. Therefore, I believe either I should have used a different decoupling capacitor along my rails (though 0.1uF seems to be the consensus when I look online...) or I am missing some additional external circuitry that the Arduino has but my breadboard does not (though, if it exists, I cannot find any references to any additional circuitry for this...). I would like to state again, the other features of the project work fine. It just seems to be the ADC that is struggling to perform correctly.

Any thoughts or suggestions would be much appreciated!

\$\endgroup\$
  • \$\begingroup\$ So works fine on a PCB with a ground plane and lots of bypassing. Place a 10uF, or 100uF, across the IC. Use very short leads ( < 1 cm). \$\endgroup\$ – analogsystemsrf Mar 18 at 14:19
  • 2
    \$\begingroup\$ Have you got the exact same connections for all VCC, AVCC, GND, and AREF pins like on Arduino? \$\endgroup\$ – Justme Mar 18 at 14:25
  • \$\begingroup\$ @Justme Yes, I have checked a number of times, and all of those connections match that of the Arduino \$\endgroup\$ – KC Ford Mar 18 at 14:38
  • \$\begingroup\$ @analogsystemsrf Thanks for the suggestion! Just for my own understanding, when placing the 10/100 uF cap across the IC, you mean placing it across the VCC and GND pins of the IC? \$\endgroup\$ – KC Ford Mar 18 at 14:40
  • 1
    \$\begingroup\$ What reference are you selecting? \$\endgroup\$ – Kevin White Mar 18 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.